refactor(web): reformatting of files

Test-bot: skip
This commit is contained in:
Eberhard Beilharz 2026-06-03 19:41:47 +02:00
parent 1c73f4b958
commit f218aa92db
No known key found for this signature in database
GPG key ID: E9140597606020D3
8 changed files with 32 additions and 25 deletions

View file

@ -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

View file

@ -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:
<body onload="SetupDocument()">
```
---
**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.
---

View file

@ -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));

View file

@ -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).

View file

@ -149,7 +149,7 @@ export class FocusAssistant extends EventEmitter<EventMap> {
* @param {(boolean|number)} state Activate (true,false)
*/
setMaintainingFocus(state: boolean) {
this.maintainingFocus = state ? true : false;
this.maintainingFocus = !!state;
}
setFocusTimer(): void {

View file

@ -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 {

View file

@ -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.)
-->
<div id='KeymanWebControl'></div>
<h3>This test page exists for testing KMW's keyboard-documentation rendering system.</h3>
<!--<iframe src="hello-world.html" height=100></iframe>-->
<hr>
<div id="docTarget"></div>
</div>
<h3><a href="../">Return to testing home page</a></h3>
<h3>This test page exists for testing KMW's keyboard-documentation rendering system.</h3>
<!--<iframe src="hello-world.html" height=100></iframe>-->
<hr>
<div id="docTarget"></div>
</div>
<h3><a href="../">Return to testing home page</a></h3>
</body>
<!--

View file

@ -9,7 +9,7 @@ function loadKeyboards()
},
filename:'../../../../../build/test-resources/keyboards/chirality.js'
});
// A testing keyboard using 10.0 format and the KLS layout specifier
// without the 'shift' layer properly defined.
// Add a fully-specified, locally-sourced, keyboard with custom font