CKEditor HTML Autocorrection Issue

匿名 (未验证) 提交于 2019-12-03 01:13:01

问题:

I have few lines of HTML in my database. I want to edit the content in CKEditor. But when I open that in editor the HTML gets break down. The HTML gets rearranged.

Below is the HTML which is in database:

<span class="sec_title">        <h1><span>Web</span> Engineering</h1>         <hr> </span> 

And when I open it in CKEditor the HTML looks likes below:

<h1><span class="sec_title"><span>Web</span> Engineering</span></h1>  <hr /> 

Some one please help me. I tried config.allowedContent = true; but it is also not stopping the CKEditor to do the modifications.

回答1:

CKEditor works with a valid HTML only and <h1> is not a valid content of <span>. Quoting CKEditor basic concepts:

CKEditor is not a tool that will let you input invalid HTML code. CKEditor abides by W3C standards so it will modify code if it is invalid.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!