-
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
Hook for iframed block editor #33803
Comments
The iframe is a useful tool to ensure the correct behavior of device previews and media queries, as well as to protect the editing canvas from CSS bleed. But as you outline in this comment, there are lots of considerations to take in account, which is why the iframe project has a roadmap in #33346. The issues and pull requests linked from that road map are likely going to get more visibility. Some of the issues you outline are already addressed in PRs like #33389. Can you add your comments on one of those issues? |
Checked your topics. Yes, I agree, improvements in add_editor_style with option to attach dynamic inline styles should fix most of problems. But, another good feature will be to add hook which works only in the Iframe context. Wordpress has hooks for everything, so, I am expecting to have them also for iframe. Something like admin_iframe_head which will be attached to Iframe head section. |
Thanks for responding! Would you mind sharing that comment on the main thread instead? Then perhaps I can close this one so we keep it all in one place? |
Sure, Added comment with my thoughts |
Thank you. I'm closing this one in favor of that and we can always revisit! |
In current point, we have no access to iframe which is used in widget editor and template editor.
Let me explain. For example, we have option to choose custom fonts, colors in Customizer. Then, theme creates variables based on user choice. We load these css variables in header via wp_head and in admin panel via admin hooks. But this doesn't work in iframes.
In the current point iframes have only possibility to load static files with Block Meta API (which is very limited because it allows to attach only one style and one script to block, so, no possibilities for third party library) + add_editor_style function which is also very limited because you can use only static css files in it
We need some hook for iframes to allow developers to inject custom styles and scripts OR the possibility to attach something conditional via wp_add_inline... functions to iframe.
Also, in current point, environment becomes very complex. Previously we have Frontend and Backend scripts, now we have frontend, backend content context, backend widget context, backend template editor context, hooks and functions are not working across them, we need function which works across all backend context with option to choose context
The text was updated successfully, but these errors were encountered: