From f91c7278fdd6f1cf44c55e29d1321789e978668b Mon Sep 17 00:00:00 2001 From: Oliver Klein Date: Tue, 22 Mar 2016 09:40:19 -0700 Subject: [PATCH] Changed from ionic-plugin-keyboard to cordova-plugin-keyboard Refactored ionKeyboard to suits changes. --- components/ionKeyboard/ionKeyboard.js | 39 ++++++--------------------- package.js | 2 +- 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/components/ionKeyboard/ionKeyboard.js b/components/ionKeyboard/ionKeyboard.js index 4e65130..ee3b2d6 100644 --- a/components/ionKeyboard/ionKeyboard.js +++ b/components/ionKeyboard/ionKeyboard.js @@ -7,43 +7,42 @@ Meteor.startup(function () { IonKeyboard = { close: function () { if (Meteor.isCordova) { - cordova.plugins.Keyboard.close(); + Keyboard.hide(); } }, show: function () { if (Meteor.isCordova) { - cordova.plugins.Keyboard.show(); + Keyboard.show(); } }, hideKeyboardAccessoryBar: function () { if (Meteor.isCordova) { - cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); + Keyboard.hideFormAccessoryBar(true); } }, showKeyboardAccessoryBar: function () { if (Meteor.isCordova) { - cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false); + Keyboard.hideFormAccessoryBar(false); } }, disableScroll: function () { if (Meteor.isCordova) { - cordova.plugins.Keyboard.disableScroll(true); + Keyboard.disableScrollingInShrinkView(true); } }, enableScroll: function () { if (Meteor.isCordova) { - cordova.plugins.Keyboard.disableScroll(false); + Keyboard.disableScrollingInShrinkView(false); } } }; -window.addEventListener('native.keyboardshow', function (event) { - +window.addEventListener('keyboardHeightWillChange', function (event) { // TODO: Android is having problems if (Platform.isAndroid()) { return; @@ -52,24 +51,12 @@ window.addEventListener('native.keyboardshow', function (event) { $('body').addClass('keyboard-open'); var keyboardHeight = event.keyboardHeight; - // Attach any elements that want to be attached - $('[data-keyboard-attach]').each(function (index, el) { - $(el).data('ionkeyboard.bottom', $(el).css('bottom')); - $(el).css({bottom: keyboardHeight}); - }); - - // Move the bottom of the content area(s) above the top of the keyboard - $('.content.overflow-scroll').each(function (index, el) { - $(el).data('ionkeyboard.bottom', $(el).css('bottom')); - $(el).css({bottom: keyboardHeight}); - }); - // Scroll to the focused element scrollToFocusedElement(null, keyboardHeight); }); -window.addEventListener('native.keyboardhide', function (event) { +window.addEventListener('keyboardDidHide', function (event) { // TODO: Android is having problems if (Platform.isAndroid()) { @@ -79,14 +66,4 @@ window.addEventListener('native.keyboardhide', function (event) { // $('input, textarea').blur(); $('body').removeClass('keyboard-open'); - // Detach any elements that were attached - $('[data-keyboard-attach]').each(function (index, el) { - $(el).css({bottom: $(el).data('ionkeyboard.bottom')}); - }); - - // Reset the content area(s) - $('.content.overflow-scroll').each(function (index, el) { - $(el).css({bottom: $(el).data('ionkeyboard.bottom')}); - }); - }); diff --git a/package.js b/package.js index 7ccb336..b0be862 100644 --- a/package.js +++ b/package.js @@ -6,7 +6,7 @@ Package.describe({ }); Cordova.depends({ - 'ionic-plugin-keyboard': '1.0.8' + 'cordova-plugin-keyboard': '1.1.3' }); Package.onUse(function(api) {