Skip to content

Commit

Permalink
Really fix HTML text drag/drop on IE 10/11
Browse files Browse the repository at this point in the history
Relying on default browser behavior produced erratic behavior, so handle
the clipboard data ourselves.

Also fix plaintext drag/drop on IE 9
  • Loading branch information
slusarz committed Jul 10, 2014
1 parent 9b16b61 commit f2d5f7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 9 additions & 1 deletion imp/js/ckeditor/pasteattachment.js
Expand Up @@ -71,8 +71,16 @@ CKEDITOR.plugins.add('pasteattachment', {
fireEventInParent('drop', e2);

/* Only handle file data here. For other data (i.e. text)
* have the browser handle it natively. */
* have the browser handle it natively, except for IE -- it is
* buggy so grab the data from the dataTransfer object
* ourselves and insert. */
if (!DragHandler.isFileDrag(d)) {
if (Prototype.Browser.IE &&
d.dataTransfer.types &&
d.dataTransfer.types[0] === 'Text') {
editor.insertText(d.dataTransfer.getData('Text'));
e2.data.preventDefault();
}
return;
}

Expand Down
1 change: 0 additions & 1 deletion imp/js/draghandler.js
Expand Up @@ -31,7 +31,6 @@ var DragHandler = {
if (Prototype.Browser.IE &&
!(("onpropertychange" in document) && (!!window.matchMedia))) {
// IE 9 supports drag/drop, but not dataTransfer.files
e.stop();
} else {
switch (e.type) {
case 'dragleave':
Expand Down

0 comments on commit f2d5f7f

Please sign in to comment.