From f967266fd385746ab2803213166c2b9d683f15d9 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 10 Jul 2014 15:04:43 -0600 Subject: [PATCH] Really fix HTML text drag/drop on IE 10/11 Relying on default browser behavior produced erratic behavior, so handle the clipboard data ourselves. Also fix plaintext drag/drop on IE 9 --- imp/js/ckeditor/pasteattachment.js | 10 +++++++++- imp/js/draghandler.js | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/imp/js/ckeditor/pasteattachment.js b/imp/js/ckeditor/pasteattachment.js index f4aac943281..bdb471e0dde 100644 --- a/imp/js/ckeditor/pasteattachment.js +++ b/imp/js/ckeditor/pasteattachment.js @@ -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; } diff --git a/imp/js/draghandler.js b/imp/js/draghandler.js index 2d04bc05b31..f5563ee34d4 100644 --- a/imp/js/draghandler.js +++ b/imp/js/draghandler.js @@ -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':