Skip to content

Commit

Permalink
TINY-10717: Fixed Esc and arrow keys and IME not starting (#9463)
Browse files Browse the repository at this point in the history
  • Loading branch information
spocke committed Mar 6, 2024
1 parent df7b989 commit 809fd24
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/tinymce/src/core/main/ts/keyboard/Autocompleter.ts
Expand Up @@ -32,13 +32,14 @@ const setupEditorInput = (editor: Editor, api: AutocompleterApi) => {
update.throttle();
// Pressing <esc> closes the autocompleter
} else if (keyCode === 27) {
update.cancel(); // We need to cancel here since Esc cancels the IME composition and triggers an input event
api.cancelIfNecessary();
} else if (keyCode === 38 || keyCode === 40) {
// Arrow up and down keys needs to cancel the update since while composing arrow up or down will end the compose and issue a input event
// that causes the list to update and then the focus moves up to the first item in the auto completer list.
update.cancel();
}
});
}, true); // Need to add this to the top so that it exectued before the silver keyboard event

editor.on('remove', update.cancel);
};
Expand All @@ -58,8 +59,7 @@ export const setup = (editor: Editor): void => {
};

const commenceIfNecessary = (context: AutocompleteContext) => {
/* Autocompleter works by moving the content into a newly generated element. When combined with composing this creates issues where unexpected data input and visual issues */
if (!isActive() && !editor.composing) {
if (!isActive()) {
// store the element/context
activeAutocompleter.set({
trigger: context.trigger,
Expand Down

0 comments on commit 809fd24

Please sign in to comment.