Drupal 8.2.x text editor stripping-removing “div c

2019-09-04 03:13发布

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条回答
对你真心纯属浪费
2楼-- · 2019-09-04 04:13

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.

:)

查看更多
登录 后发表回答