Browse Source

Add `undo` and `redo` events

pull/663/head
Artur Arseniev 9 years ago
parent
commit
2ebfdc34e2
  1. 2
      src/editor/index.js
  2. 1
      src/undo_manager/index.js

2
src/editor/index.js

@ -51,6 +51,8 @@
* * `stop:{commandName}` - Triggered when some command is called to stop (eg. editor.stopCommand('preview')) * * `stop:{commandName}` - Triggered when some command is called to stop (eg. editor.stopCommand('preview'))
* ## General * ## General
* * `canvasScroll` - Triggered when the canvas is scrolle * * `canvasScroll` - Triggered when the canvas is scrolle
* * `undo` - Undo executed
* * `redo` - Redo executed
* * `load` - When the editor is loaded * * `load` - When the editor is loaded
* *
* @param {Object} config Configurations * @param {Object} config Configurations

1
src/undo_manager/index.js

@ -61,6 +61,7 @@ module.exports = () => {
const events = ['style', 'attributes', 'content', 'src']; const events = ['style', 'attributes', 'content', 'src'];
events.forEach(ev => um.addUndoType(`change:${ev}`, customUndoType)); events.forEach(ev => um.addUndoType(`change:${ev}`, customUndoType));
um.on('undo redo', () => em.trigger('change:selectedComponent change:canvasOffset')); um.on('undo redo', () => em.trigger('change:selectedComponent change:canvasOffset'));
['undo', 'redo'].forEach(ev => um.on(ev, () => em.trigger(ev)));
return this; return this;
}, },

Loading…
Cancel
Save