Skip to content

Commit

Permalink
Merge pull request #2336 from asturur/itext-paste
Browse files Browse the repository at this point in the history
Itext paste
  • Loading branch information
kangax committed Jul 14, 2015
2 parents 8791741 + 8f547d9 commit 033402d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/mixins/itext_key_behavior.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,20 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
*/
paste: function(e) {
var copiedText = null,
clipboardData = this._getClipboardData(e);
clipboardData = this._getClipboardData(e),
usedCopiedStyle;

// Check for backward compatibility with old browsers
if (clipboardData) {
copiedText = clipboardData.getData('text');
copiedText = clipboardData.getData('text').replace(/\r/g, '');
}
else {
copiedText = this.copiedText;
usedCopiedStyle = true;
}

if (copiedText) {
this.insertChars(copiedText, true);
this.insertChars(copiedText, usedCopiedStyle);
}
},

Expand Down

0 comments on commit 033402d

Please sign in to comment.