Problem/Motivation

In latest Umami installation (where media_library is now stable), going to this page /en/node/3/edit

Displays a console error
Refused to apply style from 'https://stm5dc2e77e343b6-ncoek5z0kucoz4tfcliahikcqte9bw9d.tugboat.qa/core/modules/media_library/css/media_library.theme.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

That css file is being called here core/modules/media/src/Plugin/CKEditorPlugin/DrupalMedia.php
And that css file is also being mentioned here core/modules/media/css/plugins/drupalmedia/ckeditor.drupalmedia.css

Proposed resolution

Remove all references to this defunct file from the Media module.

Remaining tasks

Write a patch, verify it fails no tests (no additional testing is needed, this is purely removal of dead code), and commit it.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

CommentFileSizeAuthor
#11 3092779-10.png200.78 KBphenaproxima
#4 3092779-4.patch1.43 KBphenaproxima

Comments

shaal created an issue. See original summary.

phenaproxima’s picture

Issue summary: View changes
phenaproxima’s picture

Issue summary: View changes
phenaproxima’s picture

Status: Active » Needs review
StatusFileSize
new1.43 KB

And, patch. Please pass tests.

xjm’s picture

Title: media_library.theme.css is being called even that it is no longer exist » media_library.theme.css is being called despite that it is no longer exists
xjm’s picture

Title: media_library.theme.css is being called despite that it is no longer exists » media_library.theme.css is being called despite that it no longer exists

Thanks for reporting this!

lauriii’s picture

Status: Needs review » Reviewed & tested by the community

Good catch! Confirmed that thereäs no more references to media_library.theme.css after this change 👍

oknate’s picture

We can't just remove it, as it was applying styles to the CKEditor, which won't inherit styles from the admin theme. We need to look at
1) the styles it was applying and
2) add those styles with another file that does exist.

phenaproxima’s picture

Status: Reviewed & tested by the community » Needs review

Setting this back to "needs review" for committer feedback on #8.

oknate’s picture

StatusFileSize
new923.25 KB

There's a regression, an unthemed "Edit Media" button. This could be fixed in a follow-up, or in this issue.

Perhaps instead of removing it, it should be changed to:

core/themes/seven/css/theme/media-library.css

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#3072063: CKEditorPluginManager::getCssFiles() and CKEditorPluginCssInterface::getCssFiles() should be library-aware and override-aware
StatusFileSize
new200.78 KB

The way #10 looks is, quite honestly, about what I'd expect from the media library in Bartik or another Classy subtheme. I do not consider that a regression. Every theme except for Seven ships with very, very minimal styling for Media Library, and that's a conscious decision we made in the process of marking Media Library stable.

So I'm actually fine with this, and am restoring RTBC.

As for how individual modules can re-add styling for it, a workaround exists: hook_ckeditor_css_alter(). For something more robust, we'd need to be able to attach asset libraries to CKEditor plugins, which is not currently possible, but we have an issue for it: #3072063: CKEditorPluginManager::getCssFiles() and CKEditorPluginCssInterface::getCssFiles() should be library-aware and override-aware.

Themes can use the ckeditor_stylesheets key from the info file.

oknate’s picture

Every theme except for Seven ships with very, very minimal styling for Media Library, and that's that.

The screenshot was using Seven. No theme will have themed "Edit Media" buttons now. I consider that a regression IMHO as it was themed a month ago. A missing css file is a worse problem, but we should at least have a follow-up to restore the styling in the seven theme.

phenaproxima’s picture

Status: Reviewed & tested by the community » Needs review

Hmmm, okay, fair enough. Then maybe we do, indeed, need to find a workaround. OK, maybe we should add a new stylesheet to Seven's ckeditor_stylesheets key which improves the styling.

oknate’s picture

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Great! Now that we have a follow-up in place to restore the styling to Seven, I'm okay restoring RTBC on this issue.

phenaproxima’s picture

Title: media_library.theme.css is being called despite that it no longer exists » media_library.theme.css is being called despite it no longer existing
seanb’s picture

Status: Reviewed & tested by the community » Needs work

Just posted a comment in #3092795-7: [regression] Restore styling for embedded media edit button in Seven theme that might have some impact on this as well. Setting it to needs work for now until we have some consensus on how to solve this.

oknate’s picture

Status: Needs work » Reviewed & tested by the community

I'm going to mark this RTBC. The latest patches for #3092795: [regression] Restore styling for embedded media edit button in Seven theme don't affect this change, and this is a bug it would be good to fix, regardless of what happens with that issue.

Let's get this taken care of, please.

  • webchick committed e0bc054 on 9.0.x
    Issue #3092779 by phenaproxima, oknate, shaal: media_library.theme.css...

  • webchick committed 4d18871 on 8.9.x
    Issue #3092779 by phenaproxima, oknate, shaal: media_library.theme.css...

  • webchick committed e7ca711 on 8.8.x
    Issue #3092779 by phenaproxima, oknate, shaal: media_library.theme.css...
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Sounds like there was some back and forth above, but ultimately this is fixing dead code so is good to get in regardless, and #3092795: [regression] Restore styling for embedded media edit button in Seven theme exists for fixing other things uncovered here. Sooo...

Committed and pushed to 9.0.x; 8.9.x; 8.8.x. Rock!

Status: Fixed » Closed (fixed)

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