Skip to content

Commit

Permalink
Merge branch 't/13397a'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Jul 10, 2015
2 parents 168ea63 + 1e654d1 commit fa71d86
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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. * [#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. * [#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). * [#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 ## CKEditor 4.5.1


Expand Down
5 changes: 5 additions & 0 deletions plugins/widget/plugin.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2416,6 +2416,11 @@
if ( Widget.isDomNestedEditable( el ) ) if ( Widget.isDomNestedEditable( el ) )
return; 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). // If element is nested editable, make sure widget can be dropped there (#12006).
var nestedEditable = Widget.getNestedEditable( editable, el ); var nestedEditable = Widget.getNestedEditable( editable, el );
if ( nestedEditable ) { if ( nestedEditable ) {
Expand Down
23 changes: 23 additions & 0 deletions tests/plugins/widget/dnd.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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() { 'test drag and drop - block widget into nested editable (ACF)': function() {
var editor = this.editor, var editor = this.editor,
html = '<div data-widget="testwidget2">' + html = '<div data-widget="testwidget2">' +
Expand Down
30 changes: 19 additions & 11 deletions tests/plugins/widget/manual/block.md
Original file line number Original file line Diff line number Diff line change
@@ -1,15 +1,23 @@
@bender-tags: widget @bender-tags: widget, 13397
@bender-ui: collapsed @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 @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). Add some widgets and nested widgets (use 'empty' icon for that).
Test block widgets features:
- create, ## Test block widgets:
- edit,
- select, * create,
- drag and drop, * edit,
- cut/copy and paste, * select,
- editing in nested editable, * drag and drop,
- remove, * cut/copy and paste,
- undo/redo, * editing in nested editable,
- switch multiple times between source and wysiwyg mode. * 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.