-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply front-end theme CSS to CKEditor instances #4
Comments
Here are some related issues and background research from Drupal:
Overall the solution for Drupal has been to load the CSS file as part of the editor parent page, but include a Multiple users have been confused that the CKEditor 5 (and 4) module load the front-end theme's CSS, not the admin theme. Maybe we should make it so that if an admin theme provides a CKEditor stylesheet, but the front-end theme does not, it loads the admin theme CSS file? |
It's pretty tricky... I don't think, we really can avoid confusion. |
FYI: this was recommended by the CKEditor team.
FASCINATING! 😄 Most people on the Drupal side who complain about any aspect of this, are almost viscerally angry that the preview isn't a perfect "WYSIWYG" 😅 |
I filed a PR at #120 that updates our implementation to add front-end CSS files on pages that contain a CKEditor instance. Note that because the CSS is applied across the entire page, the Test coverage here in contrib is a little tricky. We could add a test theme within this module but that seems a little strange. To test manually:
|
Will play with that soon with some of my contrib themes. 👍 |
As expected, quite a mess. Even if the setting "Use the administration theme when editing or creating content" is off, so the frontend theme is used for content editing, cke variables get in the way, example:
OK, just a few lines to add to existing CSS to fix that (override the vars). When "Use the administration theme when editing or creating content" is turned on, so the admin theme is used for content creation, things get really messy. Fonts are tricky, too. Worst case, both fonts, for frontend and admin theme have to get loaded. I didn't even start with dynamic stuff like Color module support, dark mode... Anyway, API-wise - Didn't test the alter hook, yet. |
Yeah, same problems Drupal has been seeing since CKE5 too. The administrative styles all apply to the not-so-much WYSIWYG editor. And yes, the selectors all have to be super-specific. And there's a huge amount of bleed-through. OTOH, there may be some slight benefit that themes that don't provide |
I tried to write test coverage for a theme adding a With the functionality of |
Now that CKEditor now longer uses an iframe, we'll need to rework front-end CSS and the way it applies to CKEditor instances.
The text was updated successfully, but these errors were encountered: