Opened 9 years ago

Closed 9 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 9 years ago by maddyvora

Cc: maddy123.facebook@… added

comment:2 Changed 9 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

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:

CKEDITOR.instances.editor1.document.getBody()

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.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy