Skip to content

Commit

Permalink
Merge pull request slab#3115 from luin/handle-native-undo
Browse files Browse the repository at this point in the history
Handle native undo/redo
  • Loading branch information
jhchen committed Jul 25, 2020
2 parents 84d2234 + 474f081 commit bb013a7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ class History extends Module {
this.redo.bind(this),
);
}

this.quill.root.addEventListener('beforeinput', event => {
if (event.inputType === 'historyUndo') {
this.undo();
event.preventDefault();
} else if (event.inputType === 'historyRedo') {
this.redo();
event.preventDefault();
}
});
}

change(source, dest) {
Expand Down

0 comments on commit bb013a7

Please sign in to comment.