Skip to content

Commit

Permalink
Merge branch 't/12300'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Nov 5, 2014
2 parents ddffe68 + ef50930 commit 184dc7f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -14,6 +14,7 @@ Fixed Issues:
* [#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.
* [#12601](http://dev.ckeditor.com/ticket/12601): Fixed: [Strikethrough](http://ckeditor.com/addon/basicstyles) button tooltip spelling.
* [#12546](http://dev.ckeditor.com/ticket/12546): Fixed: Preview tab in docprops dialog is always disabled.
* [#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.

Other Changes:
* [#12550](http://dev.ckeditor.com/ticket/12550): Added CKEDITOR.dtd.main.
Expand Down
6 changes: 4 additions & 2 deletions plugins/undo/plugin.js
Expand Up @@ -343,7 +343,7 @@
*
* @param {Boolean} onContentOnly If set to `true`, the snapshot will be saved only if the content has changed.
* @param {CKEDITOR.plugins.undo.Image} image An optional image to save. If skipped, current editor will be used.
* @param {Boolean} autoFireChange If set to `false`, will not trigger the {@link CKEDITOR.editor#change} event to editor.
* @param {Boolean} [autoFireChange=true] If set to `false`, will not trigger the {@link CKEDITOR.editor#change} event to editor.
*/
save: function( onContentOnly, image, autoFireChange ) {
var editor = this.editor;
Expand Down Expand Up @@ -946,7 +946,9 @@
if ( UndoManager.isNavigationKey( keyCode ) || this.undoManager.keyGroupChanged( keyCode ) ) {
if ( undoManager.strokesRecorded[ 0 ] || undoManager.strokesRecorded[ 1 ] ) {
// We already have image, so we'd like to reuse it.
undoManager.save( false, this.lastKeydownImage );

// #12300
undoManager.save( false, this.lastKeydownImage, false );
undoManager.resetType();
}
}
Expand Down
19 changes: 19 additions & 0 deletions tests/plugins/undo/change.js
Expand Up @@ -161,6 +161,25 @@
} );
textNode.setText( 'foo' );
} );
},

// #12300
'test change event not fired after navigation key': function() {
this.editorBot.setHtmlWithSelection( '<p>foo^</p>' );

var textNode = this.editor.editable().getFirst().getFirst(),
keyTools = this.keyTools,
keyCodesEnum = keyTools.keyCodesEnum;

this.checkChange( function() {
keyTools.keyEvent( keyCodesEnum.KEY_D, null, null, function() {
// Textnode change required by IE.
textNode.setText( 'food' );
} );

// After setting text - caret is moved to beginning. We don't care - it does not change nothing.
keyTools.keyEvent( keyCodesEnum.LEFT, null, true );
} );
}
} );

Expand Down

0 comments on commit 184dc7f

Please sign in to comment.