By default, dragging the Underline button into the toolbar will not enable the Underline button in the Basic CKEditor config. It just doesn't show up in the user's toolbar.

Un-checking "Limit allowed HTML tags and correct faulty HTML" in the Basic CKEditor config allows users of the Basic config to see the Underline button.

This issue #2598070: [regression] CKEditor Link button does not show if HTML filtering is enabled may be related

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iainH created an issue. See original summary.

cilefen’s picture

Status: Active » Postponed (maintainer needs more info)

I cannot reproduce the problem on 8.0.x or 8.1.x.

I went to admin/config/content/formats/manage/basic_html and dragged the underline button to the toolbar, saved the configuration, then added an article. The underline button was there, and it works.

Ameer Khan’s picture

I have tested with drupal-8.0.5 but I can't reproduce the issue. I can drag the underline button.

Wim Leers’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Many thanks, cilefen & Ameer Khan!

I suspect a browser cache problem.

Wim Leers’s picture

Component: editor.module » ckeditor.module
iainH’s picture

Issue still persists in Drupal site live in beta for a couple of weeks - i.e. can't see how this can be browser cache related.
It's on a body field in a custom content type where editing is restricted to a single role "Officer" using a Basic HTML.
And the Basic HTML editor configuration shows Underlining in the toolbar but this does not display either to the user with that "Officer" role or to an "Administrator" who's also checked to use this edit profile. (See screenshots)

Wim Leers’s picture

Category: Bug report » Support request
Status: Closed (cannot reproduce) » Postponed (maintainer needs more info)

Note that users don't see closed issues. So you're very lucky I accidentally stumbled upon this issue.

Please export your Basic HTML text editor & text format and post their YAML here. That should allow me to reproduce the problem.

DuaelFr’s picture

iainH’s picture

Glad you did stumble upon this as I didn't notice it was closed. Thanks for looking into this.

Text editor >> Basic HTML:

uuid: e12f705e-c92b-4cd2-a600-b1f1f3dc92b2
langcode: en
status: true
dependencies:
  config:
    - filter.format.basic_html
  module:
    - ckeditor
_core:
  default_config_hash: AqlPmO16LvJI4D0Ih6u4GFQIzqr5OnLgAUSjcUGWk2g
format: basic_html
editor: ckeditor
settings:
  toolbar:
    rows:
      -
        -
          name: Formatting
          items:
            - Bold
            - Italic
            - Underline
        -
          name: Linking
          items:
            - DrupalLink
        -
          name: Lists
          items:
            - BulletedList
            - NumberedList
            - Outdent
            - Indent
        -
          name: Media
          items:
            - Blockquote
            - DrupalImage
            - Table
            - PasteFromWord
        -
          name: 'Block Formatting'
          items:
            - Format
        -
          name: Tools
          items:
            - '-'
            - Source
            - Maximize
  plugins:
    stylescombo:
      styles: ''
image_upload:
  status: true
  scheme: public
  directory: inline-images
  max_size: '8 MB'
  max_dimensions:
    width: null
    height: null

Text format >> Basic HTML

uuid: eb081252-bdeb-4be3-9348-728097165f2b
langcode: en
status: true
dependencies:
  module:
    - editor
_core:
  default_config_hash: P8ddpAIKtawJDi5SzOwCzVnnNYqONewSTJ6Xn0dW_aQ
name: 'Basic HTML'
format: basic_html
weight: 0
filters:
  filter_html:
    id: filter_html
    provider: filter
    status: true
    weight: -10
    settings:
      allowed_html: '<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> <img src alt height width data-entity-type data-entity-uuid data-align data-caption> <table> <caption> <tbody> <thead> <tfoot> <th> <td> <tr>'
      filter_html_help: false
      filter_html_nofollow: false
  filter_align:
    id: filter_align
    provider: filter
    status: true
    weight: 7
    settings: {  }
  filter_caption:
    id: filter_caption
    provider: filter
    status: true
    weight: 8
    settings: {  }
  filter_html_image_secure:
    id: filter_html_image_secure
    provider: filter
    status: true
    weight: 9
    settings: {  }
  editor_file_reference:
    id: editor_file_reference
    provider: editor
    status: true
    weight: 11
    settings: {  }
iainH’s picture

Category: Support request » Bug report
iainH’s picture

And heres a body field in a node whose editor toolbar doesn't display the Underline button.

uuid: 76985033-2925-4c3b-923e-62f5855d58a7
langcode: en
status: true
dependencies:
  config:
    - field.storage.node.body
    - node.type.agenda
  module:
    - text
id: node.agenda.body
field_name: body
entity_type: node
bundle: agenda
label: 'Agenda text'
description: ''
required: false
translatable: true
default_value: {  }
default_value_callback: ''
settings:
  display_summary: true
field_type: text_with_summary
Wim Leers’s picture

Category: Bug report » Support request
Status: Postponed (maintainer needs more info) » Fixed
allowed_html: '<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> <img src alt height width data-entity-type data-entity-uuid data-align data-caption> <table> <caption> <tbody> <thead> <tfoot> <th> <td> <tr>'

The underline tag (<u>) is not listed there. That's why it doesn't show up. CKEditor has your back: it doesn't show buttons that it knows will be stripped anyway.

You need to add that tag there.

Now, that tag should have been added there automatically. When you dragged the "Underline" button onto the toolbar, a JS error must have occurred that prevented this from happening. But I'm happy to see that this automatic whitelisting actually did work for various other things you did. For example, <table> <caption> <tbody> <thead> <tfoot> <th> <td> <tr> was whitelisted because you added the "Table" button.

I don't know what happened there exactly, but in this case, the most sensible thing is to just fix it manually: just add <u>.

iainH’s picture

Status: Fixed » Active

It's a great idea to automatically manage the text formats t suit the editor settings but ... and apologies for not letting this go for the moment ... want to ensure that there's nothing sinister lurking there.

I would have expected the following to automatically update the text formats config by adding a <u> tag - but it doesn't

  1. Drag the Underline button out of the active toolbar of Basic HTML
  2. Save the settings
  3. Export the text formats and
  4. notice no <u>
  5. Drag the Underline button back into the active toolbar of Basic HTML
  6. Save the settings
  7. Export the text formats
  8. notice presence of <u> tag

But this last step doesn't happen. It's still not adding in the <u> tag.

Why do you think this is?

Wim Leers’s picture

Status: Active » Postponed (maintainer needs more info)

I just tried it manually, because you had me thinking this indeed is an actual bug. But it works fine here! :( Very strange.

  1. Do you see any errors in your browser?
  2. Can you go to https://simplytest.me/project/drupal/8.1.x, install Drupal there, and check if that works for you? If that works, there must be some module/theme breaking things for you.
iainH’s picture

Version: 8.0.5 » 8.0.6
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

OK, so I went to to https://simplytest.me/project/drupal/8.1.x and configured Basic HTML exactly as its configured on our (8.0.6) site.
Yes, the simplytest.e site generates a <u> tags as expected whereas our does not - whatever strategy I try and no, there are no browser errors and, since I wrote all the modules and js behaviors that are not from d.o. I can be pretty sure I am not interfering with any of the js that manages the allowed tags on the editor configuration page. ... so it's a mystery.

I added the <u> tag by hand to the allowed tags and we have an Underline button and the config exports to the live site OK. So I have a workaround but no solution. ... and I've run out of time to explore forth so I'll close this issue.

Again. Thanks for your time taken looking into this.