Editor stylesheet is loaded on `enqueue_block_editor_assets`; WordPress warns "fork-editor-css was added to the iframe incorrectly"
还没有人认领这个 Issue。
评估
调研方向
从 inc/Core.php 中第 107 行附近的 add_editor_styles() 方法开始,该方法会在 enqueue_block_editor_assets 上入队 assets/css/build/editor.css;也请阅读 setup(),其中声明了对 editor-styles 的支持。在以下两种做法中选择:用 add_editor_style() 注册样式表,或将入队操作移到带管理员检查的 enqueue_block_assets,同时留意 RTL 文件。完成意味着在开启 SCRIPT_DEBUG 时控制台警告消失,并且编辑器的画布在标题、按钮、引用、搜索和最新文章方面仍与前端一致。
由索引模型根据 Issue 内容生成。
描述
What's wrong
Every time the post editor or the Site Editor opens, with SCRIPT_DEBUG on, the browser console shows:
fork-editor-css was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.
Today WordPress still copies the stylesheet into the editor iframe, so Fork's editor styling works. The warning means that copying is a compatibility fallback. If WordPress removes it, the editor canvas loses Fork's editor styles (fonts, buttons, latest posts and the rest of assets/css/build/editor.css).
Cause
inc/Core.php enqueues the editor stylesheet with wp_enqueue_style() on enqueue_block_editor_assets (add_editor_styles(), line 107). That hook is meant for the editor's own UI, outside the iframe.
Steps to reproduce
- On a site with
SCRIPT_DEBUGon and Fork active, open any page in the editor, or open Appearance → Editor. - Open the browser console.
Expected: no warning about fork-editor-css.
Actual: the warning above, once per editor load. Seen on WordPress 6.7.12, 6.8, 7.1.5 and 7.2-RC2.
Suggested fix
Either:
- register it as an editor style:
add_editor_style( 'assets/css/build/editor.css' )insetup()(Fork already declaresadd_theme_support( 'editor-styles' )), keeping the RTL file in mind; or - enqueue it on
enqueue_block_assetswith anis_admin()check, so it goes into the iframe the supported way.
Afterwards, check that the editor canvas still matches the front end (headings, list items, table cells, quotes, buttons, search and latest posts).
- 主要语言
- PHP
- 星标
- 0
- 派生
- 0
- 平均合并
- 1 小时 2 分钟
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeinwp/fork 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 92/100
-
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 1/5 1 小时以内 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 1/5 1 小时以内 新手友好度 88/100
相似的 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 天内回复