From cb19de3cbd913a2eb8fef22d2f35c6be5b19023a Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Mon, 11 Dec 2017 01:40:44 +0100 Subject: [PATCH] Check focused inputs in undo/redo --- src/editor/model/Editor.js | 23 ----------------------- src/undo_manager/index.js | 2 ++ 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index e440f22cf..2bf23328b 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -232,11 +232,6 @@ 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) { @@ -245,25 +240,7 @@ module.exports = Backbone.Model.extend({ register: [cmp.getComponents(), this.get('CssComposer').getAll()], track: true }); - this.UndoManager = this.um; - 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'); - }); } }, */ diff --git a/src/undo_manager/index.js b/src/undo_manager/index.js index 6b46f9ecc..de701818f 100644 --- a/src/undo_manager/index.js +++ b/src/undo_manager/index.js @@ -201,6 +201,7 @@ module.exports = () => { * Undo last change */ undo() { + if (em.get('Canvas').isInputFocused()) return; um.undo(1); }, @@ -217,6 +218,7 @@ module.exports = () => { * Redo last change */ redo() { + if (em.get('Canvas').isInputFocused()) return; um.redo(1); },