views:

167

answers:

1

I have a navigation menu out side ckeditor and i want to navigate within the editor as all my element in editor have ids

scrollIntoView

how does this work

any example will be good

A: 

The information in this question (asked by myself some months ago) should get you started. The accepted answer outlines how to access elements inside the CKEditor document programmatically from JQUery.

It should be possible to fetch the desired element, and do a ScrollIntoView based on that.

This might already work (untested):

var documentWrapper = editorname.document; // replace by your CKEDitor instance ID
var documentNode = documentWrapper.$; // or documentWrapper['$'] ;
documentNode.getElementById("id").scrollIntoView(); // Insert your element ID there
Pekka
doent works mate
Ashish Mehra
What doesn't work? Where are you stuck? What error messages come up?
Pekka
documentNode.getElementById("e_data") is nulle_data is within the iframe of the editor and i am calling it from parent script
Ashish Mehra
Can you try `(editorname).document.getById()`?
Pekka
CKEDITOR.document.getById("e_data") is nullstill no luck
Ashish Mehra
Can focus() be used in any to assist in this problem or show().
Ashish Mehra
Are you 100% sure your editor instance is name CKEDITOR? What happens if you use the code in my answer, remove the last line, open a Firebug console and say `console.log(documentNode);`? Can you post the line with which you initialize the CKeditor?
Pekka
Regarding focus() or show(): No, you need to get hold of the element first
Pekka
ReferenceError: documentNode is not defined { message="documentNode is not defined", more...}
Ashish Mehra
works fine for CKEDITORconsole.log(CKEDITOR);Object { timestamp="99GE", more...}
Ashish Mehra
The console.log needs to be after when you create `documentNode` in the example above. And re CKEDITOR, that is *not necessarily* your *editor instance*. You need to access the variable name of your *editor instance*.
Pekka