Skip to content

Commit

Permalink
Fix Theia loading inside iframe
Browse files Browse the repository at this point in the history
Fix loading Theia in the iframe launched with protected connection for Google Chrome

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
  • Loading branch information
AndrienkoAleksandr authored and marcdumais-work committed May 7, 2019
1 parent 1da7669 commit 15eb077
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,21 @@ export class BrowserKeyboardLayoutProvider implements KeyboardLayoutProvider, Ke
}
}

getNativeLayout(): Promise<NativeKeyboardLayout> {
async getNativeLayout(): Promise<NativeKeyboardLayout> {
const keyboard = (navigator as NavigatorExtension).keyboard;
if (keyboard && keyboard.getLayoutMap) {
return keyboard.getLayoutMap().then(layoutMap => this.getFromLayoutMap(layoutMap));
} else if (navigator.language) {
try {
const layoutMap = await keyboard.getLayoutMap();
return this.getFromLayoutMap(layoutMap);
} catch (error) {
return this.getLayoutByLanguageOrPlatform();
}
}
return this.getLayoutByLanguageOrPlatform();
}

private getLayoutByLanguageOrPlatform(): Promise<NativeKeyboardLayout> {
if (navigator.language) {
return Promise.resolve(this.getFromLanguage(navigator.language));
} else {
return Promise.resolve(isOSX ? this.macUS : this.winUS);
Expand Down

0 comments on commit 15eb077

Please sign in to comment.