Opened 9 years ago
Closed 9 years ago
#13397 closed Bug (fixed)
D&D a widget inside its nested widget removes that widget
Reported by: | Szymon Cofalik | Owned by: | Tade0 |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 4.5.2 |
Component: | General | Version: | 4.5.0 |
Keywords: | Cc: |
Description
When you create a widget inside a widget and then try to drag and drop the upper widget into the nested one, console reports an error and the whole structure disappears from editor.
Widget`s definition to use when reproducing:
CKEDITOR.plugins.add( 'mywidget', { requires: 'widget', init: function( editor ) { editor.widgets.add('widgetCast', { button: 'Create mywidget', template: '<div class="row layout-row">\ <div class="c1" style="padding:10px;border:1px dashed black;float:left;width:100%;box-sizing:border-box;">\ <p></p>\ </div>\ </div>', upcast: function(element) { return (element.name == 'div' && element.hasClass('layout-row')); }, editables: { c1: { selector: '.c1' } } }); } } );
(extra styling for easier reproduction).
Steps to reproduce:
- Create instance of mywidget.
- Create another instance of mywidget into previously created one.
- Select the first instance.
- Drag and drop it into nested instance.
Result: Both widgets disappear.
Expected result: Dropping a widget inside itself should not be possible and there should be no helping line when trying to do so.
Change History (10)
comment:1 Changed 9 years ago by
Status: | new → confirmed |
---|
comment:2 Changed 9 years ago by
comment:3 Changed 9 years ago by
Owner: | set to Tade0 |
---|---|
Status: | confirmed → assigned |
comment:5 Changed 9 years ago by
How is this place different from others in which we do early return that you cancel the event only in this single place?
comment:6 Changed 9 years ago by
As we agreed during live discussion, this issue should be fixed even before this code is executed. Line utils should not display (and handle) drop locations inside a widget being dragged. This is the minimal fix which is enough for now.
In the future, when perhaps inline widgets will be given support for nested editables, that condition which was added in editor#drop will make sense. But for now it's unnecessary as long as line utils is properly configured.
comment:7 Changed 9 years ago by
Status: | review → review_failed |
---|
comment:10 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | review → closed |
Summary: | D&D a widget inside it's nested widget removes that widget. → D&D a widget inside its nested widget removes that widget |
Fixed on master with git:fa71d86.
You can reproduce this issue under: http://tests.ckeditor.dev:1030/tests/plugins/widget/manual/block