mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-08 16:30:59 +00:00
Fix iText stealing focus
This commit is contained in:
parent
0dbf03835d
commit
c85a33752b
2 changed files with 8 additions and 10 deletions
|
|
@ -8,7 +8,6 @@
|
|||
* Initializes all the interactive behavior of IText
|
||||
*/
|
||||
initBehavior: function() {
|
||||
this.initKeyHandlers();
|
||||
this.initCursorSelectionHandlers();
|
||||
this.initDoubleClickSimulation();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,14 +1,5 @@
|
|||
fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.prototype */ {
|
||||
|
||||
/**
|
||||
* Initializes key handlers
|
||||
*/
|
||||
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));
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes hidden textarea (needed to bring up keyboard in iOS)
|
||||
*/
|
||||
|
|
@ -19,6 +10,14 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
this.hiddenTextarea.style.cssText = 'position: absolute; top: 0; left: -9999px';
|
||||
|
||||
fabric.document.body.appendChild(this.hiddenTextarea);
|
||||
|
||||
fabric.util.addListener(this.hiddenTextarea, 'keydown', this.onKeyDown.bind(this));
|
||||
fabric.util.addListener(this.hiddenTextarea, 'keypress', this.onKeyPress.bind(this));
|
||||
|
||||
if (!this._clickHandlerInitialized && this.canvas) {
|
||||
fabric.util.addListener(this.canvas.upperCanvasEl, 'click', this.onClick.bind(this));
|
||||
this._clickHandlerInitialized = true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue