diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js index 21d908b5..f70d75f4 100644 --- a/lib/ace/edit_session.js +++ b/lib/ace/edit_session.js @@ -246,7 +246,6 @@ var EditSession = function(text, mode) { this.selection.clearSelection(); this.$resetRowCache(0); - this.$deltas = []; this.$deltasDoc = []; this.$deltasFold = []; this.getUndoManager().reset(); @@ -343,7 +342,6 @@ var EditSession = function(text, mode) { **/ this.setUndoManager = function(undoManager) { this.$undoManager = undoManager; - this.$deltas = []; this.$deltasDoc = []; this.$deltasFold = []; @@ -358,10 +356,9 @@ var EditSession = function(text, mode) { * **/ this.$syncInformUndoManager = function() { - self.$informUndoManager.cancel(); - + var $deltas = []; if (self.$deltasFold.length) { - self.$deltas.push({ + $deltas.push({ group: "fold", deltas: self.$deltasFold }); @@ -369,17 +366,17 @@ var EditSession = function(text, mode) { } if (self.$deltasDoc.length) { - self.$deltas.push({ + $deltas.push({ group: "doc", deltas: self.$deltasDoc }); self.$deltasDoc = []; } - if (self.$deltas.length > 0) { + if ($deltas.length > 0) { undoManager.execute({ action: "aceupdate", - args: [self.$deltas, self] + args: [$deltas, self] }); } diff --git a/lib/ace/editor.js b/lib/ace/editor.js index b248975c..86057a31 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -84,12 +84,13 @@ var Editor = function(renderer, session) { this.keyBinding = new KeyBinding(this); // TODO detect touch event support - if (useragent.isIPad) { + /* if (useragent.isIPad) { //this.$mouseHandler = new TouchHandler(this); } else { - this.$mouseHandler = new MouseHandler(this); - new FoldHandler(this); - } + + } */ + this.$mouseHandler = new MouseHandler(this); + new FoldHandler(this); this.$blockScrolling = 0; this.$search = new Search().set({ @@ -689,6 +690,10 @@ var Editor = function(renderer, session) { this._emit("paste", text); this.insert(text); }; + + this.execCommand = function(cmd, args) { + return this.commands.exec(cmd, this, args); + }; /** * Editor.insert(text) diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js index 13f6e798..4b31c191 100644 --- a/lib/ace/keyboard/textinput.js +++ b/lib/ace/keyboard/textinput.js @@ -145,7 +145,7 @@ var TextInput = function(parentNode, host) { var copyText = host.getCopyText(); if(copyText) { text.value = copyText; - host.onCopy(copyText); + host.execCommand("copy", copyText); } else e.preventDefault(); reset(); @@ -159,7 +159,7 @@ var TextInput = function(parentNode, host) { var copyText = host.getCopyText(); if(copyText) { text.value = copyText; - host.onCut(copyText); + host.execCommand("cut", copyText); } else e.preventDefault(); reset(); diff --git a/lib/ace/mouse/mouse_handler.js b/lib/ace/mouse/mouse_handler.js index bf708ee2..1a749917 100644 --- a/lib/ace/mouse/mouse_handler.js +++ b/lib/ace/mouse/mouse_handler.js @@ -62,7 +62,7 @@ var MouseHandler = function(editor) { var mouseTarget = editor.renderer.getMouseEventTarget(); event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click")); event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove")); - event.addMultiMouseDownListener(mouseTarget, [300, 300, 250], this, "onMouseEvent"); + event.addMultiMouseDownListener(mouseTarget, [350, 300, 250], this, "onMouseEvent"); event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel")); var gutterEl = editor.renderer.$gutter; diff --git a/lib/ace/undomanager.js b/lib/ace/undomanager.js index 67c30f38..1b92eb2b 100644 --- a/lib/ace/undomanager.js +++ b/lib/ace/undomanager.js @@ -82,6 +82,7 @@ var UndoManager = function() { * [Perform an undo operation on the document, reverting the last change. Returns the range of the undo.]{: #UndoManager.undo} **/ this.undo = function(dontSelect) { + this.$doc.$syncInformUndoManager(); var deltas = this.$undoStack.pop(); var undoSelectionRange = null; if (deltas) { @@ -99,6 +100,7 @@ var UndoManager = function() { * [Perform a redo operation on the document, reimplementing the last change.]{: #UndoManager.redo} **/ this.redo = function(dontSelect) { + this.$doc.$syncInformUndoManager(); var deltas = this.$redoStack.pop(); var redoSelectionRange = null; if (deltas) {