mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-23 16:17:40 +00:00
fix(web): removes stylesheets from unloaded keyboards
This commit is contained in:
parent
a0b2fdb625
commit
a67e26fb1c
2 changed files with 15 additions and 1 deletions
|
|
@ -197,8 +197,10 @@ namespace com.keyman.osk {
|
|||
s.fontSize = fontScale + 'em';
|
||||
}
|
||||
|
||||
if(this.vkbd) {
|
||||
this.vkbd.shutdown();
|
||||
}
|
||||
this.vkbd = null;
|
||||
// TODO: Consider a 'vkbd.release()' method?
|
||||
|
||||
// Instantly resets the OSK container, erasing / delinking the previously-loaded keyboard.
|
||||
this._Box.innerHTML = '';
|
||||
|
|
@ -311,6 +313,9 @@ namespace com.keyman.osk {
|
|||
* Description Generates the visual keyboard element and attaches it to KMW
|
||||
*/
|
||||
private _GenerateVisualKeyboard(keyboard: keyboards.Keyboard) {
|
||||
if(this.vkbd) {
|
||||
this.vkbd.shutdown();
|
||||
}
|
||||
this.vkbd = new com.keyman.osk.VisualKeyboard(keyboard);
|
||||
let util = com.keyman.singleton.util;
|
||||
|
||||
|
|
|
|||
|
|
@ -2763,5 +2763,14 @@ namespace com.keyman.osk {
|
|||
}, 5000);
|
||||
return false;
|
||||
};
|
||||
|
||||
shutdown() {
|
||||
let keyman = com.keyman.singleton;
|
||||
|
||||
// Prevents style-sheet pollution from multiple keyboard swaps.
|
||||
if(this.styleSheet) {
|
||||
keyman.util.removeStyleSheet(this.styleSheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue