-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Incorporate outside styles sooner rather than later #422
Comments
It would probably be good to do this as a separate stylesheet ( Further reference: |
Fixes #422. Added an action so that someone could hook into where gutenberg styles are loaded and bring in an editor style of their own. I took this approach, as there is not a super clean way to mimic `add_editor_style()` without adding another global variable to WordPress, without PHP 5.3+, that I could find.
I'm still not sure if adding editor styles to WP core was a good idea. @azaozz may have thoughts on this too. |
That is a great point. I have made lots of use of editor styles in my themes, but with where Gutenberg is going, it is pretty easy to render the editor in the front end of the theme and just use it that way. So potentially editor styles won't really be necessary. |
This makes no sense to me. Isn't the editor a page in the admin, regardless of the theme perhaps rendering it somewhere else? And the goal is to make the Visual mode look like the front end will look? If this will just be an iframe like the Preview is now, I understand that the theme is doing all the styling. But if not, isn't the theme going to need to put dynamic styling in so the Visual mode looks like it will on the front end? |
To me the editor is
Maybe, I think the goal is to provide an easier way to edit for those who do not know HTML. I do agree that editor styles currently are very useful, but maybe there is room here to make maintenance of the WordPress project easier by not introducing them for the new editor, and instead provide an even better experience by having live editing in the theme, which could be introduced in a separate plugin.
It's currently possible to do this right now, if you really wanted to. I don't think the main goal of Visual mode is to match the front end, it simply provides an easy to use editor instead of working with HTML directly. Rather than rushing to adding editor-styles 2.0 we could explore better alternative solutions. |
One "problem" with editor styles, which we probably don't want to tackle with this focus, is that it's a separate stylesheet for theme authors to create and maintain. Just philosophically it would be nice if a theme author did not have to create a separate style, but that the editor could infer the styles from the main |
With the theme supplying styles for the Customizer, the theme usually has a function that emits the dynamic styles, so at least that part could be "registered" with the editor. However, the selectors might not be quite right, which is why the editor-style is separate in the first place. |
Quoting from a Slack conversation with @aduth
So, this likely means that more blocks will need to register themselves on the server side, and we'll need to allow the Edit: also worth considering: themes themselves will probably want to add styles for individual blocks. |
Closing in favor of #963. |
You're closing in favor of itself? :) |
@mtias This is a very different conversation from #963 -- 963 is about front-end Gutenberg styles (I blelieve primarily layout oriented), while this convo is primarily about backend styles that the Theme could enqueue to allow Gutenberg to look more like the theme content styles. Wouldn't you say this is still worth discussing over here separate from 963? |
In the discussion for what to include on #356 (Allow editing actual posts and pages), it seems that only half of the editing experience is being addressed. The actual post content is needed to have something to edit, but the context of presentation of that content is missing.
The current WP editor allows the presentation of the Visual mode to be adjusted using additional stylesheets. Themes can add this using
add_editor_style()
, which by default is namededitor-style.css
.I expect that capability still needs to exist in the new editor, and allowing for it at the beginning will keep clear what styling belongs in the editor and what is left to the theme, and how they might interact.
I suggest that the minimum of styling would be a content font and background color so transitions between blocks are easy to spot. Then the WordPress standard classes similar to as defined on https://codex.wordpress.org/CSS would show how the edits are applied as classes. I know it's early to expect that whole flow to work, but I think it's important to start with it in order to keep the goal in mind. You also won't be able to control what styles are fed in, so if a theme uses a generic selector like
div
, will that break your look?The text was updated successfully, but these errors were encountered: