mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-27 02:37:42 +00:00
fix(web): uses new IDs as needed outside of web-core
This commit is contained in:
parent
7c53c9740e
commit
7cbb78ea45
3 changed files with 23 additions and 7 deletions
|
|
@ -402,14 +402,14 @@ namespace com.keyman.text {
|
|||
var baseKey: com.keyman.osk.OSKKeySpec = osk.vkbd.popupBaseKey['key'].spec;
|
||||
var found = false;
|
||||
|
||||
if(baseKey.id == keyName) {
|
||||
if(baseKey.coreID == keyName) {
|
||||
nextLayer = baseKey.nextlayer;
|
||||
found = true;
|
||||
} else {
|
||||
// Search for the specified subkey so we can retrieve its useful properties.
|
||||
// It should be within the popupBaseKey's subkey list.
|
||||
for(let subKey of baseKey.sk) {
|
||||
if(subKey.id == keyName) {
|
||||
if(subKey.coreID == keyName) {
|
||||
// ... to consider: why are we not just taking the keyspec wholesale right here?
|
||||
nextLayer = subKey.nextlayer;
|
||||
found = true;
|
||||
|
|
@ -419,7 +419,7 @@ namespace com.keyman.text {
|
|||
}
|
||||
|
||||
if(!found) {
|
||||
console.warn("Could not find subkey '" + origArg + "' under the current base key '" + baseKey.id + "'!");
|
||||
console.warn("Could not find subkey '" + origArg + "' under the current base key '" + baseKey.coreID + "'!");
|
||||
}
|
||||
} else {
|
||||
console.warn("No base key exists for the subkey being executed: '" + origArg + "'");
|
||||
|
|
|
|||
|
|
@ -48,7 +48,13 @@ namespace com.keyman.osk {
|
|||
// Deleting matched deadkeys here seems to correct some of the issues. (JD 6/6/14)
|
||||
outputTarget.deadkeys().deleteMatched(); // Delete any matched deadkeys before continuing
|
||||
|
||||
let keySpec = (e['key'] ? e['key'].spec : null) as keyboards.ActiveKey;
|
||||
// Future note: we need to refactor osk.OSKKeySpec to instead be a 'tag field' for
|
||||
// keyboards.ActiveKey. (Prob with generics, allowing the Web-only parts to
|
||||
// be fully specified within the tag.)
|
||||
//
|
||||
// Would avoid the type shenanigans needed here because of our current type-abuse setup
|
||||
// for key spec tracking.
|
||||
let keySpec = (e['key'] ? e['key'].spec : null) as unknown as keyboards.ActiveKey;
|
||||
if(!keySpec) {
|
||||
console.error("OSK key with ID '" + e.id + "', keyID '" + e.keyId + "' missing needed specification");
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ namespace com.keyman.osk {
|
|||
//#region OSK key objects and construction
|
||||
export class OSKKeySpec implements keyboards.LayoutKey {
|
||||
id: string;
|
||||
|
||||
// Only set (within @keymanapp/keyboard-processor) for keys actually specified in a loaded layout
|
||||
baseKeyIdentifier?: string;
|
||||
coreID?: string;
|
||||
elementID?: string;
|
||||
|
||||
text?: string;
|
||||
sp?: number | keyboards.ButtonClass;
|
||||
width: string;
|
||||
|
|
@ -317,13 +323,13 @@ namespace com.keyman.osk {
|
|||
|
||||
getId(osk: VisualKeyboard): string {
|
||||
// Define each key element id by layer id and key id (duplicate possible for SHIFT - does it matter?)
|
||||
return this.layer+'-'+this.spec.id;
|
||||
return this.spec.elementID;
|
||||
}
|
||||
|
||||
// Produces a small reference label for the corresponding physical key on a US keyboard.
|
||||
private generateKeyCapLabel(): HTMLDivElement {
|
||||
// Create the default key cap labels (letter keys, etc.)
|
||||
var x = Codes.keyCodes[this.spec.id];
|
||||
var x = Codes.keyCodes[this.spec.baseKeyIdentifier];
|
||||
switch(x) {
|
||||
// Converts the keyman key id code for common symbol keys into its representative ASCII code.
|
||||
// K_COLON -> K_BKQUOTE
|
||||
|
|
@ -1766,7 +1772,11 @@ namespace com.keyman.osk {
|
|||
// bk = skElement;
|
||||
// break;
|
||||
//} else
|
||||
if(skSpec.id == baseKey.keyId && skSpec.layer == baseKey.key.layer) {
|
||||
if(!baseKey.key || !baseKey.key.spec) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(skSpec.elementID == baseKey.key.spec.elementID) {
|
||||
bk = skElement;
|
||||
break; // Best possible match has been found. (Disable 'break' once above block is implemented.)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue