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>
}}}
--
Ticket URL: <http://dev.ckeditor.com/ticket/11970>
CKEditor <http://ckeditor.com/>
The text editor for the Internet
* keywords: paste, insert, clipboard => IE
* status: new => confirmed
* version: 4.3.2 => 4.0 Beta
Comment:
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
--
Ticket URL: <http://dev.ckeditor.com/ticket/11970#comment:1>
Comment (by j.swiderski):
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!');
});
}}}
--
Ticket URL: <http://dev.ckeditor.com/ticket/11970#comment:2>
* keywords: IE => IE Support
--
Ticket URL: <http://dev.ckeditor.com/ticket/11970#comment:3>
Comment (by Henning):
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_.
--
Ticket URL: <http://dev.ckeditor.com/ticket/11970#comment:4>
* owner: => pjasiun
* status: confirmed => review
Comment:
The reason of the issue it this fix: https://github.com/ckeditor/ckeditor-
dev/blob/master/plugins/clipboard/plugin.js#L471-L472
I've fixed it and pushed changes to [https://github.com/cksource/ckeditor-
dev/commits/t/11970 t/11970].
--
Ticket URL: <http://dev.ckeditor.com/ticket/11970#comment:5>
Comment (by jbalinski):
I applied the fix that was committed and it appears to resolve the issue.
I've tested it out on IE8 and IE11.
--
Ticket URL: <http://dev.ckeditor.com/ticket/11970#comment:6>
* status: review => review_passed
* milestone: => CKEditor 4.4.4
Comment:
@pjasiun: Comment in the code must be added.
--
Ticket URL: <http://dev.ckeditor.com/ticket/11970#comment:7>
* status: review_passed => closed
* resolution: => fixed
Comment:
Comment added and ticket masterized (git:7c0da96).
--
Ticket URL: <http://dev.ckeditor.com/ticket/11970#comment:8>
Comment (by Henning):
Thanks a lot! We'll try when we update to >= 4.4.4
--
Ticket URL: <http://dev.ckeditor.com/ticket/11970#comment:9>