Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
.idea
15 changes: 12 additions & 3 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:rim="http://www.blackberry.com/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-ionic-keyboard" version="2.1.3">
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-ionic-keyboard"
version="2.1.3">
<name>cordova-plugin-ionic-keyboard</name>
<description>Ionic Keyboard Plugin</description>
<license>Apache 2.0</license>
Expand All @@ -10,14 +12,14 @@
<author>Apache Software Foundation</author>

<engines>
<engine name="cordova" version=">=3.2.0"/>
<engine name="cordova" version=">=3.2.0"/>
</engines>

<!-- ios -->
<platform name="ios">

<js-module src="www/ios/keyboard.js" name="keyboard">
<clobbers target="window.Keyboard"/>
<clobbers target="window.Keyboard"/>
</js-module>

<config-file target="config.xml" parent="/*">
Expand All @@ -44,4 +46,11 @@
<source-file src="src/android/IonicKeyboard.java" target-dir="src/io/ionic/keyboard"/>
</platform>

<!-- android -->
<platform name="windows">
<js-module src="www/windows/keyboard.js" name="keyboard">
<clobbers target="window.Keyboard"/>
</js-module>
</platform>

</plugin>
57 changes: 57 additions & 0 deletions www/windows/keyboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
var keyboardScrollDisabled = true;
var inputPane = Windows.UI.ViewManagement.InputPane.getForCurrentView();

var Keyboard = function () {
};

Keyboard.isVisible = false;

inputPane.addEventListener('hiding', function () {
if (!Keyboard.isVisible) {
return;
}

cordova.fireWindowEvent('keyboardWillHide');
Keyboard.isVisible = false;
cordova.fireWindowEvent('keyboardDidHide');
});

inputPane.addEventListener('showing', function (e) {
if (Keyboard.isVisible) {
return;
}

cordova.fireWindowEvent('keyboardWillShow', {
keyboardHeight: e.occludedRect.height
});
if (keyboardScrollDisabled) {
// this disables automatic scrolling of view contents to show focused control
e.ensuredFocusedElementInView = true;
}
Keyboard.isVisible = true;
cordova.fireWindowEvent('keyboardDidShow', {
keyboardHeight: e.occludedRect.height
});
});

Keyboard.hideFormAccessoryBar = Keyboard.hideKeyboardAccessoryBar = function (hide) {
console.warn("Keyboard.hideFormAccessoryBar() not supported in Windows");
};

Keyboard.hide = function () {
if (typeof inputPane.tryShow === 'function') {
inputPane.tryHide();
}
};

Keyboard.show = function () {
if (typeof inputPane.tryShow === 'function') {
inputPane.tryShow();
}
};

Keyboard.setResizeMode = function (mode) {
console.warn("Keyboard.setResizeMode() not supported in Windows");
};

module.exports = Keyboard;