From 932884d0bfde419a7a16dbe4a9b339d8089abbf3 Mon Sep 17 00:00:00 2001 From: nyari Date: Thu, 8 Feb 2018 14:53:28 +0100 Subject: [PATCH 1/4] window platform support --- plugin.xml | 22 ++++++++++------ src/windows/KeyboardProxy.js | 49 ++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 src/windows/KeyboardProxy.js diff --git a/plugin.xml b/plugin.xml index 018c676..e8d3527 100644 --- a/plugin.xml +++ b/plugin.xml @@ -7,34 +7,42 @@ cordova,keyboard - + - + - + - - + + - + - + + + + + + + + diff --git a/src/windows/KeyboardProxy.js b/src/windows/KeyboardProxy.js new file mode 100644 index 0000000..77b36fe --- /dev/null +++ b/src/windows/KeyboardProxy.js @@ -0,0 +1,49 @@ +/*global Windows, WinJS, cordova, module, require*/ + +var inputPane = Windows.UI.ViewManagement.InputPane.getForCurrentView(); +var keyboardScrollDisabled = false; +var isVisible = false; + +inputPane.addEventListener('hiding', function () { + cordova.fireWindowEvent('keyboardWillHide'); + cordova.fireWindowEvent('keyboardHeightWillChange', { keyboardHeight: 0 }); + isVisible = false; + cordova.fireWindowEvent('keyboardDidHide'); +}); + +inputPane.addEventListener('showing', function (e) { + cordova.fireWindowEvent('keyboardWillShow'); + if (keyboardScrollDisabled) { + // this disables automatic scrolling of view contents to show focused control + e.ensuredFocusedElementInView = true; + } + cordova.fireWindowEvent('keyboardHeightWillChange', { keyboardHeight: e.occludedRect.height }); + isVisible = true; + cordova.fireWindowEvent('keyboardDidShow'); +}); + +module.exports.disableScrollingInShrinkView = function (disable) { + keyboardScrollDisabled = disable; +}; + +module.exports.show = function () { + if (typeof inputPane.tryShow === 'function') { + inputPane.tryShow(); + } +}; + +module.exports.close = function () { + if (typeof inputPane.tryShow === 'function') { + inputPane.tryHide(); + } +}; + +module.exports.shrinkView = function () { + //DO NOTHING +}; + +module.exports.hideFormAccessoryBar = function () { + //DO NOTHING +}; + +require("cordova/exec/proxy").add("Keyboard", module.exports); From fd72763989f6ccb73c2eb6150e042f53d8e445fa Mon Sep 17 00:00:00 2001 From: nyari Date: Wed, 21 Feb 2018 13:16:05 +0100 Subject: [PATCH 2/4] window platform support --- src/windows/KeyboardProxy.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/windows/KeyboardProxy.js b/src/windows/KeyboardProxy.js index 77b36fe..76e7775 100644 --- a/src/windows/KeyboardProxy.js +++ b/src/windows/KeyboardProxy.js @@ -1,12 +1,12 @@ /*global Windows, WinJS, cordova, module, require*/ var inputPane = Windows.UI.ViewManagement.InputPane.getForCurrentView(); -var keyboardScrollDisabled = false; +var keyboardScrollDisabled = true; var isVisible = false; inputPane.addEventListener('hiding', function () { cordova.fireWindowEvent('keyboardWillHide'); - cordova.fireWindowEvent('keyboardHeightWillChange', { keyboardHeight: 0 }); + cordova.fireWindowEvent('keyboardHeightWillChange', {keyboardHeight: 0}); isVisible = false; cordova.fireWindowEvent('keyboardDidHide'); }); @@ -17,12 +17,12 @@ inputPane.addEventListener('showing', function (e) { // this disables automatic scrolling of view contents to show focused control e.ensuredFocusedElementInView = true; } - cordova.fireWindowEvent('keyboardHeightWillChange', { keyboardHeight: e.occludedRect.height }); + cordova.fireWindowEvent('keyboardHeightWillChange', {keyboardHeight: e.occludedRect.height}); isVisible = true; cordova.fireWindowEvent('keyboardDidShow'); }); -module.exports.disableScrollingInShrinkView = function (disable) { +module.exports.disableScrollingInShrinkView = function (disable) { keyboardScrollDisabled = disable; }; From 942b748526cb1631acf6ee050549b54963ca925a Mon Sep 17 00:00:00 2001 From: nyari Date: Fri, 22 Jun 2018 11:50:12 +0200 Subject: [PATCH 3/4] fk version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 024eec8..178f926 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-keyboard", - "version": "1.2.0", + "version": "1.2.0-fk", "description": "Cordova Keyboard Plugin", "cordova": { "id": "cordova-plugin-keyboard", From f9adc855a0fa308d117486093e37f7ad563ef22c Mon Sep 17 00:00:00 2001 From: nyari Date: Fri, 22 Jun 2018 11:51:11 +0200 Subject: [PATCH 4/4] gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea