Skip to content

Commit b232504

Browse files
authored
Check whether a keydown event is related to IME. (#282)
1 parent b6975ef commit b232504

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

edit-context/html-editor/editor.js

+5
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ if (IS_CUSTOM_HIGHLIGHT_SUPPORTED) {
178178

179179
// Handle key presses that are not already handled by the EditContext.
180180
editorEl.addEventListener("keydown", (e) => {
181+
// keyCode === 229 is a special code that indicates an IME event.
182+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/keydown_event#keydown_events_with_ime
183+
if (e.keyCode === 229) {
184+
return;
185+
}
181186
const start = Math.min(
182187
editContext.selectionStart,
183188
editContext.selectionEnd

0 commit comments

Comments
 (0)