mirror of
https://github.com/keymanapp/keyman.git
synced 2026-11-04 18:17:51 +00:00
Merge pull request #15331 from keymanapp/refactor/web/notify
This commit is contained in:
commit
074fa01d69
4 changed files with 23 additions and 9 deletions
|
|
@ -4,7 +4,7 @@ export { JSKeyboard, LayoutState } from "./keyboards/jsKeyboard.js";
|
|||
export { KeyboardMinimalInterface } from './keyboards/keyboardMinimalInterface.js';
|
||||
export { KMXKeyboard } from './keyboards/kmxKeyboard.js';
|
||||
export { KeyboardHarness, KeyboardKeymanGlobal, MinimalCodesInterface, MinimalKeymanGlobal } from "./keyboards/keyboardHarness.js";
|
||||
export { Keyboard, KeyboardLoaderBase } from "./keyboards/keyboardLoaderBase.js";
|
||||
export { NotifyEventCode, Keyboard, KeyboardLoaderBase } from "./keyboards/keyboardLoaderBase.js";
|
||||
export { KeyboardLoadErrorBuilder, KeyboardMissingError, KeyboardScriptError, KeyboardDownloadError, InvalidKeyboardError } from './keyboards/keyboardLoadError.js'
|
||||
export { BeepHandler, EventMap, KeyboardProcessor } from "./keyboards/keyboardProcessor.js";
|
||||
export {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ type TouchLayoutSpec = TouchLayout.TouchLayoutPlatform & { isDefault?: boolean};
|
|||
|
||||
import { Version, DeviceSpec } from "keyman/common/web-utils";
|
||||
import { StateKeyMap } from "./stateKeyMap.js";
|
||||
import { NotifyEventCode } from './keyboardLoaderBase.js';
|
||||
|
||||
/**
|
||||
* Stores preprocessed properties of a keyboard for quick retrieval later.
|
||||
|
|
@ -356,11 +357,12 @@ export class JSKeyboard {
|
|||
/**
|
||||
* Notifies keyboard of keystroke or other event
|
||||
*
|
||||
* @param {number} command event code (16,17,18) or 0
|
||||
* @param {TextStore} textStore textStore
|
||||
* @param {number} data 1 or 0
|
||||
* @param {NotifyEventCode} command event code (16,17,18) or 0
|
||||
* @param {TextStore} textStore textStore
|
||||
* @param {number} data 1 for KeyDown or FocusReceived,
|
||||
* 0 for KeyUp or FocusLost
|
||||
*/
|
||||
public notify(command: number, textStore: TextStore, data: number): void { // I2187
|
||||
public notify(command: NotifyEventCode, textStore: TextStore, data: number): void { // I2187
|
||||
// Good example use case - the Japanese CJK-picker keyboard
|
||||
if(typeof(this.scriptObject['KNS']) == 'function') {
|
||||
this.scriptObject['KNS'](command, textStore, data);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,14 @@ import { KMXKeyboard } from './kmxKeyboard.js';
|
|||
import { KeyboardHarness } from "./keyboardHarness.js";
|
||||
import KeyboardProperties from "./keyboardProperties.js";
|
||||
import { KeyboardLoadErrorBuilder, StubBasedErrorBuilder, UriBasedErrorBuilder } from './keyboardLoadError.js';
|
||||
import { Codes } from '../codes.js';
|
||||
|
||||
export enum NotifyEventCode {
|
||||
FocusEvent = 0,
|
||||
ShiftKey = Codes.keyCodes.K_SHIFT,
|
||||
ControlKey = Codes.keyCodes.K_CONTROL,
|
||||
AltKey = Codes.keyCodes.K_ALT,
|
||||
};
|
||||
|
||||
export type KeyboardStub = KeyboardProperties & { filename: string };
|
||||
export type Keyboard = JSKeyboard | KMXKeyboard;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { ActiveKey, ActiveSubKey } from './activeLayout.js';
|
|||
import { StateKeyMap } from './stateKeyMap.js';
|
||||
import { KeyEvent } from '../keyEvent.js';
|
||||
import { TextStore } from '../textStore.js';
|
||||
import { NotifyEventCode } from './keyboardLoaderBase.js';
|
||||
|
||||
/**
|
||||
* Acts as a wrapper class for KMX(+) Keyman keyboards
|
||||
|
|
@ -99,12 +100,15 @@ export class KMXKeyboard {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {number} eventCode event code (16,17,18) or 0 // TODO-web-core: document meaning of these! (#15290)
|
||||
* @param {TextStore} textStore textStore
|
||||
* @param {number} data 1 or 0
|
||||
* Notifies keyboard of keystroke or other event
|
||||
*
|
||||
* @param {NotifyEventCode} eventCode key code (16-18: Shift, Control or Alt),
|
||||
* or 0 for focus
|
||||
* @param {TextStore} textStore textStore
|
||||
* @param {number} data 1 for KeyDown or FocusReceived,
|
||||
* 0 for KeyUp or FocusLost
|
||||
*/
|
||||
public notify(eventCode: 16|17|18|0, textStore: TextStore, data: number) { // I2187
|
||||
public notify(eventCode: NotifyEventCode, textStore: TextStore, data: number): void { // I2187
|
||||
// TODO-web-core: do we need to support this? (#15290)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue