Fix keyboard appearance on Android. Closes #1070

This commit is contained in:
kangax 2014-01-18 16:08:41 -05:00
parent f1aef7ed1a
commit aa98c317b7
6 changed files with 20 additions and 5 deletions

7
dist/fabric.js vendored
View file

@ -19762,7 +19762,6 @@ fabric.Image.filters.BaseFilter = fabric.util.createClass(/** @lends fabric.Imag
this.hiddenTextarea.value = this.text;
this.hiddenTextarea.selectionStart = this.selectionStart;
this.hiddenTextarea.focus();
},
/**
@ -20370,6 +20369,7 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
initKeyHandlers: function() {
fabric.util.addListener(fabric.document, 'keydown', this.onKeyDown.bind(this));
fabric.util.addListener(fabric.document, 'keypress', this.onKeyPress.bind(this));
fabric.util.addListener(fabric.document, 'click', this.onClick.bind(this));
},
/**
@ -20407,6 +20407,11 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
88: 'cut'
},
onClick: function() {
// No need to trigger click event here, focus is enough to have the keyboard appear on Android
this.hiddenTextarea.focus();
},
/**
* Handles keyup event
* @param {Event} e Event object

4
dist/fabric.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/fabric.min.js.gz vendored

Binary file not shown.

View file

@ -19762,7 +19762,6 @@ fabric.Image.filters.BaseFilter = fabric.util.createClass(/** @lends fabric.Imag
this.hiddenTextarea.value = this.text;
this.hiddenTextarea.selectionStart = this.selectionStart;
this.hiddenTextarea.focus();
},
/**
@ -20370,6 +20369,7 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
initKeyHandlers: function() {
fabric.util.addListener(fabric.document, 'keydown', this.onKeyDown.bind(this));
fabric.util.addListener(fabric.document, 'keypress', this.onKeyPress.bind(this));
fabric.util.addListener(fabric.document, 'click', this.onClick.bind(this));
},
/**
@ -20407,6 +20407,11 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
88: 'cut'
},
onClick: function() {
// No need to trigger click event here, focus is enough to have the keyboard appear on Android
this.hiddenTextarea.focus();
},
/**
* Handles keyup event
* @param {Event} e Event object

View file

@ -353,7 +353,6 @@
this.hiddenTextarea.value = this.text;
this.hiddenTextarea.selectionStart = this.selectionStart;
this.hiddenTextarea.focus();
},
/**

View file

@ -6,6 +6,7 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
initKeyHandlers: function() {
fabric.util.addListener(fabric.document, 'keydown', this.onKeyDown.bind(this));
fabric.util.addListener(fabric.document, 'keypress', this.onKeyPress.bind(this));
fabric.util.addListener(fabric.document, 'click', this.onClick.bind(this));
},
/**
@ -43,6 +44,11 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
88: 'cut'
},
onClick: function() {
// No need to trigger click event here, focus is enough to have the keyboard appear on Android
this.hiddenTextarea.focus();
},
/**
* Handles keyup event
* @param {Event} e Event object