Editor stylesheet is loaded on `enqueue_block_editor_assets`; WordPress warns "fork-editor-css was added to the iframe incorrectly"
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
調査の方向性
inc/Core.php の 107 行目あたりにある add_editor_styles() メソッドから始めてください。このメソッドは enqueue_block_editor_assets で assets/css/build/editor.css をエンキューします。また、editor-styles のサポートが宣言されている setup() も読んでください。スタイルシートを 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分
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 日以内に返信