From e54882db64e20da55ff06f15acb452798fc3f2ae Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 7 Dec 2014 01:08:06 +0400 Subject: [PATCH 1/4] use setAttribute instead of autocorrect setter, since the setter doesn't work on ipad --- lib/ace/keyboard/textinput.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js index c0902e27..605f5b8e 100644 --- a/lib/ace/keyboard/textinput.js +++ b/lib/ace/keyboard/textinput.js @@ -45,10 +45,10 @@ var TextInput = function(parentNode, host) { if (useragent.isTouchPad) text.setAttribute("x-palm-disable-auto-cap", true); - text.wrap = "off"; - text.autocorrect = "off"; - text.autocapitalize = "off"; - text.spellcheck = false; + text.setAttribute("wrap", "off"); + text.setAttribute("autocorrect", "off"); + text.setAttribute("autocapitalize", "off"); + text.setAttribute("spellcheck", false); text.style.opacity = "0"; if (useragent.isOldIE) text.style.top = "-100px"; From 2fc497477de8a017bd61a173b2a93dbe4e81a655 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 7 Dec 2014 01:26:24 +0400 Subject: [PATCH 2/4] highlight tags when cursor is before tagname --- lib/ace/editor.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 78c7c18d..0d4e9df2 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -539,11 +539,14 @@ var Editor = function(renderer, session) { var iterator = new TokenIterator(self.session, pos.row, pos.column); var token = iterator.getCurrentToken(); - if (!token || token.type.indexOf('tag-name') === -1) { + if (!token || !/\b(?:tag-open|tag-name)/.test(token.type)) { session.removeMarker(session.$tagHighlight); session.$tagHighlight = null; return; } + + if (token.type.indexOf("tag-open") != -1) + token = iterator.stepForward(); var tag = token.value; var depth = 0; From c49e5bfef983da748a8a140e537a7f03a7bfee9c Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 7 Dec 2014 01:26:44 +0400 Subject: [PATCH 3/4] disable warning --- lib/ace/mouse/multi_select_handler.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ace/mouse/multi_select_handler.js b/lib/ace/mouse/multi_select_handler.js index 8d6af6b5..9b52e237 100644 --- a/lib/ace/mouse/multi_select_handler.js +++ b/lib/ace/mouse/multi_select_handler.js @@ -150,7 +150,8 @@ function onMouseDown(e) { if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor, selection.lead)) return; screenCursor = newCursor; - + + editor.$blockScrolling++; editor.selection.moveToPosition(cursor); editor.renderer.scrollCursorIntoView(); @@ -160,8 +161,9 @@ function onMouseDown(e) { rectSel[0] = editor.$mouseHandler.$clickSelection.clone(); rectSel.forEach(editor.addSelectionMarker, editor); editor.updateSelectionMarkers(); + editor.$blockScrolling--; }; - + editor.$blockScrolling++; if (isMultiSelect && !accel) { selection.toSingleRange(); } else if (!isMultiSelect && accel) { @@ -173,6 +175,7 @@ function onMouseDown(e) { screenAnchor = session.documentToScreenPosition(selection.lead); else selection.moveToPosition(pos); + editor.$blockScrolling--; screenCursor = {row: -1, column: -1}; From d8f0ab2a16886113839ab8346f8b7b8a3b172e28 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 12 Dec 2014 16:56:02 +0400 Subject: [PATCH 4/4] fix regression in setDefaultValues --- lib/ace/config_test.js | 11 +++++++++-- lib/ace/lib/app_config.js | 7 +++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/ace/config_test.js b/lib/ace/config_test.js index ac664fae..2883d9e5 100644 --- a/lib/ace/config_test.js +++ b/lib/ace/config_test.js @@ -117,12 +117,19 @@ module.exports = { assert.equal(o.getOption("initialValue"), 8); o.setOption("initialValue", 7); assert.equal(o.getOption("opt2"), 7); - + + config.setDefaultValues("test_object", { + opt1: 1, + forwarded: 2 + }); + config.resetOptions(o); + assert.equal(o.getOption("opt1"), 1); + assert.equal(o.getOption("forwarded"), 2); } }; }); if (typeof module !== "undefined" && module === require.main) { - require("asyncjs").test.testcase(module.exports).exec() + require("asyncjs").test.testcase(module.exports).exec(); } diff --git a/lib/ace/lib/app_config.js b/lib/ace/lib/app_config.js index 84b9e70c..4fe78a1d 100644 --- a/lib/ace/lib/app_config.js +++ b/lib/ace/lib/app_config.js @@ -31,7 +31,6 @@ define(function(require, exports, module) { "no use strict"; -var lang = require("./lang"); var oop = require("./oop"); var EventEmitter = require("./event_emitter").EventEmitter; @@ -91,10 +90,10 @@ function reportError(msg, data) { if (typeof console == "object" && console.error) console.error(e); setTimeout(function() { throw e; }); -}; +} var AppConfig = function() { - this.$defaultOptions = {}; + this.$defaultOptions = {}; }; (function() { @@ -145,7 +144,7 @@ var AppConfig = function() { this.setDefaultValues = function(path, optionHash) { Object.keys(optionHash).forEach(function(key) { this.setDefaultValue(path, key, optionHash[key]); - }); + }, this); }; this.warn = warn;