Yogendra Sahu

Yogendra Sahu

  • 1.6k
  • 398
  • 105k

ckEditors Autofocus

Mar 5 2019 5:17 AM
How do I to set cursor position in the selected ckeditor by providing id to the ckeditors list?
 
I am having 7 ckeditor in my page and a side menu containing the name/title provided to the ckeditor.I want to set the cursor/setfocus to the selected ckeditor by clicking the title/name of the ckeditor from side menu.
 
I have used the following:
 
Code 1:
 
//Giving error : scrollIntoView is not a function
var element = editor.document.getById('id');
var range;
if(element)
{
element.scrollIntoView();
range = editor.createRange();
range.moveToPosition(element, CKEDITOR.POSITION_AFTER_START);
editor.getSelection().selectRanges([range]);
}
 
Code 2:
 
onReady(event: any) //giving error : cannot read property focus of undefined
{
setTimeout(() => event.editor.focus(), 1000);
}
 
please help me out with this

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (2)