From e579530668b8ff314fff577b4de874822e035285 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Tue, 27 Sep 2022 11:03:22 +0700 Subject: [PATCH] chore(web): drops alignInputs, hideInputs --- web/source/kmwbase.ts | 4 +-- web/source/kmwembedded.ts | 8 ----- web/source/kmwnative.ts | 20 ------------ web/source/kmwrotation.ts | 2 -- web/source/osk/oskView.ts | 3 -- web/source/osk/visualKeyboard.ts | 53 ------------------------------- web/testing/inline-osk/index.html | 1 - 7 files changed, 2 insertions(+), 89 deletions(-) diff --git a/web/source/kmwbase.ts b/web/source/kmwbase.ts index d1ccd15c6ad..2898e6f5019 100644 --- a/web/source/kmwbase.ts +++ b/web/source/kmwbase.ts @@ -113,9 +113,9 @@ namespace com.keyman { getKeyboardPath(f, p?){return f;} KC_(n, ln, Pelem){return '';} handleRotationEvents(){} - // Will serve as an API function for a workaround, in case of future touch-alignment issues. + // Legacy API function for touch-alias issue workarounds + // Touch-aliases have been eliminated, though. ['alignInputs'](eleList?: HTMLElement[]){} - hideInputs() {}; namespaceID(Pstub) {}; preserveID(Pk) {}; diff --git a/web/source/kmwembedded.ts b/web/source/kmwembedded.ts index 4b1ee767fd7..84081d1a7dd 100644 --- a/web/source/kmwembedded.ts +++ b/web/source/kmwembedded.ts @@ -228,14 +228,6 @@ namespace com.keyman.text { */ keymanweb.domManager._SetTargDir = function(Ptarg){}; - /** - * Align input fields (should not be needed with KMEI, KMEA) - * - * @param {object} eleList A list of specific elements to align. If nil, selects all elements. - * - **/ - keymanweb.alignInputs = function(eleList: HTMLElement[]) {}; - /** * Use rotation events to adjust OSK element positions and scaling if necessary */ diff --git a/web/source/kmwnative.ts b/web/source/kmwnative.ts index 0af29d2ae28..793396e1486 100644 --- a/web/source/kmwnative.ts +++ b/web/source/kmwnative.ts @@ -90,26 +90,6 @@ if(!window['keyman']['initialized']) { return (rx.test(Lfilename) ? '' : keymanweb.options['keyboards']) + Lfilename; } - /** - * Align input fields (should not be needed with KMEI, KMEA), making them visible if previously hidden. - * - * @param {object} eleList A list of specific elements to align. If nil, selects all elements. - * - **/ - keymanweb.alignInputs = function(eleList: HTMLElement[]) { - // no-op - } - - /** - * Programatically hides all input fields with underlying elements. Restore with .alignInputs. - * - * @param {boolean} align align and make visible, else hide - * - **/ - keymanweb.hideInputs = function() { - // no-op. - } - /** * Test if caret position is determined from the active element, or * from the synthesized overlay element (touch devices) diff --git a/web/source/kmwrotation.ts b/web/source/kmwrotation.ts index c098996dea0..1ce4cc636a5 100644 --- a/web/source/kmwrotation.ts +++ b/web/source/kmwrotation.ts @@ -42,8 +42,6 @@ namespace com.keyman { } resolve() { - this.keyman.alignInputs(); - var osk = this.keyman.osk; osk.hideLanguageMenu(); diff --git a/web/source/osk/oskView.ts b/web/source/osk/oskView.ts index 523dbd4cf47..5748b5b05a0 100644 --- a/web/source/osk/oskView.ts +++ b/web/source/osk/oskView.ts @@ -505,9 +505,6 @@ namespace com.keyman.osk { bs.height = 'auto'; bs.maxWidth = bs.maxHeight = ''; } - - let keyman = com.keyman.singleton; - keyman.alignInputs(); } public refreshLayoutIfNeeded(pending?: boolean) { diff --git a/web/source/osk/visualKeyboard.ts b/web/source/osk/visualKeyboard.ts index 10dd443ddfb..74d735da560 100644 --- a/web/source/osk/visualKeyboard.ts +++ b/web/source/osk/visualKeyboard.ts @@ -1349,9 +1349,6 @@ namespace com.keyman.osk { util.addFontFaceStyleSheet(kfd); util.addFontFaceStyleSheet(ofd); - // Temporarily hide duplicated elements on non-desktop browsers - keymanweb.hideInputs(); - // Build the style string and append (or replace) the font style sheet // Note: Some browsers do not download the font-face font until it is applied, // so must apply style before testing for font availability @@ -1361,11 +1358,6 @@ namespace com.keyman.osk { customStyle = customStyle + activeKeyboard.oskStyling; this.styleSheet = util.addStyleSheet(customStyle); //Build 360 - - // Wait until font is loaded then align duplicated input elements with page elements - if (this.waitForFonts(kfd, ofd)) { - keymanweb.alignInputs(); - } } /** @@ -1718,51 +1710,6 @@ namespace com.keyman.osk { } }; - /** - * Wait until font is loaded before applying stylesheet - test each 100 ms - * @param {Object} kfd main font descriptor - * @param {Object} ofd secondary font descriptor (OSK only) - * @return {boolean} - */ - waitForFonts(kfd, ofd) { - let keymanweb = com.keyman.singleton; - let util = keymanweb.util; - - let fontDefined = !!(kfd && kfd['files']); - kfd = fontDefined ? kfd : undefined; - - let oskFontDefined = !!(ofd && ofd['files']); - ofd = oskFontDefined ? ofd : undefined; - - // Automatically 'ready' if the descriptor is explicitly `undefined`. - // Thus, also covers the case where both are undefined. - var kReady = util.checkFontDescriptor(kfd), oReady = util.checkFontDescriptor(ofd); - if (kReady && oReady) { - return true; - } - - keymanweb.fontCheckTimer = window.setInterval(function () { - if (util.checkFontDescriptor(kfd) && util.checkFontDescriptor(ofd)) { - window.clearInterval(keymanweb.fontCheckTimer); - keymanweb.fontCheckTimer = null; - keymanweb.alignInputs(); - } - }, 100); - - // Align anyway as best as can if font appears to remain uninstalled after 5 seconds - window.setTimeout(function () { - if (keymanweb.fontCheckTimer) { - window.clearInterval(keymanweb.fontCheckTimer); - keymanweb.fontCheckTimer = null; - keymanweb.alignInputs(); - // Don't notify - this is a management issue, not anything the user needs to deal with - // TODO: Consider having an icon in the OSK with a bubble that indicates missing font - //util.alert('Unable to download the font normally used with '+ks['KN']+'.'); - } - }, 5000); - return false; - }; - shutdown() { let keyman = com.keyman.singleton; diff --git a/web/testing/inline-osk/index.html b/web/testing/inline-osk/index.html index 01bf80a84f5..5d3e1d9ad3c 100644 --- a/web/testing/inline-osk/index.html +++ b/web/testing/inline-osk/index.html @@ -47,7 +47,6 @@ document.getElementById('KeymanWebControl').appendChild(newOSK.element); keyman.osk = newOSK; newOSK.activeKeyboard = keyman.core.activeKeyboard; - keyman.alignInputs(); document.getElementById('ta1').focus(); }