New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(web): Start of Sentence support - part 1 🕊 #5963
Changes from all commits
e803bed
80db98a
bbbf1af
dcedb15
f5fc417
ce2aa9a
e24b756
2de8c14
eb2892e
3f35cc0
3601ae9
f9b4be6
83eb839
1683998
67f7839
9e5c30b
1d42f2c
1d92385
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,6 +185,7 @@ namespace com.keyman.text { | |
|
||
static readonly TSS_LAYER: number = 33; | ||
static readonly TSS_PLATFORM: number = 31; | ||
static readonly TSS_LAYERCHANGED: number = 42; | ||
|
||
systemStores: {[storeID: number]: SystemStore}; | ||
|
||
|
@@ -201,6 +202,7 @@ namespace com.keyman.text { | |
|
||
this.systemStores[KeyboardInterface.TSS_PLATFORM] = new PlatformSystemStore(this); | ||
this.systemStores[KeyboardInterface.TSS_LAYER] = new MutableSystemStore(KeyboardInterface.TSS_LAYER, 'default'); | ||
this.systemStores[KeyboardInterface.TSS_LAYERCHANGED] = new MutableSystemStore(KeyboardInterface.TSS_LAYERCHANGED, '0'); | ||
|
||
this.variableStoreSerializer = variableStoreSerializer; | ||
} | ||
|
@@ -948,20 +950,59 @@ namespace com.keyman.text { | |
this.output(1, outputTarget, ""); | ||
} | ||
|
||
/** | ||
* Function processNewContextEvent | ||
* Scope Private | ||
* @param {Object} outputTarget The target receiving input | ||
* @param {Object} keystroke The input keystroke (with its properties) to be mapped by the keyboard. | ||
* Description Calls the keyboard's `begin newContext` group | ||
* @returns {RuleBehavior} Record of commands and state changes that result from executing `begin NewContext` | ||
*/ | ||
processNewContextEvent(outputTarget: OutputTarget, keystroke: KeyEvent): RuleBehavior { | ||
if(!this.activeKeyboard) { | ||
throw "No active keyboard for keystroke processing!"; | ||
} | ||
return this.process(this.activeKeyboard.processNewContextEvent.bind(this.activeKeyboard), outputTarget, keystroke); | ||
} | ||
|
||
/** | ||
* Function processPostKeystroke | ||
* Scope Private | ||
* @param {Object} outputTarget The target receiving input | ||
* @param {Object} keystroke The input keystroke with relevant properties to be mapped by the keyboard. | ||
* Description Calls the keyboard's `begin postKeystroke` group | ||
* @returns {RuleBehavior} Record of commands and state changes that result from executing `begin PostKeystroke` | ||
*/ | ||
processPostKeystroke(outputTarget: OutputTarget, keystroke: KeyEvent): RuleBehavior { | ||
if(!this.activeKeyboard) { | ||
throw "No active keyboard for keystroke processing!"; | ||
} | ||
return this.process(this.activeKeyboard.processPostKeystroke.bind(this.activeKeyboard), outputTarget, keystroke); | ||
} | ||
|
||
/** | ||
* Function processKeystroke | ||
* Scope Private | ||
* @param {Object} element The page element receiving input | ||
* @param {Object} outputTarget The target receiving input | ||
* @param {Object} keystroke The input keystroke (with its properties) to be mapped by the keyboard. | ||
* Description Encapsulates calls to keyboard input processing. | ||
* @returns {number} 0 if no match is made, otherwise 1. | ||
* @returns {RuleBehavior} Record of commands and state changes that result from executing `begin Unicode` | ||
*/ | ||
processKeystroke(outputTarget: OutputTarget, keystroke: KeyEvent): RuleBehavior { | ||
if(!this.activeKeyboard) { | ||
throw "No active keyboard for keystroke processing!"; | ||
} | ||
return this.process(this.activeKeyboard.process.bind(this.activeKeyboard), outputTarget, keystroke); | ||
} | ||
|
||
private process(callee, outputTarget: OutputTarget, keystroke: KeyEvent): RuleBehavior { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, |
||
// Clear internal state tracking data from prior keystrokes. | ||
if(!outputTarget) { | ||
throw "No target specified for keyboard output!"; | ||
} else if(!this.activeKeyboard) { | ||
throw "No active keyboard for keystroke processing!"; | ||
} else if(!callee) { | ||
throw "No callee for keystroke processing!"; | ||
} | ||
|
||
outputTarget.invalidateSelection(); | ||
|
@@ -984,7 +1025,7 @@ namespace com.keyman.text { | |
|
||
// Calls the start-group of the active keyboard. | ||
this.activeTargetOutput = outputTarget; | ||
var matched = this.activeKeyboard.process(outputTarget, keystroke); | ||
var matched = callee(outputTarget, keystroke); | ||
this.activeTargetOutput = null; | ||
|
||
// Finalize the rule's results. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
start_of_sentence_3621 Change History | ||
==================== | ||
|
||
1.0 (2021-11-22) | ||
---------------- | ||
* Created by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
keyEvent.device
different fromthis.device
? (l. 64)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is different, just another way of accessing the device.