Browse Source

Check focused inputs in undo/redo

pull/663/head
Artur Arseniev 9 years ago
parent
commit
cb19de3cbd
  1. 23
      src/editor/model/Editor.js
  2. 2
      src/undo_manager/index.js

23
src/editor/model/Editor.js

@ -232,11 +232,6 @@ module.exports = Backbone.Model.extend({
* @private * @private
* * * *
initUndoManager() { initUndoManager() {
const canvas = this.get('Canvas');
if (this.um) {
return;
}
var cmp = this.get('DomComponents'); var cmp = this.get('DomComponents');
if(cmp && this.config.undoManager) { if(cmp && this.config.undoManager) {
@ -245,25 +240,7 @@ module.exports = Backbone.Model.extend({
register: [cmp.getComponents(), this.get('CssComposer').getAll()], register: [cmp.getComponents(), this.get('CssComposer').getAll()],
track: true 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');
});
} }
}, },
*/ */

2
src/undo_manager/index.js

@ -201,6 +201,7 @@ module.exports = () => {
* Undo last change * Undo last change
*/ */
undo() { undo() {
if (em.get('Canvas').isInputFocused()) return;
um.undo(1); um.undo(1);
}, },
@ -217,6 +218,7 @@ module.exports = () => {
* Redo last change * Redo last change
*/ */
redo() { redo() {
if (em.get('Canvas').isInputFocused()) return;
um.redo(1); um.redo(1);
}, },

Loading…
Cancel
Save