Skip to content
Permalink
Browse files

Merge branch 't/13397a'

  • Loading branch information
Reinmar committed Jul 10, 2015
2 parents 168ea63 + 1e654d1 commit fa71d865559d227b7fdeb16f164ad51045eeb108
Showing with 48 additions and 11 deletions.
  1. +1 −0 CHANGES.md
  2. +5 −0 plugins/widget/plugin.js
  3. +23 −0 tests/plugins/widget/dnd.js
  4. +19 −11 tests/plugins/widget/manual/block.md
@@ -15,6 +15,7 @@ Fixed Issues:
* [#13385](http://dev.ckeditor.com/ticket/13385): Fixed: [`editor.getSnapshot()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-getSnapshot) may return a non-string value.
* [#13422](http://dev.ckeditor.com/ticket/13422): Fixed: A monospaced font should be used in the `<textarea>` holding editor's config in the Toolbar Configurator.
* [#11616](http://dev.ckeditor.com/ticket/11616): [Chrome] Fixed: Resizing the editor while it's not displayed breaks the editable. Fixed also [#9160](http://dev.ckeditor.com/ticket/9160) and [#9715](http://dev.ckeditor.com/ticket/9715).
* [#13397](http://dev.ckeditor.com/ticket/13397): Fixed: Drag&drop a widget inside its nested widget crashes the editor.

## CKEditor 4.5.1

@@ -2416,6 +2416,11 @@
if ( Widget.isDomNestedEditable( el ) )
return;

// Do not allow droping inside the widget being dragged (#13397).
if ( widgetsRepo._.draggedWidget.wrapper.contains( el ) ) {
return;
}

// If element is nested editable, make sure widget can be dropped there (#12006).
var nestedEditable = Widget.getNestedEditable( editable, el );
if ( nestedEditable ) {
@@ -482,6 +482,29 @@
} );
},

'test drag and drop - block widget into widget in nested editable': function() {
var editor = this.editor,
html = '<div data-widget="testwidget4" id="w4">' +
'<div class="n1">' +
'<div data-widget="testwidget4" id="w4a">' +
'<div class="n1">' +
'<p>x</p>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';

this.editorBot.setData( html, function() {
var repo = editor.widgets,
finder = repo.finder;

repo._.draggedWidget = getWidgetById( editor, 'w4' );
finder.greedySearch();

assertRelations( editor, finder, '|<div data-widget="testwidget4" id="w4"><div class="n1"><div data-widget="testwidget4" id="w4a"><div class="n1"><p>x</p></div></div></div></div>|' );
} );
},

'test drag and drop - block widget into nested editable (ACF)': function() {
var editor = this.editor,
html = '<div data-widget="testwidget2">' +
@@ -1,15 +1,23 @@
@bender-tags: widget
@bender-tags: widget, 13397
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea, toolbar, sourcearea, table, undo, indent, justify, clipboard, floatingspace, basicstyles, image2, codesnippet, link, elementspath, blockquote, format, htmlwriter, list, maximize

Add some widgets and nested widgets (use 'empty' icon for that).
Test block widgets features:
- create,
- edit,
- select,
- drag and drop,
- cut/copy and paste,
- editing in nested editable,
- remove,
- undo/redo,
- switch multiple times between source and wysiwyg mode.

## Test block widgets:

* create,
* edit,
* select,
* drag and drop,
* cut/copy and paste,
* editing in nested editable,
* remove,
* undo/redo,
* switch multiple times between source and wysiwyg mode.

## Edge cases:

* DnD inside its child:
1. Create a doublecolumn widget containing another doublecolumn widget('empty' icon).
1. Try to drag the outer widget into the inner widget. Should not be possible.

0 comments on commit fa71d86

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