update: codeblock 仅撤销和重做按键阻止冒泡传递
This commit is contained in:
parent
5c23bef695
commit
5f8bd8ffb8
|
@ -133,7 +133,14 @@ class CodeBlockEditor implements CodeBlockEditorInterface {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
this.codeMirror.on('keydown', (editor, event) => {
|
this.codeMirror.on('keydown', (editor, event) => {
|
||||||
|
// 撤销和重做使用codemirror自带的操作
|
||||||
|
if (
|
||||||
|
isHotkey('mod+z', event) ||
|
||||||
|
isHotkey('mod+y', event) ||
|
||||||
|
isHotkey('mod+shift+z', event)
|
||||||
|
) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
}
|
||||||
const lineCount = editor.lineCount();
|
const lineCount = editor.lineCount();
|
||||||
const { line, ch } = editor.getCursor();
|
const { line, ch } = editor.getCursor();
|
||||||
const { onUpFocus, onDownFocus, onLeftFocus, onRightFocus } =
|
const { onUpFocus, onDownFocus, onLeftFocus, onRightFocus } =
|
||||||
|
|
|
@ -96,7 +96,14 @@ class CodeBlockEditor implements CodeBlockEditorInterface {
|
||||||
if (onFocus) onFocus();
|
if (onFocus) onFocus();
|
||||||
});
|
});
|
||||||
this.codeMirror.on('keydown', (editor, event) => {
|
this.codeMirror.on('keydown', (editor, event) => {
|
||||||
|
// 撤销和重做使用codemirror自带的操作
|
||||||
|
if (
|
||||||
|
isHotkey('mod+z', event) ||
|
||||||
|
isHotkey('mod+y', event) ||
|
||||||
|
isHotkey('mod+shift+z', event)
|
||||||
|
) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
}
|
||||||
const lineCount = editor.lineCount();
|
const lineCount = editor.lineCount();
|
||||||
const { line, ch } = editor.getCursor();
|
const { line, ch } = editor.getCursor();
|
||||||
const { onUpFocus, onDownFocus, onLeftFocus, onRightFocus } =
|
const { onUpFocus, onDownFocus, onLeftFocus, onRightFocus } =
|
||||||
|
|
Loading…
Reference in New Issue