Skip to content
Permalink
Browse files

Merge branch 't/12321'

  • Loading branch information...
mlewand committed Aug 19, 2014
2 parents 26dd8f0 + 47fef4e commit 67f620b8c2ef7d37cc4a19030b1281d1256cf740
Showing with 27 additions and 4 deletions.
  1. +11 −3 plugins/undo/plugin.js
  2. +16 −1 tests/plugins/undo/change.js
@@ -897,9 +897,17 @@
editor = undoManager.editor,
ieFunctionKeysWorkaround = CKEDITOR.env.ie && keyCode in backspaceOrDelete;

// IE: backspace/del would still call keypress event, even if nothing was removed.
if ( ieFunctionKeysWorkaround && this.lastKeydownImage.equalsContent( new Image( editor, true ) ) ) {
return;
// IE: doesn't call keypress for backspace/del keys so we need to handle it manually
// with a workaround.
if ( ieFunctionKeysWorkaround ) {
if ( this.lastKeydownImage.equalsContent( new Image( editor, true ) ) ) {
// Content was not changed, we don't need to do anything.
return;
} else {
// Content was changed. And since no keypress event was fired, we have
// inputFired = 0, so undoManager.type method will not be called.
inputFired += 1;
}
}

if ( inputFired > 0 ) {
@@ -39,6 +39,13 @@
}
},

_should: {
ignore: {
'test backspace': CKEDITOR.env.ie,
'test IE backspace': !CKEDITOR.env.ie
}
},

'test setData': function() {
bender.editor.focus();

@@ -124,10 +131,18 @@

'test backspace': function() {
// IE: In case of backspace and delete we need to make real change to DOM content.
var that = this;
this.checkChange( function( editor ) {
that.keyTools.keyEvent( 8 /* backspace */ );
} );
},

'test IE backspace': function() {
// IE doesn't send keypress event, which is used as a `input` event.
var that = this,
textNode = this.editor.editable().getFirst().getFirst();
this.checkChange( function( editor ) {
that.keyTools.keyEvent( 8 /* backspace */, null, null, function( e ) {
that.keyTools.keyEvent( 8 /* backspace */, null, true, function( e ) {
textNode.setText( 'fo' );
} );
textNode.setText( 'foo' );

0 comments on commit 67f620b

Please sign in to comment.
You can’t perform that action at this time.