Skip to content

Commit

Permalink
[hotfix] Stop dispatching to keybindings in editing coposition text.
Browse files Browse the repository at this point in the history
Signed-off-by: Masaki Muranaka <monaka@monami-ya.com>
  • Loading branch information
monaka authored and akosyakov committed Dec 6, 2019
1 parent b6daa53 commit 27745bf
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion packages/core/src/browser/frontend-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,42 @@ export class FrontendApplication {
return startupElements.length === 0 ? undefined : startupElements[0] as HTMLElement;
}

/* vvv HOTFIX begin vvv
*
* This is a hotfix against issues eclipse/theia#6459 and gitpod-io/gitpod#875 .
* It should be reverted after Theia was updated to the newer Monaco.
*/
protected inComposition = false;
/**
* Register composition related event listeners.
*/
protected registerComositionEventListeners(): void {
window.document.addEventListener('compositionstart', event => {
this.inComposition = true;
});
window.document.addEventListener('compositionend', event => {
this.inComposition = false;
});
}
/* ^^^ HOTFIX end ^^^ */

/**
* Register global event listeners.
*/
protected registerEventListeners(): void {
this.registerComositionEventListeners(); /* Hotfix. See above. */

window.addEventListener('beforeunload', () => {
this.stateService.state = 'closing_window';
this.layoutRestorer.storeLayout(this);
this.stopContributions();
});
window.addEventListener('resize', () => this.shell.update());
document.addEventListener('keydown', event => this.keybindings.run(event), true);
document.addEventListener('keydown', event => {
if (this.inComposition !== true) {
this.keybindings.run(event);
}
}, true);
document.addEventListener('touchmove', event => { event.preventDefault(); }, { passive: false });
// Prevent forward/back navigation by scrolling in OS X
if (isOSX) {
Expand Down

0 comments on commit 27745bf

Please sign in to comment.