|
|
|
@ -209,9 +209,12 @@ module.exports = Backbone.Model.extend({ |
|
|
|
* @private |
|
|
|
* */ |
|
|
|
initUndoManager() { |
|
|
|
const canvas = this.get('Canvas'); |
|
|
|
|
|
|
|
if (this.um) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var cmp = this.get('DomComponents'); |
|
|
|
if(cmp && this.config.undoManager) { |
|
|
|
var that = this; |
|
|
|
@ -223,11 +226,18 @@ module.exports = Backbone.Model.extend({ |
|
|
|
this.set('UndoManager', this.um); |
|
|
|
|
|
|
|
key('⌘+z, ctrl+z', () => { |
|
|
|
if (canvas.isInputFocused()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
that.um.undo(true); |
|
|
|
that.trigger('component:update'); |
|
|
|
}); |
|
|
|
|
|
|
|
key('⌘+shift+z, ctrl+shift+z', () => { |
|
|
|
if (canvas.isInputFocused()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
that.um.redo(true); |
|
|
|
that.trigger('component:update'); |
|
|
|
}); |
|
|
|
@ -262,6 +272,7 @@ module.exports = Backbone.Model.extend({ |
|
|
|
that.trigger('change:selectedComponent'); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
UndoManager.removeUndoType("change"); |
|
|
|
UndoManager.addUndoType("change:style", customUndoType); |
|
|
|
UndoManager.addUndoType("change:content", customUndoType); |
|
|
|
|