0

I'm using CKEditor, and all works well when getting data from it and setting data to it except form some of the HTML tags. When a comment is saved from the editor all the HTML for the styling of the comment comes through and is saved to the database intact. when I then load that same comment back into the editor, some of the style does not load, although it is in the HTML being set to the editor.

Example: From the editor on getdata() for the save

    <p>This is a test with the new editor <strong><span style=&quot;background-color:#FF0000&quot;>This is a test edit with teh new editor</span></strong><br />

 

That's all good, now when I load that same data back in to the editor, it shows the effect of the tags but not the background color tags. With no editing at all, if I do a getdata() at this point I now get:

    <p>This is a test with the new editor <strong>This is a test edit with teh new editor</strong><br />

 

as you can see the color has been removed completely! It seems to be stripped out on the setdata(). Is this a bug or am I missing something, I obviously can't be the 1st person to try to load styled text into the editor that the editor created.

EDIT: Data coming from server to load into the editor:

    <p>This is a test with the new editor <strong><span style=&quot;background-color:#FF0000&quot;>This is a test edit with teh new editor</span></strong><br />

 

Norst
  • 23
  • 6
  • Did you try to debug your page and see what's comming from the server? – aledpardo Dec 18 '13 at 18:13
  • yes the data from the server has all the tags intact. – Norst Dec 18 '13 at 18:17
  • I have the same result here, I'll try to figure out what's going on. – aledpardo Dec 18 '13 at 18:29
  • Take a look into this [answer](https://stackoverflow.com/a/18047106/1652450). There [oleq](https://stackoverflow.com/users/1485219/oleq) tells about the `config.allowedContent` configuration. Someway, CKEditor is blocking your content. – aledpardo Dec 18 '13 at 18:34
  • aledpardo - yes but it should only strip tags for features not enabled in the editor, in this case the settings are the same on both editors. From the Docs: "During editor initialization, editor features add their rules to the filter. As a result, only the content that may be edited using currently loaded features is allowed, and all the rest is filtered out." so the filtering should not take place on the color spans as these feature are enabled in the editor. – Norst Dec 18 '13 at 18:38
  • I went to the [CKEditor full mode demo](http://ckeditor.com/demo#full) and pasted your HTML content and nothing changed... – aledpardo Dec 18 '13 at 18:56
  • Take a look into [this](http://stackoverflow.com/questions/18349048/ckeditor-strips-span-and-style-attributes) question. – aledpardo Dec 18 '13 at 19:05
  • It looks like some portion of older code is doing some type of "cleaning" on the comments when loaded form the DB that is putting in " and mucking things up. – Norst Dec 18 '13 at 20:24

0 Answers0