Editor stylesheet is loaded on `enqueue_block_editor_assets`; WordPress warns "fork-editor-css was added to the iframe incorrectly"
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Bắt đầu trong inc/Core.php tại phương thức add_editor_styles() khoảng dòng 107, phương thức này đưa assets/css/build/editor.css vào hàng đợi trên enqueue_block_editor_assets; cũng hãy đọc setup() nơi hỗ trợ editor-styles được khai báo. Chọn giữa việc đăng ký stylesheet bằng add_editor_style() và chuyển việc đưa vào hàng đợi sang enqueue_block_assets kèm kiểm tra admin, lưu ý đến tệp RTL. Hoàn tất nghĩa là cảnh báo console đã biến mất khi bật SCRIPT_DEBUG và canvas của trình soạn thảo vẫn khớp với front end đối với tiêu đề, nút, trích dẫn, tìm kiếm và bài viết mới nhất.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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).
- Ngôn ngữ chính
- PHP
- Star
- 0
- Fork
- 0
- Merge trung bình
- 1 giờ 2 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Codeinwp/fork
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Tất cả issue của Codeinwp/fork
Issue tương tự
-
Change: check an identifier filter the same way in every tool - the order of somcp_search_ordersĐang mởconsistency enhancement Orders
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
novalo-dev/Prestashop-MCP-Server#343 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
claude
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
sprain/sprainocchio#45 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày