[ACCEPTED]-CKEditor .focus() in instanceReady event is not working-ckeditor
or maybe try this, this is much simpler:
use 1 startupFocus : true
so your code should look like this:
CKEDITOR.replace('editor1',
{
startupFocus : true,
...
here you go my friend
CKEDITOR.replace('editor1',
{
on :
{
instanceReady : function( ev )
{
CKEDITOR.instances.editor1.focus();
}
}
} );
or
CKEDITOR.replace('editor1',
{
on :
{
instanceReady : function( ev )
{
this.focus();
}
}
} );
0
CKEDITOR.instances['instance-name'].on('instanceReady', function (event) {
CKEDITOR.instances['instance-name'].focus();
});
0
a bit late but:
CKEDITOR.replace( 'YourEditor',
{
on:
{
instanceReady : function( evt )
{
//Set the focus to your editor
CKEDITOR.instances.YourEditor.focus();
}
}
}
works fine for me. Found 1 here
Best way to me,
- find the CKEditor instance, then
trigger focus event
The critical point is to focus instance in timeout
for (var 3 instance in CKEDITOR.instances) {
$timeout(function() { CKEDITOR.instances[instance].focus(); }); }
Note: I 2 found the instance with a for loop. You 1 may find better way to find the instance
Neither of the above answers worked for 2 me. Here is what I did for CHROME and it works 1 just fine:
CKEDITOR.instances['instance-name'].container.focus();
Dirty way (Make sure you read the comment 1 under my answer):
jQuery('.cke_wysiwyg_frame').contents().find('body').focus();
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.