From ef4f212fc1482136dba1e690ec589b315b4a377f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 8 Nov 2016 12:37:03 -0500 Subject: build 0.7.0 --- .../src/windows/KeyboardProxy.js | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 StoneIsland/plugins/ionic-plugin-keyboard/src/windows/KeyboardProxy.js (limited to 'StoneIsland/plugins/ionic-plugin-keyboard/src/windows/KeyboardProxy.js') diff --git a/StoneIsland/plugins/ionic-plugin-keyboard/src/windows/KeyboardProxy.js b/StoneIsland/plugins/ionic-plugin-keyboard/src/windows/KeyboardProxy.js new file mode 100644 index 00000000..2ce74e9f --- /dev/null +++ b/StoneIsland/plugins/ionic-plugin-keyboard/src/windows/KeyboardProxy.js @@ -0,0 +1,37 @@ + +/*global Windows, WinJS, cordova, module, require*/ + +var inputPane = Windows.UI.ViewManagement.InputPane.getForCurrentView(); +var keyboardScrollDisabled = false; + +inputPane.addEventListener('hiding', function() { + cordova.fireWindowEvent('native.keyboardhide'); + cordova.plugins.Keyboard.isVisible = false; +}); + +inputPane.addEventListener('showing', function(e) { + if (keyboardScrollDisabled) { + // this disables automatic scrolling of view contents to show focused control + e.ensuredFocusedElementInView = true; + } + cordova.fireWindowEvent('native.keyboardshow', { keyboardHeight: e.occludedRect.height }); + cordova.plugins.Keyboard.isVisible = true; +}); + +module.exports.disableScroll = 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(); + } +}; + +require("cordova/exec/proxy").add("Keyboard", module.exports); -- cgit v1.2.3-70-g09d2