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.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3092779-10.png | 200.78 KB | phenaproxima |
| #4 | 3092779-4.patch | 1.43 KB | phenaproxima |
Comments
Comment #2
phenaproximaComment #3
phenaproximaComment #4
phenaproximaAnd, patch. Please pass tests.
Comment #5
xjmComment #6
xjmThanks for reporting this!
Comment #7
lauriiiGood catch! Confirmed that thereäs no more references to
media_library.theme.cssafter this change 👍Comment #8
oknateWe 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.
Comment #9
phenaproximaSetting this back to "needs review" for committer feedback on #8.
Comment #10
oknateThere'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
Comment #11
phenaproximaThe 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_stylesheetskey from the info file.Comment #12
oknateThe 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.
Comment #13
phenaproximaHmmm, okay, fair enough. Then maybe we do, indeed, need to find a workaround.OK, maybe we should add a new stylesheet to Seven'sckeditor_stylesheetskey which improves the styling.Comment #14
oknateHere's the follow-up: #3092795: [regression] Restore styling for embedded media edit button in Seven theme
Comment #15
phenaproximaGreat! Now that we have a follow-up in place to restore the styling to Seven, I'm okay restoring RTBC on this issue.
Comment #16
phenaproximaComment #17
seanbJust 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.
Comment #18
oknateI'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.
Comment #22
webchickSounds 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!