Problem/Motivation

When creating a wysiwyg link i'd like to add a couple of classes to that link to make it stand out as a button. Drupal 8 has a nice and easy way to create a "Styles dropdown" in the CKEditor Settings for text formats located for example in /admin/config/content/formats/manage/full_html

Screenshot: https://www.evernote.com/shard/s245/sh/ee50272c-4699-4c94-9bcf-301e1f4fd...

You can the following to be able to select a link in the WYSIWYG and say "Hey, this is a button":

a.button--primary|Button Primary

The problem is: You can only add one CSS class to each dropdown element this way it seems. I.e: for a link to be buttonized using the Bartik theme, you'll also need the "button" class to that link.

I'd like to be able to write something like:

a.button--primary button|Button Primary

But then I'll get the following error message on save:

The provided list of styles is syntactically incorrect.

Proposed resolution

A: If I am wrong and this is after all possible the following help text should have an instruction for that: (Suggestions needed!)
"A list of classes that will be provided in the "Styles" dropdown. Enter one class on each line in the format: element.class|Label. Example: h1.title|Title.
These styles should be available in your theme's CSS file."

or B: Change the validation for the CKEditor Dropdown styles list on save so multiple CSS classes is allowed for each Dropdown element.


Remaining tasks

Documentations changes and possibly development for suggestion B above.

User interface changes

changes to user interface text on admin/config/content/formats/manage/full_html

API changes

I don't know.

Data model changes

I don't know.

Comments

thorandre created an issue. See original summary.

thorandre’s picture

Issue summary: View changes
wim leers’s picture

Title: Multiple CSS classes for a CKEditor styles dropdown element » Document how to specify multiple CSS classes for CKEditor's styles dropdown
Category: Feature request » Task
Status: Active » Needs review
Issue tags: +Documentation
StatusFileSize
new1.29 KB

The syntax:

tag.classA.classB|Label

So:

a.button--primary.button|Button Primary

So: the exact same syntax as you'd use in CSS :)

Status: Needs review » Needs work

The last submitted patch, 3: 2549951-3.patch, failed testing.

Status: Needs work » Needs review

Wim Leers queued 3: 2549951-3.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 3: 2549951-3.patch, failed testing.

Status: Needs work » Needs review

Wim Leers queued 3: 2549951-3.patch for re-testing.

wim leers’s picture

Issue tags: +rc target

Pure documentation fix should be fine during RC.

nod_’s picture

Status: Needs review » Reviewed & tested by the community

That works for me.

alexpott’s picture

Issue tags: -rc target +rc target triage

This is a string change - strings are frozen - it was it there currently wrong?

wim leers’s picture

It is not wrong, but incomplete.

effulgentsia’s picture

Version: 8.0.0-beta14 » 8.0.x-dev

Fixing Version attribute, but that is not yet an answer for whether/when this will be allowed.

effulgentsia’s picture

Category: Task » Bug report
Status: Reviewed & tested by the community » Needs work

Re #10, what's in HEAD is kind of wrong. The #description says "Enter one class on each line". So it's more than just incomplete. It's actively misleading you from knowing that a single line / style option may consist of multiple classes.

Therefore, recategorizing this as a bug. But, the patch doesn't fix that part of the sentence, so also setting to "Needs work".

Leaving the "rc target triage" tag alone, since even as a bug-fix, it's not yet clear whether fixing it is worth breaking translations during RC vs. postponing to 8.1.

wim leers’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new1.3 KB
new1.35 KB

Fixed the part of the sentence #13 asked for.

xjm’s picture

Issue tags: -rc target triage +rc target

Discussed with @catch, @effulgentsia, and @alexpott. We weighed the disruption of breaking this string against the improvement of the text, and decided since that this will be a mostly administrative-facing help text, the more correct string is worth any lost translations for it. So tagging as an rc target. Thanks!

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.0.x, thanks!

  • catch committed 468056c on 8.0.x
    Issue #2549951 by Wim Leers: Document how to specify multiple CSS...

Status: Fixed » Closed (fixed)

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