Skip to content

Commit

Permalink
Merge branch 't/11647'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Oct 8, 2014
2 parents af4a784 + e43777f commit 1794e56
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -11,6 +11,7 @@ Fixed Issues:

* [#12506](http://dev.ckeditor.com/ticket/12506): [Safari] Fixed: Can't paste into inline editor if page has `user-select: none` style. Thanks to [shaohua](https://github.com/shaohua)!
* [#12489](http://dev.ckeditor.com/ticket/12423) and [#12491](http://dev.ckeditor.com/ticket/12423): Fixed: Various issues related to restoring selection after making operations on filler char. See the [fixed cases](http://dev.ckeditor.com/ticket/12491#comment:4).
* [#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.

## CKEditor 4.4.5

Expand Down
4 changes: 2 additions & 2 deletions core/editable.js
Expand Up @@ -575,8 +575,8 @@
this.hasFocus = true;
// Pending until this editable has attached.
editor.once( 'contentDom', function() {
editor.focusManager.focus();
} );
editor.focusManager.focus( this );
}, this );
}

// Apply tab index on demand, with original direction saved.
Expand Down
35 changes: 35 additions & 0 deletions tests/core/focusManager/editor.js
Expand Up @@ -54,6 +54,41 @@ bender.test(
var ed = this.editor, bot = this.editorBot;
bot.execCommand( 'toolbarFocus' );
this.assertFocus();
},

// #11647
'test inheriting the initial focus': function() {
var el = CKEDITOR.document.createElement( 'div' );
CKEDITOR.document.getBody().append( el );
el.setAttribute( 'contenteditable', true );
el.focus();

var editor = CKEDITOR.inline( el ),
focusWasFired = 0;

editor.on( 'focus', function() {
focusWasFired += 1;
} );

editor.on( 'instanceReady', function() {
resume( function() {
assert.isTrue( editor.focusManager.hasFocus, 'hasFocus after init' );
assert.areSame( editor.editable(), editor.focusManager.currentActive, 'currentActive after init' );
assert.areSame( 1, focusWasFired, 'focus event was fired once' );

editor.on( 'blur', function() {
resume( function() {
assert.isFalse( editor.focusManager.hasFocus, 'hasFocus after destroy' );
editor.destroy();
} );
} );

CKEDITOR.document.getById( 'focusable' ).focus();
wait();
} );
} );

wait();
}

} );

0 comments on commit 1794e56

Please sign in to comment.