Does anyone know (or have an idea) of how to traverse all nodes in CKEditor's document tree?
I am basically trying to find if the user has created a certain element (e.g - text field, textarea, etc.).
Ideally, i am looking for a solution of the type:
CKEDITOR.instances['idoftextarea'].document.getElementsByTagName()
Thanks!
I am basically trying to find if the user has created a certain element (e.g - text field, textarea, etc.).
Ideally, i am looking for a solution of the type:
CKEDITOR.instances['idoftextarea'].document.getElementsByTagName()
Thanks!
Re: Traversing Nodes/Elements in CKEditor's Content
The above sometimes returns expected results. However, it seems as though the list property is slow in updating and b/c of this delay, this method does not return the correct results ALL the time.
Can anyone shed light on this?
Re: Traversing Nodes/Elements in CKEditor's Content
Basically, the Editor_Object() function returns a document object that will allow you to use the common getElementById() and getElementsByTagName() methods.
Useful Core Functions:
Examples:
All of the code should work but I may have made a mistake when copying from my library and script.
Let me know if anyone has issues and I would be more than happy to assist.
Re: Traversing Nodes/Elements in CKEditor's Content
Suppose you have an editor instance named "editor1". To get the CKEDITOR.dom.document object for the editing area:
Frederico Knabben
CKEditor Project Lead and CKSource Owner
--
Follow us on: Twitter | Facebook | Google+ | LinkedIn
Re: Traversing Nodes/Elements in CKEditor's Content
Re: Traversing Nodes/Elements in CKEditor's Content
I've been trying to use this to change some elements in the current document like this:
This finds the elements and changes them, so they appear different. The problem is, when clicking on the "Source code" button, i do not see any changes.. So i think, with editor.document.$ i get only the visual part of the document, the one beeing displayed. how can i traverse and change elements of the source code?
Re: Traversing Nodes/Elements in CKEditor's Content
Re: Traversing Nodes/Elements in CKEditor's Content