fix: editor IME composing event behavior

This commit is contained in:
SkyWT 2024-04-22 21:25:31 +08:00 committed by GitHub
parent 761b4e115b
commit 4bbb63d09a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,10 @@ const useAutoComplete = (actions: EditorRefActions) => {
editor.addEventListener("keydown", (event) => {
if (event.key === "Enter") {
if (event.nativeEvent.isComposing) {
return;
}
const cursorPosition = actions.getCursorPosition();
const prevContent = actions.getContent().substring(0, cursorPosition);
const lastNode = last(window.parse(prevContent));