From f218aa92db6845f3187067099bc88cebbf484c91 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Wed, 3 Jun 2026 19:41:47 +0200 Subject: [PATCH] refactor(web): reformatting of files Test-bot: skip --- .../guide/examples/automatic-control.md | 6 +++-- .../guide/examples/control-by-control.md | 10 ++++++-- .../guide/examples/full-manual-control.md | 7 +++--- .../engine/guide/examples/manual-control.md | 5 ++-- .../app/browser/src/context/focusAssistant.ts | 2 +- .../keyboard/keyboards/keyboardProperties.ts | 2 +- .../web/build-visual-keyboard/index.html | 23 ++++++++----------- .../test/manual/web/chirality/utilities.js | 2 +- 8 files changed, 32 insertions(+), 25 deletions(-) diff --git a/web/docs/engine/guide/examples/automatic-control.md b/web/docs/engine/guide/examples/automatic-control.md index c804556e18..ef8a57f00f 100644 --- a/web/docs/engine/guide/examples/automatic-control.md +++ b/web/docs/engine/guide/examples/automatic-control.md @@ -2,9 +2,11 @@ title: Automatic Mode Example --- -This page shows how to include a local keyboard from an arbitrary location in your website's file structure. +This page shows how to include a local keyboard from an arbitrary location +in your website's file structure. -In this example, we use only the LaoKey keyboard. Please click [this link](./__auto-control.html) to open the test page. +In this example, we use only the LaoKey keyboard. Please click +[this link](./__auto-control.html) to open the test page. ## Code Walkthrough diff --git a/web/docs/engine/guide/examples/control-by-control.md b/web/docs/engine/guide/examples/control-by-control.md index 974338ef1f..d8492b99bb 100644 --- a/web/docs/engine/guide/examples/control-by-control.md +++ b/web/docs/engine/guide/examples/control-by-control.md @@ -2,7 +2,10 @@ title: Control-by-Control Example --- -In this example, a simulated webmail form, the default and permissible keyboard for each control is managed by the web page. We use the automatic mode for simplicity of demonstration. We also link to the CDN for KeymanWeb in this example. Please click [this link](__control-by-control.html) to open the test page. +In this example, a simulated webmail form, the default and permissible keyboard for each control +is managed by the web page. We use the automatic mode for simplicity of demonstration. We also +link to the CDN for KeymanWeb in this example. Please click [this link](__control-by-control.html) +to open the test page. ## Code Walkthrough @@ -51,7 +54,10 @@ Also include the following HTML code: ``` --- -**Note:** In this example we disabled the first element (`document.f.address`) by API call. A later API call can re-enable KeymanWeb for this control should it fit the page's design. Alternatively, this can be done by instead adding the class `'kmw-disabled'` to the control. This will permanently block KeymanWeb from handling its input. +**Note:** In this example we disabled the first element (`document.f.address`) by API call. A +later API call can re-enable KeymanWeb for this control should it fit the page's design. +Alternatively, this can be done by instead adding the class `'kmw-disabled'` to the control. This +will permanently block KeymanWeb from handling its input. --- diff --git a/web/docs/engine/guide/examples/full-manual-control.md b/web/docs/engine/guide/examples/full-manual-control.md index e9e8d2908a..5aa9189316 100644 --- a/web/docs/engine/guide/examples/full-manual-control.md +++ b/web/docs/engine/guide/examples/full-manual-control.md @@ -2,7 +2,9 @@ title: Manual Control - Custom Interface --- -In this example, the web page designer has opted for their own user interface instead of the KeymanWeb interface. The keyboards in the selector are populated from the KeymanWeb list of keyboards. Please click [this link](__full-manual-control.html) to open the test page. +In this example, the web page designer has opted for their own user interface instead of the +KeymanWeb interface. The keyboards in the selector are populated from the KeymanWeb list of +keyboards. Please click [this link](__full-manual-control.html) to open the test page. ## Code Walkthrough @@ -35,8 +37,7 @@ Include the following script in the HEAD of your page: } /* KWControlChange: Called when user selects an item in the KWControl SELECT */ - function KWControlChange() - { + function KWControlChange() { /* Select the keyboard in KeymanWeb */ var name = KWControl.value.substr(0, KWControl.value.indexOf("$$")); var languageCode = KWControl.value.substr(KWControl.value.indexOf("$$"+2)); diff --git a/web/docs/engine/guide/examples/manual-control.md b/web/docs/engine/guide/examples/manual-control.md index 1087c518c8..d1bd854d9b 100644 --- a/web/docs/engine/guide/examples/manual-control.md +++ b/web/docs/engine/guide/examples/manual-control.md @@ -23,8 +23,7 @@ Include the following script in the HEAD of your page: } /* KWControlClick: Called when user clicks on the KWControl IMG */ - function KWControlClick() - { + function KWControlClick() { if(keyman.osk.isEnabled()) { keyman.osk.hide(); } else { @@ -61,9 +60,11 @@ And finally, include the control img for KeymanWeb: ## API References On programmatically setting the keyboard: + - [`keyman.setActiveKeyboard()`](../../reference/core/setActiveKeyboard). On managing the visibility of the OSK: + - [`keyman.osk.hide()`](../../reference/osk/hide) - [`keyman.osk.show()`](../../reference/osk/show). diff --git a/web/src/app/browser/src/context/focusAssistant.ts b/web/src/app/browser/src/context/focusAssistant.ts index accb9b811e..ade72ea65a 100644 --- a/web/src/app/browser/src/context/focusAssistant.ts +++ b/web/src/app/browser/src/context/focusAssistant.ts @@ -149,7 +149,7 @@ export class FocusAssistant extends EventEmitter { * @param {(boolean|number)} state Activate (true,false) */ setMaintainingFocus(state: boolean) { - this.maintainingFocus = state ? true : false; + this.maintainingFocus = !!state; } setFocusTimer(): void { diff --git a/web/src/engine/src/keyboard/keyboards/keyboardProperties.ts b/web/src/engine/src/keyboard/keyboards/keyboardProperties.ts index 1a3a9e215a..b9b32b444a 100644 --- a/web/src/engine/src/keyboard/keyboards/keyboardProperties.ts +++ b/web/src/engine/src/keyboard/keyboards/keyboardProperties.ts @@ -255,7 +255,7 @@ export class KeyboardProperties implements KeyboardInternalPropertySpec { return null; } - public validateForCustomKeyboard(): Error { + public validateForCustomKeyboard(): Error|null { if(!this.KI || !this.KN || !this.KL || !this.KLC) { return new Error("To use a custom keyboard, you must specify keyboard id, keyboard name, language and language code."); } else { diff --git a/web/src/test/manual/web/build-visual-keyboard/index.html b/web/src/test/manual/web/build-visual-keyboard/index.html index 2845f3db86..e6231dd691 100644 --- a/web/src/test/manual/web/build-visual-keyboard/index.html +++ b/web/src/test/manual/web/build-visual-keyboard/index.html @@ -51,7 +51,7 @@ platform == 'phone' ? 240 : 360; }; - let shadowfy = function(container) { + function shadowfy(container) { const shadow = container.attachShadow({ mode: "open" }); const docBase = container.children[0]; @@ -67,7 +67,7 @@ shadow.appendChild(docBase); } - let documentKeyboard = async function(kbdid, langid, formFactor, layer) { + async function documentKeyboard(kbdid, langid, formFactor, layer) { let docTarget = document.getElementById("docTarget"); label = document.createElement('h3'); docTarget.appendChild(label); @@ -77,8 +77,8 @@ const container = document.createElement('div'); - await kmw.addKeyboards(`${kbdid}@${langid}`); - await kmw.setActiveKeyboard(kbdid, langid); + await keyman.addKeyboards(`${kbdid}@${langid}`); + await keyman.setActiveKeyboard(kbdid, langid); docBase = keyman.BuildVisualKeyboard(kbdid, 1, formFactor, layer); label.textContent = `${keyman.getKeyboard(kbdid).Name} - ${formFactor} - ${layer} layer`; @@ -121,15 +121,12 @@ (It is ignored by other User Interfaces.) -->
-

This test page exists for testing KMW's keyboard-documentation rendering system.

- -
-
- -

Return to testing home page

- - - +

This test page exists for testing KMW's keyboard-documentation rendering system.

+ +
+
+ +

Return to testing home page