Merge pull request #16286 from keymanapp/refactor/web/contextManager

refactor(web): adjust function visibility and variable names
This commit is contained in:
Eberhard Beilharz 2026-07-30 15:51:50 +02:00 committed by GitHub
commit 21f744f44a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 16 deletions

View file

@ -403,9 +403,10 @@ export class ContextManager extends ContextManagerBase<BrowserConfiguration> {
}
/**
* Allows setting a control to a specific keyboard that does not change if the active keyboard changes when other
* controls are active. Only activates the keyboard if the specified control represents the currently-active
* context.
* Allows setting a control to a specific keyboard that does not change if
* the active keyboard changes when other controls are active. Only
* activates the keyboard if the specified control represents the
* currently-active context.
*
* This is the core method that backs
* https://help.keyman.com/developer/engine/web/current-version/reference/core/setKeyboardForControl.
@ -561,13 +562,13 @@ export class ContextManager extends ContextManagerBase<BrowserConfiguration> {
* Description Stores the last active element's keyboard settings. Should be called
* whenever a KMW-enabled page element loses control.
*/
public _BlurKeyboardSettings(lastElem: HTMLElement, PInternalName?: string, PLgCode?: string): void {
private _BlurKeyboardSettings(lastElem: HTMLElement, internalName?: string, lgCode?: string): void {
let keyboardID = this.activeKeyboard ? this.activeKeyboard.keyboard.id : '';
let langCode = this.activeKeyboard?.metadata.langId;
if(PInternalName !== undefined && PLgCode !== undefined) {
keyboardID = PInternalName;
langCode = PLgCode;
if(internalName !== undefined && lgCode !== undefined) {
keyboardID = internalName;
langCode = lgCode;
}
if(lastElem && lastElem._kmwAttachment.keyboard != null) {
@ -585,7 +586,7 @@ export class ContextManager extends ContextManagerBase<BrowserConfiguration> {
* whenever a KMW-enabled page element gains control, but only once the prior
* element's loss of control is guaranteed.
*/
public _FocusKeyboardSettings(lastElem: HTMLElement, blockGlobalChange: boolean): void {
private _FocusKeyboardSettings(lastElem: HTMLElement, blockGlobalChange: boolean): void {
// Important pre-condition: the newly-focused element must be set as active.
const attachment = lastElem._kmwAttachment;
const global = this.globalKeyboard;
@ -606,7 +607,7 @@ export class ContextManager extends ContextManagerBase<BrowserConfiguration> {
* The return value indicates whether (true) or not (false) the calling event handler
* should be terminated immediately after the call.
*/
public _CommonFocusHelper(textStore: AbstractElementTextStore<any>): boolean {
private _CommonFocusHelper(textStore: AbstractElementTextStore<any>): boolean {
const {focusAssistant} = this;
const activeKeyboard = this.activeKeyboard?.keyboard;
@ -631,7 +632,7 @@ export class ContextManager extends ContextManagerBase<BrowserConfiguration> {
/**
* Respond to KeymanWeb-aware input element receiving focus
*/
public _ControlFocus = (e: FocusEvent): boolean => {
private _ControlFocus = (e: FocusEvent): boolean => {
// Step 1: determine the corresponding TextStore instance.
const textStore = textStoreForEvent(e);
if(!textStore) {
@ -656,7 +657,7 @@ export class ContextManager extends ContextManagerBase<BrowserConfiguration> {
/**
* Respond to KMW losing focus on event
*/
public _ControlBlur = (e: FocusEvent): boolean => {
private _ControlBlur = (e: FocusEvent): boolean => {
// Step 0: if we're in a state where loss-of-focus should be outright-ignored, bypass the handler entirely.
if(this.focusAssistant._IgnoreNextSelChange) {
@ -728,7 +729,7 @@ export class ContextManager extends ContextManagerBase<BrowserConfiguration> {
return true;
}
doChangeEvent(textStore: AbstractElementTextStore<any>) {
private doChangeEvent(textStore: AbstractElementTextStore<any>) {
if(textStore.changed) {
const event = new Event('change', {"bubbles": true, "cancelable": false});
textStore.getElement().dispatchEvent(event);
@ -737,7 +738,7 @@ export class ContextManager extends ContextManagerBase<BrowserConfiguration> {
textStore.changed = false;
}
public _Click: (e: MouseEvent) => boolean = (e: MouseEvent) => {
private _Click: (e: MouseEvent) => boolean = (e: MouseEvent) => {
this.resetContext();
return true;
};

View file

@ -4,12 +4,12 @@ export class AttachmentInfo {
/**
* Tracks the language code corresponding to the `keyboard` field.
*/
languageCode: string;
public languageCode: string;
/**
* Tracks the inputmode originally set by the webpage.
*/
inputMode?: string;
public inputMode?: string;
/**
* Constructor for AttachmentInfo.