From 7ab46a4eab96c9e4b42589ae9ac42606f2716220 Mon Sep 17 00:00:00 2001 From: Joshua Horton Date: Fri, 23 Jul 2021 10:38:01 +0700 Subject: [PATCH 1/2] chore(web): Apply suggestions from code review Co-authored-by: Marc Durdin --- web/source/osk/oskManager.ts | 4 ++-- web/source/osk/visualKeyboard.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/source/osk/oskManager.ts b/web/source/osk/oskManager.ts index 49d64e2ce6..5c0074f0b3 100644 --- a/web/source/osk/oskManager.ts +++ b/web/source/osk/oskManager.ts @@ -221,7 +221,7 @@ namespace com.keyman.osk { } else { this.vkbd.adjustHeights(this.getKeyboardHeight()); - var b: HTMLElement = this._Box, bs=b.style; + let b: HTMLElement = this._Box, bs=b.style; bs.height=bs.maxHeight=this.vkbd.computedAdjustedOskHeight(this.getHeight())+'px'; } @@ -235,7 +235,7 @@ namespace com.keyman.osk { kbdID = kbdID.substring(kbdID.indexOf('::') + 2); } - var kbdClassSuffix = ' kmw-keyboard-' + kbdID; + const kbdClassSuffix = ' kmw-keyboard-' + kbdID; kbdView.element.className = kbdView.element.className + kbdClassSuffix; this.banner.appendStyles(); diff --git a/web/source/osk/visualKeyboard.ts b/web/source/osk/visualKeyboard.ts index 62a1b84f64..8ecdf78b02 100644 --- a/web/source/osk/visualKeyboard.ts +++ b/web/source/osk/visualKeyboard.ts @@ -1540,7 +1540,7 @@ namespace com.keyman.osk { * @param {Object} PKbd the keyboard object to be displayed * @param {string=} argFormFactor layout form factor, defaulting to 'desktop' * @param {(string|number)=} argLayerId name or index of layer to show, defaulting to 'default' - * @param {Object} height Target height for the rendered keyboard + * @param {number} height Target height for the rendered keyboard * (currently required for legacy reasons) * @return {Object} DIV object with filled keyboard layer content */ From 27096c8823d9aaf2c9c314cba1244d2c6b93b070 Mon Sep 17 00:00:00 2001 From: jahorton Date: Fri, 23 Jul 2021 10:53:34 +0700 Subject: [PATCH 2/2] chore(web): addresses PR comments --- .../core/web/keyboard-processor/src/keyboards/keyboard.ts | 6 ++++++ web/source/kmwembedded.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/core/web/keyboard-processor/src/keyboards/keyboard.ts b/common/core/web/keyboard-processor/src/keyboards/keyboard.ts index 9d3a41390d..bedfadfb00 100644 --- a/common/core/web/keyboard-processor/src/keyboards/keyboard.ts +++ b/common/core/web/keyboard-processor/src/keyboards/keyboard.ts @@ -107,6 +107,12 @@ namespace com.keyman.keyboards { return this.scriptObject['KH']; } + /** + * Embedded JS script designed for use with a keyboard's HTML help text. Always defined + * within the file referenced by &kmw_embedjs in a keyboard's source, though that file + * may also contain _other_ script definitions as well. (`KHF` must be explicitly defined + * within that file.) + */ get hasScript(): boolean { return !!this.scriptObject['KHF']; } diff --git a/web/source/kmwembedded.ts b/web/source/kmwembedded.ts index f9eaff5c9e..c4e41d191c 100644 --- a/web/source/kmwembedded.ts +++ b/web/source/kmwembedded.ts @@ -256,7 +256,7 @@ namespace com.keyman.text { */ keymanweb['correctOSKTextSize']=function() { let osk = keymanweb.osk; - if(osk && osk.vkbd && osk.vkbd.adjustHeights(osk.getKeyboardHeight())) { + if(osk?.vkbd?.adjustHeights(osk.getKeyboardHeight())) { var b: HTMLElement = osk._Box, bs=b.style; bs.height=bs.maxHeight=osk.vkbd.computedAdjustedOskHeight(osk.getHeight())+'px';