diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-11-08 12:37:03 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-11-08 12:37:03 -0500 |
| commit | ef4f212fc1482136dba1e690ec589b315b4a377f (patch) | |
| tree | 0b7e16d72567fafcfd3e08d7c5c591ad07a63458 /StoneIsland/plugins/ionic-plugin-keyboard/src/windows | |
| parent | 5fa81da81260d65113f57a293b6256d334fe8e2d (diff) | |
build 0.7.0
Diffstat (limited to 'StoneIsland/plugins/ionic-plugin-keyboard/src/windows')
| -rw-r--r-- | StoneIsland/plugins/ionic-plugin-keyboard/src/windows/KeyboardProxy.js | 37 |
1 files changed, 37 insertions, 0 deletions
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); |
