Opened 14 years ago
Closed 14 years ago
#7892 closed Bug (invalid)
Remove Html Entities
Reported by: | maddyvora | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | Cc: | maddy123.facebook@… |
Description
I am trying to Get Plain Text from Ckeditor from last 2 days. but i cant get it. its also contain html Tags and its value. i want to remove all spaces and used trim value.
Change History (2)
comment:1 Changed 14 years ago by
Cc: | maddy123.facebook@… added |
---|
comment:2 Changed 14 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
First of all this is not a bug!!**
If you are looking for advice please use one of our forums http://cksource.com/forums
Editing area in CKEditor is HTML document. You need to walk the DOM tree and get all the textNodes values.
Walk through DOM method can be found here: http://stackoverflow.com/questions/3677228/dom-traversal-one-by-one-node-using-jquery
You will need to change some classic JS DOM properties to CKEditor functions. Those two classes:
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.node.html
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.element.html
and a piece of code to get the body:
is all you need.
One more thing: A knowledge about node types (http://www.javascriptkit.com/domref/nodetype.shtml) is also needed. Text nodes are represented by number 3 but watch out the functions like getNext() or getFirst() are not applicable for these types of nodes so keep that in mind when changing a function.