chore(web): mild cleanup

This commit is contained in:
jahorton 2021-08-31 08:25:16 +07:00
parent fe797fe657
commit ffef7c2bd4
3 changed files with 17 additions and 41 deletions

View file

@ -1268,28 +1268,6 @@ namespace com.keyman.dom {
// Do not unset the field if the UI is activated.
osk.activeTarget = target;
}
// if(!Pelem) {
// if(osk && !isActivating) {
// osk._Hide(false);
// }
// } else {
// // Force display of OSK for touch input device, or if a CJK keyboard, to ensure visibility of pick list
// if(device.touchable) {
// osk.displayIfActive = true;
// osk._Show();
// } else {
// // Conditionally show the OSK when control receives the focus
// if(this.keyman.isCJK()) {
// osk.displayIfActive = true;
// }
// if(osk.displayIfActive) {
// osk._Show();
// } else {
// osk._Hide(false);
// }
// }
// }
}
}

View file

@ -32,6 +32,11 @@ namespace com.keyman.osk {
super(modeledDevice);
document.body.appendChild(this._Box);
let keymanweb = com.keyman.singleton;
if(keymanweb.isEmbedded) {
this.activationMode == ActivationMode.manual;
}
}
/**
@ -241,8 +246,7 @@ namespace com.keyman.osk {
// Once picklist functionality is separated out, this will no longer be needed.
// Logic is: execute always if hidden on lost focus, but if requested by user, only if not CJK
if(keymanweb.isEmbedded) {
// We never hide the keyboard in embedded mode
if(this.activationMode != 'conditional' && this.displayIfActive) {
return;
}

View file

@ -18,8 +18,8 @@ namespace com.keyman.osk {
};
export enum ActivationMode {
disabled = "disabled",
permanent = "permanent",
static = "static", // For use by documentation keyboards, eventually.
manual = "manual",
conditional = "conditional"
}
@ -77,6 +77,7 @@ namespace com.keyman.osk {
//
private _activationMode: ActivationMode = ActivationMode.conditional;
private _displayIfActive: boolean = true;
private _manualShouldDisplay: boolean = true;
private _currentlyBuffering: boolean = false;
constructor(deviceSpec: com.keyman.utils.DeviceSpec, hostDevice?: com.keyman.utils.DeviceSpec) {
@ -201,10 +202,10 @@ namespace com.keyman.osk {
get activationConditionsMet(): boolean {
switch(this.activationMode) {
case 'permanent':
case 'manual':
return true;
case 'static':
return true;
case 'disabled':
return false;
case 'conditional':
return !!this.activeTarget;
default:
@ -225,6 +226,10 @@ namespace com.keyman.osk {
} else if(this.hostDevice.touchable && !flag) {
console.warn("Cannot hide display of OSK when hosted on touch-based devices.");
flag = true;
} else if(this.activationMode == 'static') {
// Silently fail; it's a documentation keyboard.
// This is the primary difference between 'manual' and 'static'.
flag = true;
}
this._displayIfActive = flag;
@ -796,22 +801,11 @@ namespace com.keyman.osk {
*/
['show'](bShow: boolean) {
if(arguments.length > 0) {
this.displayIfActive=bShow;
// if(bShow) {
// this._Show();
// } else {
// this._Hide(true);
// }
this.displayIfActive = bShow;
} else {
if(this.activationConditionsMet) {
this.displayIfActive = !this.displayIfActive;
}
// // if(this._Visible) {
// this._Hide(true);
// // } else {
// this._Show();
// // }
}
}