-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
enqueue_block_editor_assets support in 6.3RC #53236
Comments
I had the same issue. I was forced to move all style files in block meta, because all other hooks don't work, even suggested enqueue_block_assets |
Hi @vyskoczilova, thanks for reporting this. The situation with The move to iframing the Post Editor in 6.3 does exacerbate the situation, but there is a workaround if you want to continue using
You can also use the new
Let me know if you run into any issues with either of these approaches. Thanks! |
@ellatrix @oandregal would either of you be able to provide a more detailed synopsis on the appropriate hook to use here? |
That's correct, Diego, though the only nuance is that the I've tried the test case and this is how it looks like:
This is what happens: when the post editor is iframed, stylesheets loaded via This is how styles and hooks should be used (edited to include Ella's comment):
The way forward would be to make sure CSS doesn't leak to the editor affordances by using 1, 2, or 4. |
Previous comments are correct, the |
ah, forgot about the |
@oandregal @ellatrix thank you both for this context 🙏 I am going to work on a guide for the Block Editor Handbook next week. |
Thanks everybody for stepping in and helping me out! And it has also been helpful for somebody else in quite a short time. @ndiego - the code I provided was working in 6.2 since there was no iframed editor for Gutenberg editor in pages etc., so it's a misunderstanding, but I saw it in many places - the last in the Fränk Klein newsletter I received got a couple of days ago... P.S. If you ping me, when the handbook is done, I'll could give it a read Anyways, I've tested it and can confirm that:
Thanks a lot! ❤️ Just the updated code for reference, if it helps somebody else - loading styles only in the admin inside the editor (styles.css as usual):
|
Will do! |
@vyskoczilova the names for the hooks were wrong, sorry. Updated my comment to remove the |
@oandregal Wordpress changes how hooks are working almost every major update. I use next hack
Benefits.
Currently, this solution is working for me, I hope will work in future |
I added some extra info to the iframe dev note: https://make.wordpress.org/core/2023/07/18/miscellaneous-editor-changes-in-wordpress-6-3/#post-editor-iframed |
@ellatrix Is any way to load scripts ONLY in iframe. Looks like enqueue_block_assets duplicates everything twice and this creates problems if I use it for scripts |
@wpsoul my code doesn't work for you? #53236 (comment) |
@vyskoczilova Your code is correct and it's working but it's not solving my question. It loads everything twice, but I need to load script ONLY in iframe or ONLY outside iframe. It's related to problem which is described in |
@wpsoul I see, got it now. Hope there will be a fix. |
Since the original question has a solution, let's close this issue. Let's discuss the loading twice issues further in #53590. |
I had the same issue with loading styles for editor using 'enqueue_block_editor_assets'. Using .wp-block {}` once into CSS helped me to make it work. @vyskoczilova thank you, it worked for me. |
Description
Hi, I just tested 6.3RC2, and I am scared about all my client’s sites that use Gutenberg. enqueue_block_editor_assets hook is fired. However, the style is not loaded inside the iframe as it supposes to be. This hook is super essential – most of the time other CSS (and WP itself) CSS mess it up, or you need to add just a little bit more to be able to style UX etc. (for example different REM size or what so ever, so you can’t reuse blocks/styles CSS 1:1).
Don’t release it as it is right now; this is not an unbreakable change. I’ve seen already some ways to go through the issue – for example including a block with apiVersion 2 etc.
Best regards,
Karolina
P.S. Reposted from: https://wordpress.org/support/topic/enqueue_block_editor_assets/
Step-by-step reproduction instructions
Create a simple plugin that adds CSS into the Gutenberg editor
Compare WP 6.2 and 6.3 outputs
Screenshots, screen recording, code snippet
Example working inside 6.2 but not on 6.3 (written as a two file plugin), file editor-assets-test.php
Content of style.css file:
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: