fix: 斜杠命令菜单 Esc 取消后清除输入字符
This commit is contained in:
parent
cffaedb297
commit
8ce1072b0c
@ -184,7 +184,14 @@ export function Editor() {
|
||||
return true
|
||||
}
|
||||
if (event.key === 'Escape') {
|
||||
if (slashStartPos.current !== null && editor) {
|
||||
const { state, dispatch } = editor.view
|
||||
const { from } = state.selection
|
||||
const tr = state.tr.delete(slashStartPos.current, from)
|
||||
dispatch(tr)
|
||||
}
|
||||
setSlashOpen(false)
|
||||
slashStartPos.current = null
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user