#11970 closed Bug (fixed)
CKEditor paste event not fired when pasting with SHIFT+INS in IE9
Reported by: | Henning | Owned by: | Piotr Jasiun |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 4.4.4 |
Component: | General | Version: | 4.0 Beta |
Keywords: | IE Support | Cc: |
Description
I don't get CKEditor's 'paste' event fired when pasting with SHIFT+INS using
- Internet Explorer 9
- CKEditor 4.3.2 FF and Chrome fire the paste event.
See the small example code below. Paste alert is not displayed.
Browsing thru clipboard\plugin.js, this seems to be a complex matter. I do get the paste event in IE9 when removing the following line from the onKey function, but cannot oversee the side effects of this:
case CKEDITOR.SHIFT + 45: SHIFT+INS
<!DOCTYPE html> <html> <head> <title>A Simple Page with CKEditor</title> <script src="ckeditor/ckeditor.js"></script> </head> <body> <form> <textarea id="editor1" name="editor1" rows="10" cols="80"> This is my textarea to be replaced with CKEditor. </textarea> <script> // Replace the <textarea id="editor1"> with a CKEditor // instance, using default configuration. var myEditor = CKEDITOR.replace('editor1'); myEditor.on('paste', function (evt) { alert("paste 1"); }); </script> </form> </body> </html>
Change History (9)
comment:1 Changed 11 years ago by
Keywords: | IE added; paste insert clipboard removed |
---|---|
Status: | new → confirmed |
Version: | 4.3.2 → 4.0 Beta |
comment:2 Changed 11 years ago by
This workaround mentioned on SO really seems to work:
editor.on('key', function(ev) { if (ev.data.keyCode == 2228269 && CKEDITOR.env.ie) { setTimeout(function() { var event = { 'type': 'html', 'dataValue': editor.getData() }; editor.editable().setHtml(''); editor.fire('paste', event); }, 100); } }); editor.on('paste', function(ev) { alert('we are in the on paste event!'); });
comment:3 Changed 11 years ago by
Keywords: | Support added |
---|
comment:4 Changed 11 years ago by
The workaround is ok when you just want to get a paste event at some point of time. It is not sufficient if you want to use undo and paste features provided by other plugins, because the workarounded paste event fires too late. Hence we decided to cancel the SHIFT+INS key event, and must use CTRL+V instead, which, however, is not _nice_.
comment:5 Changed 11 years ago by
Owner: | set to Piotr Jasiun |
---|---|
Status: | confirmed → review |
The reason of the issue is this fix: https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/clipboard/plugin.js#L471-L472
I've fixed it and pushed changes to t/11970.
comment:6 Changed 11 years ago by
I applied the fix that was committed and it appears to resolve the issue. I've tested it out on IE8 and IE11.
comment:7 Changed 11 years ago by
Milestone: | → CKEditor 4.4.4 |
---|---|
Status: | review → review_passed |
@pjasiun: Comment in the code must be added.
comment:8 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | review_passed → closed |
Comment added and ticket masterized (git:7c0da96).
I see this somewhat works in CKEditor 3.6.6 - when you use SHIFT+Insert, browser asks if it should allow clipboard access. If you click allow you will get text pasted and alert box shown.
Starting from CKEditor 4.0 beta, content is pasted but no alert box is shown what means that paste event is not captured for SHIFT+Insert on IE.
Someone on SO had same problem: http://stackoverflow.com/questions/19269234/ckeditor-capturing-on-paste-event-including-shift-insert