Skip to content

Commit

Permalink
Merge branch 't/13472b' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Jasiun committed Jun 29, 2015
2 parents 5938865 + 64255c9 commit 6beaee9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
14 changes: 7 additions & 7 deletions plugins/clipboard/plugin.js
Expand Up @@ -1724,11 +1724,6 @@
* @returns {CKEDITOR.dom.range} range at drop position.
*/
getRangeAtDropPosition: function( dropEvt, editor ) {
// If we drop content from the external source we need to call focus on IE.
if ( CKEDITOR.env.ie ) {
editor.focus();
}

var $evt = dropEvt.data.$,
x = $evt.clientX,
y = $evt.clientY,
Expand All @@ -1752,13 +1747,18 @@
range.collapse( true );
}
// IEs 9+.
else if ( CKEDITOR.env.ie && CKEDITOR.env.version > 8 && defaultRange ) {
// We check if editable is focused to make sure that it's an internal DnD. External DnD must use the second
// mechanism because of http://dev.ckeditor.com/ticket/13472#comment:6.
else if ( CKEDITOR.env.ie && CKEDITOR.env.version > 8 && defaultRange && editor.editable().hasFocus ) {
// On IE 9+ range by default is where we expected it.
// defaultRange may be undefined if dragover was canceled (file drop).
return defaultRange;
}
// IE 8 and all IEs if !defaultRange.
// IE 8 and all IEs if !defaultRange or external DnD.
else if ( document.body.createTextRange ) {
// To use this method we need a focus (which may be somewhere else in case of external drop).
editor.focus();

$range = editor.document.getBody().$.createTextRange();
try {
var sucess = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/clipboard/manual/draganddrop.html
Expand Up @@ -13,7 +13,7 @@ <h2>Helpers (<a href="javascript:hideshow('helpers');">hide/show</a>)</h2>
<div id="helpers">
<textarea style="width:49%; height:50px; float: left;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In commodo vulputate tempor. Sed <b>at</b> elit.</textarea>
<div style="width:49%; height:50px; float: right;">
Lorem ipsum <b>dolor</b> sit <i>amet</i>, consectetur adipiscing elit. In commodo vulputate tempor. Sed &lt;b&gt;at elit&lt;/b&gt; vel ligula mollis aliquet a ac odio.
Lorem ipsum <b>dolor</b> sit <i>amet</i>, consectetur adipiscing elit. <img height="20" alt="CKEditor logo" src="%BASE_PATH%_assets/logo.png" /> In commodo vulputate tempor. Sed &lt;b&gt;at elit&lt;/b&gt; vel <a href="foo">ligula mollis</a> aliquet a ac odio.
<pre>
Aenean cursus egestas ipsum.
</pre>
Expand Down
4 changes: 3 additions & 1 deletion tests/plugins/clipboard/manual/draganddrop.md
Expand Up @@ -7,7 +7,9 @@

Expected behavior:
------------------
* proper drop position,
* proper drop position (**IMPORTANT**):
* check this carefully,
* make sure to try more than once ([#13472](http://dev.ckeditor.com/ticket/13472)),
* in the internal and cross editor D&D: dragged content should be removed,
* no content lost (e.g. ids of anchors),
* paste event should be fired,
Expand Down

0 comments on commit 6beaee9

Please sign in to comment.