Problem/Motivation

On Drupal 10.1, the JSON Editor theme assets do not load, which makes the editor window un-styled.

I believe this is happening because of recent changes to CSS/JS loading, which landed in Drupal 10.1 (see change records CSS and JavaScript aggregation performance improvements and Asset aggregation deprecations and additions, hook_js_alter()/hook_css_alter() changes).

Also, if you use stage_file_proxy module, you will need to update to at least 2.1.1, to include the fix from #3372105: Stage file proxy attempts to fetch aggregated JS/CSS..

Steps to reproduce

  • drush si demo_umami -y
  • drush en patternkit_example -y
  • drush uli
  • Go to /admin/content
  • Navigate to an article content item
  • Click Layout tab to edit the item's layout
  • Add a [Patternkit] Example block to the layout
  • Observe that the pattern editor section is un-styled. You should also see a 404 response for the jSON Editor theme's CSS file(s).

Proposed resolution

Update Patternkit's CSS/JS asset handling to be compatible with Drupal 10.1.

Remaining tasks

  • Test all JSON Editor themes bundled with Patternkit
  • Determine whether to make this change work only for 10.1 or keep support for 9 and 10.0.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Issue fork patternkit-3381549

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

krisahil created an issue. See original summary.

krisahil’s picture

Status: Active » Needs review
StatusFileSize
new2.05 KB

Attaching a patch that works with both Drupal core 10.0 and 10.1. It's not a long-term fix, but might be a workable bridge, until we can refactor how we attach JSON Editor theme assets.

slucero’s picture

slucero’s picture

The patch looks good to me and I believe it is a good step forward for a near-term solution. For a more long-term solution to simplify the approach overall, I've documented a follow-up task in #3386854: Attach JSON Editor Theme Assets Using Library Attachments.

For next steps, we'll need to test this patch to make sure it work as expected for Drupal 9, Drupal 10.0, and Drupal 10.1+.

jasonawant’s picture

Issue summary: View changes

Updated change records links in issue summary; unable to use issue formatting such as #3301716: CSS and JavaScript aggregation performance improvements, with non issue content.

minsharm’s picture

StatusFileSize
new282.59 KB

Retested the issue with this Patch File on D 9.5.8 as well as on D 10.1.0 and Patternkit Editor loads successfully in the new window now.

Steps to test :

Enable Patternkit, Patternkit Example and layout builder module.
Go to content -> Add content. Select Basic Page.
Give the title of the page and click save.
Go to Layout Tab.
Click on Add block.
Right click on Patternkit example block and click on "Open link in new tab"

Before Fix : Error message displays when attempting to add a new block/pattern in a new window or tab (outside of off-canvas tray).

After Fix (With Patch File) : Patternkit Editor loads successfully in the new window now.

Attaching screenshots.

  • krisahil authored f77b8f78 on 9.1.x
    Issue #3381549 by krisahil, minsharm, jasonawant: JSON Editor theme...
slucero’s picture

Status: Needs review » Fixed

This has been merged for inclusion in the Beta 8 release. Thanks everybody!

Status: Fixed » Closed (fixed)

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