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.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 2549951-14.patch | 1.3 KB | wim leers |
Comments
Comment #2
thorandre commentedComment #3
wim leersThe syntax:
So:
So: the exact same syntax as you'd use in CSS :)
Comment #8
wim leersPure documentation fix should be fine during RC.
Comment #9
nod_That works for me.
Comment #10
alexpottThis is a string change - strings are frozen - it was it there currently wrong?
Comment #11
wim leersIt is not wrong, but incomplete.
Comment #12
effulgentsia commentedFixing Version attribute, but that is not yet an answer for whether/when this will be allowed.
Comment #13
effulgentsia commentedRe #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.
Comment #14
wim leersFixed the part of the sentence #13 asked for.
Comment #15
xjmDiscussed 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!
Comment #16
catchCommitted/pushed to 8.0.x, thanks!