Skip to content

Commit

Permalink
Check whether a keydown event is related to IME. (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamuratak authored Oct 18, 2024
1 parent b6975ef commit b232504
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions edit-context/html-editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ if (IS_CUSTOM_HIGHLIGHT_SUPPORTED) {

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

0 comments on commit b232504

Please sign in to comment.