Click here to Skip to main content
15,895,283 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.

What I have tried:

JavaScript
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]);
}
Posted
Updated 29-May-20 3:04am
v2
Comments
Afzaal Ahmad Zeeshan 15-Feb-19 8:07am    
And the problem is?

1 solution

addCkeditorData = function(appendtext) {
		try {
			const viewFragment = ckEditor.data.processor.toView(appendtext);    
			const modelFragment = ckEditor.data.toModel(viewFragment);     
	        ckEditor.model.insertContent(modelFragment, ckEditor.model.document.selection);
	        } catch (error) {    
		    console.log("Error in AppendToCKEditor " + error);    
		    } 
	}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900