Skip to content

Commit 184dc7f

Browse files
committed
Merge branch 't/12300'
2 parents ddffe68 + ef50930 commit 184dc7f

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Fixed Issues:
1414
* [#11647](http://dev.ckeditor.com/ticket/11647): Fixed: The [`editor.blur`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-blur) event is not fired on first blur after initializing the inline editor on already focused element.
1515
* [#12601](http://dev.ckeditor.com/ticket/12601): Fixed: [Strikethrough](http://ckeditor.com/addon/basicstyles) button tooltip spelling.
1616
* [#12546](http://dev.ckeditor.com/ticket/12546): Fixed: Preview tab in docprops dialog is always disabled.
17+
* [#12300](http://dev.ckeditor.com/ticket/12300): Fixed: The [`editor.change`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-change) event fired on first navigation key press after typing.
1718

1819
Other Changes:
1920
* [#12550](http://dev.ckeditor.com/ticket/12550): Added CKEDITOR.dtd.main.

plugins/undo/plugin.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@
343343
*
344344
* @param {Boolean} onContentOnly If set to `true`, the snapshot will be saved only if the content has changed.
345345
* @param {CKEDITOR.plugins.undo.Image} image An optional image to save. If skipped, current editor will be used.
346-
* @param {Boolean} autoFireChange If set to `false`, will not trigger the {@link CKEDITOR.editor#change} event to editor.
346+
* @param {Boolean} [autoFireChange=true] If set to `false`, will not trigger the {@link CKEDITOR.editor#change} event to editor.
347347
*/
348348
save: function( onContentOnly, image, autoFireChange ) {
349349
var editor = this.editor;
@@ -946,7 +946,9 @@
946946
if ( UndoManager.isNavigationKey( keyCode ) || this.undoManager.keyGroupChanged( keyCode ) ) {
947947
if ( undoManager.strokesRecorded[ 0 ] || undoManager.strokesRecorded[ 1 ] ) {
948948
// We already have image, so we'd like to reuse it.
949-
undoManager.save( false, this.lastKeydownImage );
949+
950+
// #12300
951+
undoManager.save( false, this.lastKeydownImage, false );
950952
undoManager.resetType();
951953
}
952954
}

tests/plugins/undo/change.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,25 @@
161161
} );
162162
textNode.setText( 'foo' );
163163
} );
164+
},
165+
166+
// #12300
167+
'test change event not fired after navigation key': function() {
168+
this.editorBot.setHtmlWithSelection( '<p>foo^</p>' );
169+
170+
var textNode = this.editor.editable().getFirst().getFirst(),
171+
keyTools = this.keyTools,
172+
keyCodesEnum = keyTools.keyCodesEnum;
173+
174+
this.checkChange( function() {
175+
keyTools.keyEvent( keyCodesEnum.KEY_D, null, null, function() {
176+
// Textnode change required by IE.
177+
textNode.setText( 'food' );
178+
} );
179+
180+
// After setting text - caret is moved to beginning. We don't care - it does not change nothing.
181+
keyTools.keyEvent( keyCodesEnum.LEFT, null, true );
182+
} );
164183
}
165184
} );
166185

0 commit comments

Comments
 (0)