Skip to content

Commit 2b45ff7

Browse files
committed
Stop the command once the modal is closed
1 parent 4cadfb6 commit 2b45ff7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/commands.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ export default (editor, opts = {}) => {
4242
const title = options.title || modalTitle;
4343
const content = this.getContent();
4444
const code = target.get(keyCustomCode) || '';
45-
editor.Modal.open({ title, content });
45+
editor.Modal
46+
.open({ title, content })
47+
.getModel()
48+
.once('change:open', () => editor.stopCommand(this.id));
4649
this.getCodeViewer().setContent(code);
4750
},
4851

@@ -61,7 +64,7 @@ export default (editor, opts = {}) => {
6164
* @return {HTMLElement}
6265
*/
6366
getContent() {
64-
const { editor, options, target } = this;
67+
const { editor } = this;
6568
const content = document.createElement('div');
6669
const codeViewer = this.getCodeViewer();
6770
const pfx = editor.getConfig('stylePrefix');

0 commit comments

Comments
 (0)