Editor stylesheet triggers "added to the iframe incorrectly" warnings in the editors
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 74/100
Direzione di ricerca
Inizia da inc/Core.php alla riga 56, dove assets/css/build/editor.css e le sue variabili inline di Neve vengono messe in coda su enqueue_block_editor_assets. Poi controlla l'hook di setup del tema che dichiara già il supporto a editor-styles, poiché la correzione sposta lì la registrazione tramite add_editor_style() (oppure su enqueue_block_assets protetto da is_admin()), mantenendo il CSS inline sullo stesso handle. Fatto significa che l'editor a blocchi e il Site Editor si caricano con SCRIPT_DEBUG attivo e non mostrano avvisi "added to the iframe incorrectly" mentre gli stili dell'editor continuano ad applicarsi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- PHP
- Stelle
- 0
- Fork
- 0
- Merge medio
- 22h 12m
- PR unite (30g)
- 6
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Codeinwp/eduacademy
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
Codeinwp/eduacademy#30 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Codeinwp/eduacademy#29 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Codeinwp/eduacademy#28 ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
Codeinwp/eduacademy#32 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
Codeinwp/eduacademy#6 ·
Tutte le issue di Codeinwp/eduacademy
Issue simili
-
Change: check an identifier filter the same way in every tool - the order of somcp_search_ordersApertaconsistency enhancement Orders
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
novalo-dev/Prestashop-MCP-Server#343 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
claude
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
sprain/sprainocchio#45 ·
I maintainer di solito rispondono entro 1 giorno
-
sync-en
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
sync-en
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno