fix undo manager
This commit is contained in:
parent
111c75b158
commit
7ddb4d728c
2 changed files with 2 additions and 2 deletions
|
|
@ -501,7 +501,7 @@ var Document = function(text, mode) {
|
||||||
|
|
||||||
this.undoChanges = function(deltas) {
|
this.undoChanges = function(deltas) {
|
||||||
this.selection.clearSelection();
|
this.selection.clearSelection();
|
||||||
for (var i=0; i<deltas.length; i++) {
|
for (var i=deltas.length-1; i>=0; i--) {
|
||||||
var delta = deltas[i];
|
var delta = deltas[i];
|
||||||
if (delta.action == "insertText") {
|
if (delta.action == "insertText") {
|
||||||
this.remove(delta.range, true);
|
this.remove(delta.range, true);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ PluginManager.registerCommand("find", function(editor, selection) {
|
||||||
editor.find(needle);
|
editor.find(needle);
|
||||||
});
|
});
|
||||||
PluginManager.registerCommand("undo", function(editor, selection) {
|
PluginManager.registerCommand("undo", function(editor, selection) {
|
||||||
editor.undo();
|
editor.undo();
|
||||||
});
|
});
|
||||||
PluginManager.registerCommand("redo", function(editor, selection) {
|
PluginManager.registerCommand("redo", function(editor, selection) {
|
||||||
editor.redo();
|
editor.redo();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue