mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-12 03:45:34 +00:00
Merge pull request #4983 from keymanapp/cherrypick/web/4961-banner-init
fix(web): Make banner initialization more robust 🍒
This commit is contained in:
commit
c8f779b08c
1 changed files with 9 additions and 6 deletions
|
|
@ -143,6 +143,8 @@ namespace com.keyman.osk {
|
|||
this.alwaysShow = optionSpec[key];
|
||||
break;
|
||||
case 'mayPredict':
|
||||
// If this toggles our internal flag, it will generate events
|
||||
// that reconfigures the banner (and internal engine state) appropriately.
|
||||
keyman.core.languageProcessor.mayPredict = optionSpec[key]
|
||||
break;
|
||||
case 'mayCorrect':
|
||||
|
|
@ -156,9 +158,12 @@ namespace com.keyman.osk {
|
|||
// Invalid option specified!
|
||||
}
|
||||
this._options[key] = optionSpec[key];
|
||||
}
|
||||
|
||||
this.selectBanner();
|
||||
// If no banner instance exists yet, go with a safe, blank initialization.
|
||||
if(!this.activeBanner) {
|
||||
this.selectBanner('inactive');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -208,9 +213,7 @@ namespace com.keyman.osk {
|
|||
* allowing logic to automatically hot-swap `Banner`s as needed.
|
||||
* @param state
|
||||
*/
|
||||
private selectBanner(state?: text.prediction.StateChangeEnum) {
|
||||
let keyman = com.keyman.singleton;
|
||||
|
||||
private selectBanner(state: text.prediction.StateChangeEnum) {
|
||||
// Only display a SuggestionBanner when LanguageProcessor states it is active.s
|
||||
if(state == 'active') {
|
||||
this.setBanner('suggestion');
|
||||
|
|
@ -226,7 +229,7 @@ namespace com.keyman.osk {
|
|||
// Triggers the initially-displayed suggestions.s
|
||||
suggestionBanner.postConfigure();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue