mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-15 18:37:32 +00:00
Merge pull request #2850 from keymanapp/refactor/web/engine/embedded-insert-text
refactor(web/engine): reworks use of embedded's keyman['oninserttext']
This commit is contained in:
commit
348cd65497
2 changed files with 8 additions and 12 deletions
|
|
@ -832,11 +832,6 @@ namespace com.keyman.text {
|
|||
output(dn: number, outputTarget: OutputTarget, s:string): void {
|
||||
this.resetContextCache();
|
||||
let keyman = com.keyman.singleton;
|
||||
|
||||
// KeymanTouch for Android uses direct insertion of the character string
|
||||
if('oninserttext' in keyman && !(outputTarget instanceof Mock)) {
|
||||
keyman['oninserttext'](dn,s);
|
||||
}
|
||||
|
||||
outputTarget.saveProperties();
|
||||
outputTarget.clearSelection();
|
||||
|
|
@ -1041,9 +1036,6 @@ namespace com.keyman.text {
|
|||
}
|
||||
|
||||
this.output(1, outputTarget, "");
|
||||
if(outputTarget.getElement()) {
|
||||
this.doInputEvent(outputTarget.getElement());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -95,10 +95,6 @@ namespace com.keyman.text {
|
|||
}
|
||||
break;
|
||||
case Codes.keyCodes['K_ENTER']:
|
||||
// Ensure the newline is forwarded when in an embedded context! It doesn't yet have its own specialized OutputTarget type.
|
||||
if(keyman.isEmbedded && !quiet) { // Don't pass it along for Mocks, though. They're (currently) only used in predictive text.
|
||||
keyman['oninserttext'](0, '\n');
|
||||
}
|
||||
outputTarget.handleNewlineAtCaret();
|
||||
|
||||
return '\n'; // We still return this, as it ensures we generate a rule-match.
|
||||
|
|
@ -531,11 +527,19 @@ namespace com.keyman.text {
|
|||
DOMEventHandlers.states.changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// -- All keystroke (and 'alternate') processing is now complete. Time to finalize everything! --
|
||||
|
||||
// Notify the ModelManager of new input - it's predictive text time!
|
||||
ruleBehavior.transcription.alternates = alternates;
|
||||
keyman.modelManager.predict(ruleBehavior.transcription);
|
||||
|
||||
// KMEA and KMEI (embedded mode) use direct insertion of the character string
|
||||
if(keyman.isEmbedded) {
|
||||
// A special embedded callback used to setup direct callbacks to app-native code.
|
||||
keyman['oninserttext'](ruleTransform.deleteLeft, ruleTransform.insert, ruleTransform.deleteRight);
|
||||
}
|
||||
|
||||
// Since this method now performs changes for 'default' keystrokes, synthetic 'change' event generation
|
||||
// belongs here, rather than only in interface.processKeystroke() as in versions pre-12.
|
||||
if(outputTarget.getElement()) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue