Merge pull request #2005 from ajaxorg/overridable-mergeables
Make mergeable commands (for undo history) overridable.
This commit is contained in:
commit
14f5095c92
1 changed files with 3 additions and 2 deletions
|
|
@ -211,13 +211,14 @@ var Editor = function(renderer, session) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO use property on commands instead of this
|
||||||
|
this.$mergeableCommands = ["backspace", "del", "insertstring"];
|
||||||
this.$historyTracker = function(e) {
|
this.$historyTracker = function(e) {
|
||||||
if (!this.$mergeUndoDeltas)
|
if (!this.$mergeUndoDeltas)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
var prev = this.prevOp;
|
var prev = this.prevOp;
|
||||||
var mergeableCommands = ["backspace", "del", "insertstring"];
|
var mergeableCommands = this.$mergeableCommands;
|
||||||
// previous command was the same
|
// previous command was the same
|
||||||
var shouldMerge = prev.command && (e.command.name == prev.command.name);
|
var shouldMerge = prev.command && (e.command.name == prev.command.name);
|
||||||
if (e.command.name == "insertstring") {
|
if (e.command.name == "insertstring") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue