Skip to content

Commit 507dd19

Browse files
committed
Merge branch 't/13129'
2 parents 9d62060 + 89c1cc7 commit 507dd19

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Fixed Issues:
77

88
* [#13434](http://dev.ckeditor.com/ticket/13434): Fixed: Dialog state indicator broken in Right–To–Left environments.
99
* [#13434](http://dev.ckeditor.com/ticket/13434): [IE8-9] Fixed: One drag&drop operation may affect following ones.
10+
* [#13129](http://dev.ckeditor.com/ticket/13129) Fixed: Block widget blurred after drop followed by undo.
1011

1112
## CKEditor 4.5.1
1213

plugins/widget/plugin.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3234,12 +3234,6 @@
32343234
// and save this state as the one where we want to be taken back when undoing.
32353235
this.focus();
32363236

3237-
// Reset the fake selection, which will be invalidated by insertElementIntoRange.
3238-
// This avoids a situation when getSelection() still returns a fake selection made
3239-
// on widget which in the meantime has been moved to other place. That could cause
3240-
// an error thrown e.g. by saveSnapshot or stateUpdater.
3241-
editor.getSelection().reset();
3242-
32433237
// Drag range will be set in the drop listener.
32443238
editor.fire( 'drop', {
32453239
dropRange: dropRange,

tests/plugins/widget/dnd.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@
448448
editor.focus();
449449

450450
try {
451+
// Testing if widget is selected is meaningful only if it is not selected at the beginning. (#13129)
452+
assert.isNull( editor.widgets.focused, 'widget not focused before mousedown' );
453+
451454
img.fire( 'mousedown' );
452455

453456
// Create dummy line and pretend it's visible to cheat drop listener
@@ -456,12 +459,18 @@
456459

457460
editor.document.fire( 'mouseup' );
458461

462+
assert.areSame( widget, editor.widgets.focused, 'widget focused after mouseup' );
463+
459464
bender.tools.resumeAfter( editor, 'afterPaste', function() {
460465
assert.isTrue( pasteCounter.calledOnce, 'paste called once' );
461466
assert.isTrue( dragstartCounter.calledOnce, 'dragstart called once' );
462467
assert.isTrue( dragendCounter.calledOnce, 'dragend called once' );
463468
assert.isTrue( dropCounter.calledOnce, 'drop called once' );
464469
assert.areSame( '<div data-widget="testwidget" id="w1">bar</div><p id="a">foo</p>', editor.getData(), 'Widget moved on drop.' );
470+
471+
// Check if widget is still selected after undo. (#13129)
472+
editor.execCommand( 'undo' );
473+
assert.areSame( getWidgetById( editor, 'w1' ), editor.widgets.focused, 'widget focused after undo' );
465474
} );
466475

467476
wait();
@@ -541,4 +550,4 @@
541550
} );
542551
}
543552
} );
544-
} )();
553+
} )();

0 commit comments

Comments
 (0)