Skip to content
Permalink
Browse files

Merge branch 't/13465b'

  • Loading branch information...
Reinmar committed Aug 10, 2015
2 parents 9bbeddb + 48d9a75 commit b32d85d94eb336f62c8a625839debe8c8d1034ff
Showing with 53 additions and 3 deletions.
  1. +1 −0 CHANGES.md
  2. +24 −1 core/editable.js
  3. +12 −2 tests/core/editable/getextracthtmlfromrange.js
  4. +7 −0 tests/tickets/13465/1.html
  5. +9 −0 tests/tickets/13465/1.md
@@ -12,6 +12,7 @@ Fixed Issues:
* [#13386](http://dev.ckeditor.com/ticket/13386): [Edge] Fixed: Issues with selecting and editing images.
* [#13568](http://dev.ckeditor.com/ticket/13568): Fixed: Method [`editor.getSelectedHtml()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-getSelectedHtml) returns invalid results for entire content selection.
* [#13453](http://dev.ckeditor.com/ticket/13453): Fixed: Drag&drop of a whole content of the editor throws an error.
* [#13465](http://dev.ckeditor.com/ticket/13465): Fixed: Error is thrown and widget is lost when drag&drop if it is the only content of the editor.

Other Changes:

@@ -744,7 +744,13 @@
var path = range.startPath();

// <p><b>^</b></p> is empty block.
if ( range.checkStartOfBlock() && range.checkEndOfBlock() && path.block && !range.root.equals( path.block ) ) {
if (
range.checkStartOfBlock() &&
range.checkEndOfBlock() &&
path.block &&
!range.root.equals( path.block ) &&
// Do not remove a block with bookmarks. (#13465)
!hasBookmarks( path.block ) ) {
range.moveToPosition( path.block, CKEDITOR.POSITION_BEFORE_START );
path.block.remove();
}
@@ -1405,6 +1411,23 @@
};
}

function hasBookmarks( element ) {
// We use getElementsByTag() instead of find() to retain compatibility with IE quirks mode.
var potentialBookmarks = element.getElementsByTag( 'span' ),
i = 0,
child;

if ( potentialBookmarks ) {
while ( ( child = potentialBookmarks.getItem( i++ ) ) ) {
if ( !isNotBookmark( child ) ) {
return true;
}
}
}

return false;
}

// Check if the entire table/list contents is selected.
function getSelectedTableList( sel ) {
var selected,
@@ -1,4 +1,4 @@
/* bender-tags: editor,unit,range */
/* bender-tags: editor,unit,range,13465 */

( function() {
'use strict';
@@ -369,7 +369,17 @@
[ '<p>a</p><p>[<b>b</b>]</p><p>c</p>', '<b>b</b>', '<p>a</p><p>c</p>' ],
[ '<p>a</p><p><b>[b]</b></p><p>c</p>', '<b>b</b>', '<p>a</p><p>c</p>' ],
[ '<p>a[b]c</p>', 'b', '<p>ac</p>' ],
[ '<table><tbody><tr><td>{a</td><td>b}</td></tr></tbody></table>', '<table><tbody><tr><td>a</td><td>b</td></tr></tbody></table>', '' ]
[ '<table><tbody><tr><td>{a</td><td>b}</td></tr></tbody></table>', '<table><tbody><tr><td>a</td><td>b</td></tr></tbody></table>', '' ],
// #13465
[
'<p>[<span>foo</span>]<span data-cke-bookmark="1">&nbsp;</span></p>',
'<span>foo</span>',
'<p><span data-cke-bookmark="1">&nbsp;</span></p>'
],
// #13465
[ '<p>a</p><p><span class="foo">{b}</span></p><p>c</p>', '<span class="foo">b</span>', '<p>a</p><p>c</p>' ],
// #13465
[ '<p>a</p><p><b>{b}</b><span class="foo"></span></p><p>c</p>', '<b>b</b>', '<p>a</p><p>c</p>' ]
]
}, 'inline', 1 );

@@ -0,0 +1,7 @@
<div id="editor">
<p>[[foobar]]</p>
</div>

<script>
CKEDITOR.replace( 'editor' );
</script>
@@ -0,0 +1,9 @@
@bender-ui: collapsed
@bender-tags: 4.5.3, tc, widget, 13465
@bender-ckeditor-plugins: wysiwygarea, toolbar, placeholder

1. Drag the placeholder after or before itself.

Expected: Nothing should happen. Placeholder should be left untouched.

Unexpected: Placeholder is lost. Error is thrown.

0 comments on commit b32d85d

Please sign in to comment.
You can’t perform that action at this time.