@@ -8,7 +8,6 @@ import { WebviewConfiguration, WebviewInitOptionDefaults, WebviewInitOptionSpec
88import ContextManager from './contextManager.js' ;
99import PassthroughKeyboard from './passthroughKeyboard.js' ;
1010import { buildEmbeddedGestureConfig , setupEmbeddedListeners } from './oskConfiguration.js' ;
11- import { SubkeyDelegator } from './osk/subkeyDelegator.js' ;
1211
1312export default class KeymanEngine extends KeymanEngineBase < WebviewConfiguration , ContextManager , PassthroughKeyboard > {
1413 // Ideally, we would be able to auto-detect `sourceUri`: https://stackoverflow.com/a/60244278.
@@ -92,53 +91,6 @@ export default class KeymanEngine extends KeymanEngineBase<WebviewConfiguration,
9291 this . osk ?. refreshLayout ( ) ;
9392 } ;
9493
95- /**
96- * Function called by Android and iOS when a device-implemented keyboard popup
97- * is displayed or hidden. As this is controlled by the app, we use it as a
98- * trigger for 'embedded'-mode gesture state management.
99- *
100- * @param {boolean } isVisible
101- *
102- **/
103- popupVisible ( isVisible ) {
104- const osk = this . osk ;
105- if ( ! osk || ! osk . vkbd ) {
106- return ;
107- }
108-
109- let gesture = osk . vkbd . subkeyGesture as SubkeyDelegator ;
110- let pendingLongpress = osk . vkbd . pendingSubkey ;
111-
112- /*
113- * If a longpress popup was visible, but is no longer, this means that the
114- * associated longpress gesture was cancelled. It is possible for the base
115- * key to emit if selected at this time; detection of this is managed by
116- * the `SubkeyDelegator` class.
117- */
118- if ( ! isVisible ) {
119- if ( gesture ) {
120- gesture . resolve ( null ) ;
121- osk . vkbd . subkeyGesture = null ;
122- } else if ( pendingLongpress ) {
123- pendingLongpress . cancel ( ) ;
124- osk . vkbd . pendingSubkey = null ;
125- }
126- }
127-
128- /*
129- * If the popup was not visible, but now is, that means our previously-pending
130- * longpress is now 'realized' (complete). The OSK relies upon this state
131- * information, which will be properly updated by `resolve`.
132- *
133- * Prominent uses of such state info helps prevent change of base key, key
134- * previews, and key output from occurring while a subkey popup remains active.
135- */
136- if ( isVisible && pendingLongpress ) {
137- // Fulfills the first-stage promise.
138- pendingLongpress . resolve ( ) ;
139- }
140- } ;
141-
14294 /**
14395 * Return position of language menu key to KeymanTouch
14496 *
@@ -186,47 +138,6 @@ export default class KeymanEngine extends KeymanEngineBase<WebviewConfiguration,
186138 this . osk ?. vkbd ?. globeHint ?. hide ( this . osk . vkbd . currentLayer . globeKey . btn ) ;
187139 }
188140
189- /**
190- * Accept an external key ID (from KeymanTouch) and pass to the keyboard mapping
191- *
192- * @param {string } keyName key identifier which could contain a display layer and a "functional" layer
193- * e.g: 'shift-K_E+rightalt-shift'
194- **/
195- executePopupKey ( keyName : string ) {
196- const vkbd = this . osk ?. vkbd ;
197- let origArg = keyName ;
198- if ( ! this . contextManager . activeKeyboard || ! vkbd ) {
199- return false ;
200- }
201-
202- /* Clear any pending (non-popup) key */
203- vkbd . keyPending = null ;
204-
205- // Changes for Build 353 to resolve KMEI popup key issues
206- keyName = keyName . replace ( 'popup-' , '' ) ; //remove popup prefix if present (unlikely)
207-
208- // Regex for 'display layer'-'virtual key name'+'optional functional layer'
209- // Can't just split on '-' because some layers like ctrl-shift contain it.
210- // Virtual key name starts with T_, K_, or U_
211- // matches[1]: displayLayer (not used)
212- // matches[2]: keyId
213- // matches[3]: optional functionalLayer
214- let matches = keyName . match ( / ^ ( .+ ) - ( [ T K U ] _ [ ^ + ] + ) \+ ? ( .+ ) ? $ / ) ;
215- if ( matches == null ) {
216- return false ;
217- }
218- keyName = matches [ 2 ] + ( matches [ 3 ] ? '+' + matches [ 3 ] : '' ) ;
219-
220- // This should be set if we're within this method... but it's best to guard against nulls here, just in case.
221- if ( vkbd . subkeyGesture ) {
222- let gesture = vkbd . subkeyGesture as SubkeyDelegator ;
223- gesture . resolve ( keyName ) ;
224- vkbd . subkeyGesture = null ;
225- } else {
226- console . warn ( "No base key exists for the subkey being executed: '" + origArg + "'" ) ;
227- }
228- } ;
229-
230141 // Properties set by the WebView hosting page
231142 beepKeyboard ?: ( ) => void = null ;
232143 hideKeyboard ?: ( ) => void = null ;
0 commit comments