Drupal 8.2.x text editor stripping-removing “div classes”

徘徊边缘 提交于 2019-12-25 08:00:48

问题


I have a problem with Druapl 8.2.1 text editor and CKeditor, system keeps stripping - removing classes from "

And example of this:

<div class="social clearfix">&nbsp;</div>

System renders:

<div>&nbsp;</div>

I can't configure the allowed elements, that was only possible in previous versions (config.allowedContent = true;)

Any help would be greatly appreciated


回答1:


Ok, well after breaking my head thinking and re thinking in all I have already done I just did what it was left to do.

Since there is no way to modify the allowedContent in Drupal version 8.2.x... what I did before it was to create a "New text format and editor" but I had selected the option "Limit allowed HTML tags and correct faulty HTML" and in the allowed HTML tags field I had all the classes I wanted to be accepted:

<div> <div class> <div id><a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <p> <br> <span>...

I just unchecked the "Limit allowed HTML tags and correct faulty HTML" and keep the "Correct faulty and chopped off HTML" option checked, saved and voila!!

Now Drupal keeps all my div classes.

Take into consideration that in the option "Text editor" I had selected "NONE", it do not work if "CKEditor" is selected.

:)



来源:https://stackoverflow.com/questions/40050090/drupal-8-2-x-text-editor-stripping-removing-div-classes

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