Closed iamkevinwang closed 8 years ago
Thanks for reporting, this is certainly an issue of paste.js. I tried to make behaviours across different browsers the same, but most of my time have been focused on image pasting, so text pasting could have been missed out.
I have the same problem, is there any fix solution? 3ks!
Here's the workaround I use:
var inChrome = navigator.userAgent.toLowerCase().indexOf('chrome') !== -1;
element.pastableTextarea().on('pasteText', function(ev, data) {
if (inChrome) return; // default paste event will work
var cursorStart = element.prop('selectionStart');
var cursorEnd = element.prop('selectionEnd');
var contents = element.val();
element.val(contents.slice(0, cursorStart) + data.text + contents.slice(cursorEnd));
element[0].setSelectionRange(cursorStart + data.text.length, cursorStart + data.text.length);
element.trigger('change');
});
@pkaminski 3ks, i will try.
Hi, people, this issue is fixed using @pkaminski 's workaround. Now all browsers (including IE10) should have un-affected textareas, like in Chrome. Image-pasting still won't work under IE10, but text-pasting is not "broken" anymore.
Hi, I have some question. following is my situation: I copy some plain text and paste plain text to textarea on your example web site (http://micy.in/paste.js/) . but I found out that when I use Firfox(IE 10 also),I can't paste plain text to textarea. It's only trigger pasteText Event and append result after textarea.(see pic 1)
*pic 1
But it's work on chrome.(see pic 2)
*pic 2
I trace the pastejs source code and found pastejs would change it's behaviour between chrome and other browser.(see pic 3)
*pic 3
I have tried to make all browser to behave as the same as possible, but after trial and error, I still could not make different browsers to work and behave the same.
Can you give me some advice?