Merge pull request #2194 from keymanapp/web-kns-update-cherry

[Web] Updates notifyKeyboard and uses of KNS (12.0 stable)
This commit is contained in:
Joshua Horton 2019-10-10 23:19:57 +07:00 committed by GitHub
commit 877801ac45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 21 deletions

View file

@ -3,6 +3,9 @@
## 13.0 alpha
* Start version 13.0
## 2019-10-10 12.0.101 stable
* Fixes issue with keyboards requiring special state notifications, such as the CJK picker keyboards (#2194)
## 2019-10-07 12.0.100 stable
* Release 12.0

View file

@ -220,7 +220,7 @@ namespace com.keyman {
var isActivating = this.keyman.uiManager.isActivating;
if(!isActivating) {
this.keyman.keyboardManager.notifyKeyboard(0, Ltarg, 0); // I2187
this.keyman['interface'].notifyKeyboard(0, Ltarg, 0); // I2187
}
//e = this.keyman._GetEventObject<FocusEvent>(e); // I2404 - Manage IE events in IFRAMEs //TODO: is this really needed again????
@ -328,7 +328,7 @@ namespace com.keyman {
if(target && text.Processor.getOutputTarget(target)) {
text.Processor.getOutputTarget(target).deadkeys().clear();
}
this.keyman.keyboardManager.notifyKeyboard(0, target, 1); // I2187
this.keyman['interface'].notifyKeyboard(0, target, 1); // I2187
}
if(!uiManager.justActivated && DOMEventHandlers.states._SelectionControl != target) {

View file

@ -1514,23 +1514,6 @@ namespace com.keyman {
return this.keymanweb.util.callEvent('kmw.keyboardchange', p);
}
/**
* Function _NotifyKeyboard
* Scope Private
* @param {number} _PCommand event code (16,17,18) or 0
* @param {Object} _PTarget target element
* @param {number} _PData 1 or 0
* Description Notifies keyboard of keystroke or other event
*/
notifyKeyboard = function(_PCommand: number, _PTarget: HTMLElement|Document, _PData: number) { // I2187
var activeKeyboard = this.activeKeyboard;
if(activeKeyboard != null && typeof(activeKeyboard['KNS']) == 'function') {
activeKeyboard['KNS'](_PCommand, _PTarget, _PData);
}
}
shutdown() {
for(let script of this.linkedScripts) {
if(script.remove) {

View file

@ -204,6 +204,32 @@ namespace com.keyman.text {
DOMEventHandlers.states._IgnoreNextSelChange = 1;
}
}
/**
* Function _NotifyKeyboard
* Scope Private
* @param {number} _PCommand event code (16,17,18) or 0
* @param {Object} _PTarget target element
* @param {number} _PData 1 or 0
* Description Notifies keyboard of keystroke or other event
*/
notifyKeyboard(_PCommand: number, _PTarget: OutputTarget|HTMLElement|Document, _PData: number) { // I2187
let keyman = com.keyman.singleton;
var activeKeyboard = keyman.keyboardManager.activeKeyboard;
var target: OutputTarget;
if(_PTarget instanceof text.OutputTarget) {
target = _PTarget;
} else {
target = text.Processor.getOutputTarget(_PTarget as HTMLElement);
}
// Good example use case - the Japanese CJK-picker keyboard
if(activeKeyboard != null && typeof(activeKeyboard['KNS']) == 'function') {
activeKeyboard['KNS'](_PCommand, target, _PData);
}
}
/**
* Function KT

View file

@ -955,7 +955,7 @@ namespace com.keyman.text {
case 144:
case 145:
// For eventual integration - we bypass an OSK update for physical keystrokes when in touch mode.
keyman.keyboardManager.notifyKeyboard(Levent.Lcode, Levent.Ltarg, 1);
keyman['interface'].notifyKeyboard(Levent.Lcode, Levent.Ltarg, isKeyDown ? 1 : 0);
if(!keyman.util.device.touchable) {
return this._UpdateVKShift(Levent, Levent.Lcode-15, 1); // I2187
} else {
@ -964,7 +964,7 @@ namespace com.keyman.text {
}
if(Levent.LmodifierChange) {
keyman.keyboardManager.notifyKeyboard(0, Levent.Ltarg, 1);
keyman['interface'].notifyKeyboard(0, Levent.Ltarg, 1);
this._UpdateVKShift(Levent, 0, 1);
}