简体   繁体   中英

clear CKEditor style tags

I am building a page creation tool that uses CKEditor's inline editor to allow copy changes etc. The page being edited is the actual page that will later be displayed, not just editable areas within a form. I grab the contents of this page and save it off. My problem is removing all the CKEditor tags and attributes from the saved copy so they don't show when viewed by the end user. I have used PHP's DomDoc to clear out elements etc but I am still left with a pile of attributes on each of the editable areas. eg

<h1 contenteditable="true" class="cke_editable cke_editable_inline cke_contents_ltr cke_show_borders" tabindex="0" spellcheck="false" role="textbox" aria-label="Rich Text Editor, editor1" title="Rich Text Editor, editor1" aria-describedby="cke_75" style="position: relative;">

My question: Does CKEditor provide a JS method that would clean up all the data it has added? Or is there a different approach to this?

I have already tried the destroy() method, but that only disables the editing capabilities.

Resolved: The destroy() method worked. It appears I had an issue elsewhere that prevented it firing correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM