Skip to content

Commit

Permalink
Merge branch 't/13129'
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Jul 6, 2015
2 parents 9d62060 + 89c1cc7 commit 507dd19
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -7,6 +7,7 @@ Fixed Issues:

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

## CKEditor 4.5.1

Expand Down
6 changes: 0 additions & 6 deletions plugins/widget/plugin.js
Expand Up @@ -3234,12 +3234,6 @@
// and save this state as the one where we want to be taken back when undoing.
this.focus();

// Reset the fake selection, which will be invalidated by insertElementIntoRange.
// This avoids a situation when getSelection() still returns a fake selection made
// on widget which in the meantime has been moved to other place. That could cause
// an error thrown e.g. by saveSnapshot or stateUpdater.
editor.getSelection().reset();

// Drag range will be set in the drop listener.
editor.fire( 'drop', {
dropRange: dropRange,
Expand Down
11 changes: 10 additions & 1 deletion tests/plugins/widget/dnd.js
Expand Up @@ -448,6 +448,9 @@
editor.focus();

try {
// Testing if widget is selected is meaningful only if it is not selected at the beginning. (#13129)
assert.isNull( editor.widgets.focused, 'widget not focused before mousedown' );

img.fire( 'mousedown' );

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

editor.document.fire( 'mouseup' );

assert.areSame( widget, editor.widgets.focused, 'widget focused after mouseup' );

bender.tools.resumeAfter( editor, 'afterPaste', function() {
assert.isTrue( pasteCounter.calledOnce, 'paste called once' );
assert.isTrue( dragstartCounter.calledOnce, 'dragstart called once' );
assert.isTrue( dragendCounter.calledOnce, 'dragend called once' );
assert.isTrue( dropCounter.calledOnce, 'drop called once' );
assert.areSame( '<div data-widget="testwidget" id="w1">bar</div><p id="a">foo</p>', editor.getData(), 'Widget moved on drop.' );

// Check if widget is still selected after undo. (#13129)
editor.execCommand( 'undo' );
assert.areSame( getWidgetById( editor, 'w1' ), editor.widgets.focused, 'widget focused after undo' );
} );

wait();
Expand Down Expand Up @@ -541,4 +550,4 @@
} );
}
} );
} )();
} )();

0 comments on commit 507dd19

Please sign in to comment.