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
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | DAT-4555_Retest.odt | 282.59 KB | minsharm |
| #4 | fix-json-editor-theme-assets-loading-3381549-4.patch | 2.05 KB | krisahil |
Issue fork patternkit-3381549
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:
- 3381549-json-editor-theme
changes, plain diff MR !81
Comments
Comment #4
krisahil commentedAttaching 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.
Comment #5
sluceroComment #6
sluceroThe 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+.
Comment #7
jasonawantUpdated change records links in issue summary; unable to use issue formatting such as #3301716: CSS and JavaScript aggregation performance improvements, with non issue content.
Comment #8
minsharm commentedRetested 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.
Comment #10
sluceroThis has been merged for inclusion in the Beta 8 release. Thanks everybody!