Closed (outdated)
Project:
Drupal core
Version:
11.x-dev
Component:
media system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Nov 2019 at 16:51 UTC
Updated:
9 Sep 2024 at 00:09 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #2
phenaproximaComment #3
phenaproximaNot sure what else is needed here. I suppose that this is bringing in more styles than we'd ideally like, so we could split out the CSS into multiple files, but that seems out of scope here.
Comment #4
oknateckeditor_stylesheets is for the main theme, not for the admin theme. See _ckeditor_theme_css(). It's looking in Bartik and the themes it extends, not in Seven.
Comment #5
seanbI too ran into the issue for #4. It seems every theme should have a copy of media-library.css for the ckeditor styles, even if the media library is only used in the admin theme. Should we add it to bartik and umami for now to fix this?
It sucks, but I guess that is what we have to deal with. I really think we should consider adding more styles back into the module. It is a separate issue, but I personally think overriding existing styles is the lesser evil compared to the amount of hooks and CSS a theme now has to copy to make the library look good. Apparently even in the admin theme. I don't expect anyone to understand this, since even I really don't know how to explain this to people.
Comment #6
oknateHere's a fix, but I think we should look for a better solution. Unfortunately hook_keditor_css_alter() doesn't work at the theme level.
1) _ckeditor_theme_css should support admin themes, this could be an issue blocking this.
2) We don't want to add everything from media library anyway. We only need enough styling for the edit button.
Comment #7
seanbSo I just had a quick call with phenaproxima and lauriii about this. The real issue here is indeed that admin themes can't provide styles for the ckeditor. For that we can do the following things:
Options 1 or 2 are most feasible for the short term, but they both have serious drawbacks. We probably need a product manager to make the final call on this.
That still leaves my other concern about the overall issue that themes need to copy a lot of hooks, templates and CSS to their own themes to make the media library look good. For that we can and should provide a handbook page and a contrib module for the short term to make it as easy as possible.
Comment #8
oknateThis will fix it when the FE theme extends Classy, including Bartik, in other words, on a Standard install.
Comment #9
oknateComment #10
seanbProbably not eligible for 8.8, but still created #3092828: Allow admin themes to specify ckeditor_admin_stylesheets in their info file for admin components in ckeditor. as a possible solution.
Comment #12
oknateFixing test failure in #8.
Comment #13
oknateHere's a different approach: Updating
media/css/plugins/drupalmedia/ckeditor.drupalmedia.css, which is actually already dealing with this edit button.This is a version of approach #7.1.
Comment #14
oknateFixing one errant unnecessary style in #12.
We need feedback on these two approaches, in #13 and #14.
Approach #14 updates all FE themes that extend Classy to provide themed edit buttons for media embeds in the CKEditor.
Comment #15
oknateRerolling the two approaches now that #3092779: media_library.theme.css is being called despite it no longer existing is committed.
Comment #16
seanbAs mentioned before we had a talk with lauriii and phenaproxima about this, and fixing it in the module or classy is the easiest solution for now, but probably problematic from a theming perspective. The BC implications of doing it in the module or in classy might come back to bite us in the ass.
My preference would be to solve it properly via #3092828: Allow admin themes to specify ckeditor_admin_stylesheets in their info file for admin components in ckeditor., so Seven and Claro can provide their own styles for admin elements within CKEditor. But ultimately it is a PM decision.
Comment #17
lauriiiShould we at least ship with some styles as part of the core themes?
Comment #18
oknate+1 to that. I think a large percentage of users wouldn't bother to theme it, and we'd be doing the community a great favor to provide a sensible default here.
Comment #19
phenaproxima+1 for this as well.
Comment #20
lauriiiSounds like we should create a revision of #15 which has the changes moved to Claro, Seven, Bartik, and Umami.
Comment #21
chris burge commentedBy process of elimination, we're left with the second patch from #15.
Option 1: CSS should be provided by admin themes, Seven and Claro
Unfortunately, admin themes cannot specify stylesheets for CKEditor.
hook_ckeditor_css_alter()cannot be implemented by a theme.We could implement
hook_ckeditor_css_alter()in Media, but then there's no point of storing the stylesheets in the various admin themes. It'd be housed with Media. At that point, we're basically at Option 3, below.Adding it to Bartik and Umami isn't useful as those are demo themes. They're unlikely to be used on a production site, even as a base theme.
Option 2: CSS should be added to classy
With Classy moving to contrib, #3050389: [META] Remove dependency to Classy from core themes, this seems like a nonstarter.
Option 3: CSS should be provided by the Media module.
This is what we're left with. And I don't see this as a bad option. Modules provide their own CSS all of the time.
Comment #22
chris burge commentedWhereas a user is able to click on the icon, this patch adds pointer behavior to indicate an interaction to the user.
Comment #24
priyanka.sahni commentedComment #25
priyanka.sahni commentedVerified and tested by applying the patch on Drupal 8.9 and 9.1.It looks good to me.Can be moved to RTBC.
Steps to test -
1. Go to the admin site.
2. Go to admin/appearance
3. In the Administration theme , select Claro/Seven.
4. Go to admin/modules , enable Media, Media Library.
5. Go to admin/config/content/formats
6. In the text editor , from the Available buttons add the media type in the Active toolbar.
7. In the Enabled filters , enable these filters Align images and Embed media and click on save configuration.
8. Go to Article page.
Before Patch 9.1 -

Before Patch 8.9 -

After_Patch_9.1_Seven -

After_Patch 9.1 Claro -

After Patch 8.9 Seven -

After Patch 8.9 Claro -

Comment #26
priyanka.sahni commentedComment #27
chris burge commented@priyanka.sahni - Thanks for your thorough review.
Because this is a bug (and not a new feature), I'm setting the version back to 8.9.x-dev.
Per #25, moving to RTBC.
Comment #29
chris burge commentedSetting back to RTBC. Test failure was an intermittent branch test failure and is unrelated to this patch.
Comment #31
chris burge commentedSetting back to RTBC. Test failure was an intermittent branch test failure and is unrelated to this patch.
Comment #32
alexpott@Chris Burge it looks like you've rtbc'd your own work here - sorry if I've misunderstood that.
But also the solution in #22 appears to directly go against the consensus built by #20. As @lauriii is the front end framework manager we need his +1 that the solution in #22 is okay.
Comment #33
chris burge commented@alexpott - I did jump the gun. @priyanka.sahni reviewed and stated RTBC (w/o changing the status). I should have requested she move the status herself.
Re the consensus, see #21. Admin themes cannot specify stylesheets for CKEditor, so Seven and Claro are out. Umami is a demo theme, and fixing this only in Bartik doesn't help anyone. So.. patch #22 uses the Media module to provide the CSS. (If admin themes could provide CKEditor stylesheets, that would, of course, be a game changer.)
Comment #34
phenaproximaComment #35
volkswagenchickAdding
NorthAmerica2021andEasy Out of the Boxtags for visbility.DrupalCon NA is April 12-16 with a focus on EOOTB on Wednesday, April 14.
Thanks
Comment #36
chris burge commentedComment #40
larowlanDoes this impact CKEditor 5? With CKeditor 4 moved to contrib should this issue be moved to contrib
Comment #41
andrew.wang commentedRe-rolled #22 for Drupal 9.5.EDIT: This didn't work. I ended up copy-pasting the styles into a CSS file defined as
ckeditor_stylesheets.Comment #42
nuuou commentedRe-rolled Patch #41 with CKEditor 4 in Contrib
EDIT: Looks like I left an incorrect filepath to an image in this patch. Need to adjust that.
Comment #43
matia.ward commentedFixed the icon path.
Comment #44
nuuou commented#43 is not applying for me for some reason, attaching a new patch that should be identical to #43.
Comment #46
chris matthews commentedThere is a patch in #44, however, @larowlan's questions in #40 still need to be answered, which is why the status for this issue is Postponed and not Needs Review.
Comment #47
acbramley commentedThis came up again in Bugsmash today. It has been over a year since this was set to PMNMI and no further information has been provided.
The seven theme no longer exists in core and I can't see that CSS file either that the patch is changing. Therefore I'm marking this as Closed (outdated).
Please feel free to open a new issue with steps to reproduce this bug from a fresh drupal installation.