ckEditor strips content

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
2/14/2020 8:18:56 PM
Gravatar
Total Posts 19

ckEditor strips content

When I paste the HTML below in ckeditor source view, and save it, I can view the icon.  When I edit the section again, or just view it in non-source mode, the line is removed.

<span class="glyphicon glyphicon-search"></span>

I'm using a custom ckeditor.js file that contains config.allowedContent = true; .  I believe this setting allows any content?

If I add text inside the span tag, it works:

<span class="glyphicon glyphicon-search">Search</span>

Any suggestions what could be causing this or how to work around it?

Thanks!

 

 

 

2/21/2020 12:58:24 PM
Gravatar
Total Posts 2169

Re: ckEditor strips content

ckEditor can get a bit carried away trying to clean up HTML.

The best workaround in this situation is to add a comment to between the opening and closing spans:

<span class="glyphicon glyphicon-search"><!-- do not delete me --></span>

I hope this helps you,

Joe

4/22/2020 9:45:36 AM
Gravatar
Total Posts 193

Re: ckEditor strips content

Putting a space works too I've found. &nbsp;

It would be nice to prevent any reformatting of HTML.