This may be a "meta" issue, but just wanted to get this in while I'm thinking about it. So far this theme has mostly focused on the "chunks" of Drupal - ie, pages, regions, blocks, menus, etc. But we also need to give some love to the "blobs" - ie, whatever users put into content via CKEditor. A few general ideas:

  1. We should get the "Styles" dropdown in CKEditor to include common element styles, like buttons.
  2. We should also implement "templates" in CKEditor editor to help kick off more complex things like hero-callouts.
  3. While we're at it, we should make sure that the USWDS stylesheet is loaded in CKEditor.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

brockfanning created an issue. See original summary.

brockfanning’s picture

Looking through the standards for things we should support. Here are some I've seen so far:

Styles for <a> tags:

  • .usa-button
  • .usa-button-gray
  • .usa-button-outline
  • .usa-button-outline-inverse
  • .usa-button-big
  • .usa-button-secondary

Styles for <table> tags:

  • .usa-table-borderless

Styles for <p> tags:

  • .usa-font-lead

Still thinking about the mechanism for adding "templates", for things like information alerts, and hero callouts. I'm leaning towards some sort of Drupal entity-based approach, like embedded blocks, panels, paragraphs, etc., but need to investigate more.

brockfanning’s picture

Title: Provide styles and templates in CKeditor » Provide styles in CKeditor

Focusing this issue on styles, while the "template" approach is mulled over.

brockfanning’s picture

Status: Active » Needs review
FileSize
1.4 KB
553 bytes

It looks like the way of getting CKEditor styles is totally different in D8 vs D7. I'm attaching a code change as a patch for both versions, but each will also require a manual configuration change. These are detailed below, and we'll need to add a note to the project page:

D7: Assuming the use of the CKEditor module the attached patch will add some new entries into the "Styles" dropdown. In order to load the USWDS styles in the WYSIWYG though, the CKEditor "profile" will need to be edited to set "Use theme CSS" under the "Editor CSS" section.

D8: The attached patch will make sure the USWDS styles get loaded in the WYSIWYG, but in order to add entries to the "Styles" dropdown, something similar to the following needs to be added to the text format configuration in the "Styles dropdown" section:

a.usa-button|Button
a.usa-button.usa-button-gray|Button - Gray
a.usa-button.usa-button-outline|Button - Outline
a.usa-button.usa-button-outline-inverse|Button - Outline Inverse
a.usa-button.usa-button-big|Button - Big
a.usa-button.usa-button-secondary|Button - Secondary
table.usa-table-borderless|Borderless Table
p.usa-font-lead|Lead font

  • brockfanning committed 1989ada on 7.x-1.x
    Issue #2893005 by brockfanning: Provide styles in CKeditor
    
brockfanning’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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