To reproduce:

  1. Create a ckeditor plugin module or install https://www.drupal.org/project/ckeditor_bootstrap_buttons
  2. Add the button to a text format (such as basic html) active toolbar
  3. Turn on 'Limit allowed HTML tags and correct faulty HTML' filter
  4. Load a content edit form that uses the text format

The button will then not be added to the ckeditor interface.

If you then go back to the text format and remove the 'Limit allowed HTML tags and correct faulty HTML filter' the button will be available from the user interface.

Please not that this is NOT an issue with the above mentioned module, and the same happens with all user added ckeditor plugins

CommentFileSizeAuthor
#7 ckeditor.jpg180.91 KBrwam
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Tom.W created an issue. See original summary.

Wim Leers’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)

Please not that this is NOT an issue with the above mentioned module, and the same happens with all user added ckeditor plugins

You need to add the tags/attributes that this CKEditor plugin needs to the list of allowed HTML tags. In this case: https://github.com/smonetti/btbutton/blob/master/plugin.js#L81.

Note that this should happen automatically: https://vimeo.com/62160137

Wim Leers’s picture

Title: CKeditor custom buttons do not work if Limit allowed HTML tags and correct faulty HTML filter » CKEditor custom buttons do not work if Limit allowed HTML tags and correct faulty HTML filter
Tom.W’s picture

Hi Wim,

Your completely right about the resolution but interestingly the unidirectional update definitely does not work for us, adding buttons and so forth added nothing at all. I tried this with ckeditor plugins with normal and obfuscated code, and it didnt make a difference. Any idea how we might get this to work properly?

chinhlc’s picture

You check again all tag you have in "Allowed HTML tags". Remove tag make error => done
eg: <table> <p> ...

Tom.W’s picture

chinhcl - I already checked that config many times and this was not the issue

rwam’s picture

Same problem exists with alignment buttons. I've tried to add them to the Basic HTML and the Full HTML text format, but with no luck. Only with deactivated filter the alignment buttons work. See screenshot below. I think it's the same problem like #2598070

ckeditor settings vs. usecase

rwam’s picture

Wait resp. sorry, I've found the solution. The alignment buttons needs a customized filter setting, because the alignment works with class names. So I switched the settings from

…<h6 id> <p> <br> <span>…

to

…<h6 id> <p class=""> <br> <span>…

and it works now. Sorry for the circumstances, but may it's helpful.

Wim Leers’s picture

#7 + #8: Actually, you want class="text-align-left text-align-center text-alight-right text-align-justify". That's more specific. Those classes should be added automatically as soon as you add those alignment buttons. You probably have JS errors or a contrib module that is breaking that automation (which is happening in JS).

rwam’s picture

Hi Wim,

no errors, no contrib module. I've tested it with a brand new drupal 8.2.7 installation. Same behavior like described. The class attribute must be added manually. And I must do this for each kind of block format tag when I use the format plugin.

Ciao
Ralf

navalogan’s picture

Thanks rwam it' worked for me too!

tepelena’s picture

Had the same issue. #8 fixed it for me.

In addition I had the issue with the image embed button not showing.

Added data-src to the img tag and it worked.

This: <img src class="" data-src alt data-entity-type data-entity-uuid>

tepelena’s picture

Version: 8.2.7 » 8.6.x-dev

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

loopy1492’s picture

Had a similar issue with the CKEditor Anchor Link Module. It was adding an ID to the <a> tag which was not allowed in the HTML filter settings. I added "id" to the list of properties allowed in the <a> tag and the button appeared for me.

<a href hreflang title target name id>

A good way to figure out what properties need to be whitelisted is to have an unrestricted text format. If you add the button there and look at the code produced when you use the button, you can take the properties used there and then add it to your filter settings for the more restrictive text formats.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
cilefen’s picture

Status: Postponed (maintainer needs more info) » Fixed

I am closing this support request because there have been no recent comments.

I read all comments and it seems to be answered. If I am wrong and this is actually a bug please comment.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.