Reputation: 679
How to prevent or remove the extra stuff ckeditor is adding to my divs when doing inline editing.
When i load my page my div it looked like this:
<div contenteditable="true">
After i used ckeditor to edit the content in the div and used some ajax to save the content the save the edits the div looked like this:
<div contenteditable="true" class="cke_editable cke_editable_inline cke_contents_ltr" tabindex="0" spellcheck="false" style="position: relative; " role="textbox" aria-label="Rich Text Editor, editor1" title="Rich Text Editor, editor1" aria-describedby="cke_56">
Upvotes: 0
Views: 598
Reputation: 15895
You can't do this. These attributes are internal and required by CKEditor to run, identify elements, provide accessibility and fix bugs. They will be there until you call editor.destroy()
.
Additionally, your approach must be a little bit wrong since you have editor's container in your output. The correct way to get editor's data is:
CKEDITOR.instances.yourInstanceName.getData();
This will get all the content filtered and fixed. If you want to add your container to the output, use the following to determine tag name and concatenate strings manually:
var data = CKEDITOR.instances.yourInstanceName.getData(),
container = CKEDITOR.instances.yourInstanceName.container.getName();
console.log( '<' + container + '>' + data + '</' + container + '>' );
Upvotes: 1