Editor stylesheet triggers "added to the iframe incorrectly" warnings in the editors
还没有人认领这个 Issue。
评估
调研方向
从 inc/Core.php 第 56 行开始,assets/css/build/editor.css 及其内联 Neve 变量在 enqueue_block_editor_assets 上被 enqueue。然后检查已经声明支持 editor-styles 的主题设置 hook,因为修复会通过 add_editor_style() 把注册移到那里(或移到由 is_admin() 保护的 enqueue_block_assets 上),并将内联 CSS 保持在同一个 handle 上。完成的标准是:在开启 SCRIPT_DEBUG 的情况下加载区块编辑器和站点编辑器,并且在编辑器样式仍然生效的同时不显示 "added to the iframe incorrectly" 警告。
由索引模型根据 Issue 内容生成。
描述
Description
The theme's editor stylesheet is added the outdated way, so every time the block editor or the Site Editor opens, the browser console shows:
eduacademy-editor-css was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.
eduacademy-editor-inline-css was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.
inc/Core.php line 56 enqueues assets/css/build/editor.css (and the Neve-inherited inline CSS attached to it) on enqueue_block_editor_assets. That hook loads assets for the editor's outer page, not the iframed canvas. WordPress copies the styles into the canvas for now, and warns that this fallback is going away. Once it does, the editor would lose the theme's editor styles.
Step-by-step reproduction instructions
- With Eduacademy 1.0.1 active and
SCRIPT_DEBUGon (the warning prints with development scripts), open any page in the block editor, or Appearance → Editor. - Open the browser console.
Expected: no warning about Eduacademy's styles.
Actual: the two "added to the iframe incorrectly" warnings above, on every editor load.
Screenshots, screen recording, code snippet or Help Scout ticket
Fix suggestion: register the editor stylesheet for the canvas with add_editor_style() on after_setup_theme (the theme already declares editor-styles support). Alternatively, enqueue it on enqueue_block_assets guarded by is_admin(), and attach the inline Neve variables to that handle.
Found while adding Eduacademy to the WordPress compatibility checks (Codeinwp/qa-compatibility#168). The warning shows on WordPress 7.0.9, 7.1-RC1 and 7.1.5 alike.
Environment info
Eduacademy 1.0.1 (built from the v1.0.1 tag), WordPress 7.0.9 / 7.1-RC1 / 7.1.5, PHP 8.3, SCRIPT_DEBUG on, Chromium.
Is the issue you are reporting a regression
No
- 主要语言
- PHP
- 星标
- 0
- 派生
- 0
- 平均合并
- 22 小时 12 分钟
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeinwp/eduacademy 的其他 Issue
-
bug
难度 1/5 1 小时以内 新手友好度 84/100
Codeinwp/eduacademy#30 ·
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
Codeinwp/eduacademy#29 ·
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
Codeinwp/eduacademy#28 ·
-
bug
难度 3/5 1-2 天 新手友好度 62/100
Codeinwp/eduacademy#32 ·
-
难度 3/5 1-2 天 新手友好度 35/100
Codeinwp/eduacademy#6 ·
查看 Codeinwp/eduacademy 的全部 Issue
相似的 Issue
-
Change: check an identifier filter the same way in every tool - the order of somcp_search_orders未关闭consistency enhancement Orders
难度 1/5 1 小时以内 新手友好度 88/100
novalo-dev/Prestashop-MCP-Server#343 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
claude
难度 2/5 1-3 小时 新手友好度 72/100
sprain/sprainocchio#45 ·
维护者通常 1 天内回复
-
sync-en
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复
-
sync-en
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复