Permalink
Browse files

Merge branch 't/16825' into major

  • Loading branch information...
mlewand committed Mar 16, 2017
2 parents 3eb1f7d + e977e2a commit 33bd6288af5ca36ff9ca6fc0b95599a2db100706
View
@@ -11,6 +11,7 @@ New Features:
Fixed Issues:
* [#16825](http://dev.ckeditor.com/ticket/16825): Fixed: [Chrome] Error thrown when destroying focused inline editor.
* [#16857](http://dev.ckeditor.com/ticket/16857): Fixed: Ctrl + Shift + V blocked by copy formatting.
* [#14714](http://dev.ckeditor.com/ticket/14714): [Webkit/Blink] Fixed: Exception thrown on refocusing a blurred inline editor.
* [#16821](http://dev.ckeditor.com/ticket/16821): Fixed: Extraneous `spans` with `height` style stacked when [pasting from Word](http://ckeditor.com/addon/pastefromword).
View
@@ -147,8 +147,9 @@
* @member CKEDITOR.focusManager
*/
blur: function( noDelay ) {
if ( this._.locked )
if ( this._.locked ) {
return;
}
function doBlur() {
var editor = this._.editor;
@@ -157,8 +158,9 @@
this.hasFocus = false;
// Blink browsers leave selection in `[contenteditable=true]`
// when it's blurred and it's neccessary to remove it manually for inline editor. (#13446)
if ( CKEDITOR.env.chrome && editor.editable().isInline() ) {
// when it's blurred and it's necessary to remove it manually for inline editor. (#13446)
// It seems to be related to https://bugs.chromium.org/p/chromium/issues/detail?id=433303.
if ( CKEDITOR.env.chrome && editor.editable() && editor.editable().isInline() ) {
editor.window.$.getSelection().removeAllRanges();
}
@@ -168,13 +170,14 @@
}
}
if ( this._.timer )
if ( this._.timer ) {
clearTimeout( this._.timer );
}
var delay = CKEDITOR.focusManager._.blurDelay;
if ( noDelay || !delay )
if ( noDelay || !delay ) {
doBlur.call( this );
else {
} else {
this._.timer = CKEDITOR.tools.setTimeout( function() {
delete this._.timer;
doBlur.call( this );
@@ -0,0 +1 @@
<div id="focused"></div>
@@ -1,10 +1,13 @@
/* bender-tags: editor,unit */
/* bender-ckeditor-plugins: toolbar,button,stylescombo */
/* bender-ckeditor-plugins: toolbar,button,stylescombo,wysiwygarea */
bender.editor = true;
bender.editor = {
config: {
startupFocus: true
}
};
bender.test(
{
bender.test( {
'test destroy editor with rich combo panel opened': function() {
var bot = this.editorBot, editor = this.editor;
bot.combo( 'Styles', function( combo ) {
@@ -58,5 +61,24 @@ bender.test(
'CKEDITOR.warn error code should be "editor-incorrect-destroy".' );
}, 0 );
},
'test check editable existence on blur': function() {
CKEDITOR.replace( 'focused', {
on: {
instanceReady: function( evt ) {
resume( function() {
var editor = evt.sender;
// Simulate the circumstances instead of creating them.
editor.focusManager.hasFocus = true;
sinon.stub( editor, 'editable' ).returns( null );
editor.focusManager.blur( 1 );
assert.pass();
} );
}
}
} );
wait();
}
} );
@@ -0,0 +1,18 @@
<textarea name="editor1" id="editor1" cols="30" rows="10">
</textarea>
<script>
if ( !CKEDITOR.env.chrome ) {
bender.ignore();
}
var editor = CKEDITOR.replace( 'editor1', {
on: {
instanceReady: function() {
editor.editable().on( 'keydown', function() {
editor.focusManager.blur();
editor.destroy();
} );
}
}
} );
</script>
@@ -0,0 +1,14 @@
@bender-tags: tc, 4.7.0, 16825,
@bender-ui: collapsed
@bender-ckeditor-plugins: toolbar, wysiwygarea, about, elementspath
1. Focus the editor.
1. Press any printable key.
## Expected
Editor gets blurred, destroyed and there are no errors in the console.
## Unexpected
There is a `Cannot read property 'isInline' of null` error in the console.

0 comments on commit 33bd628

Please sign in to comment.