From 3d7bd3075bc57062bfd4f915fce3702c90eb2401 Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Wed, 10 Apr 2024 11:39:31 +1200 Subject: [PATCH] Revert "Make sure the CSS class id-dark-theme is added to the editor iframe body. (#60300)" (#60616) This reverts commit a4ae81305699487f3fc1fad28620605cf879bca4. Co-authored-by: glendaviesnz Co-authored-by: ramonjd --- .../src/components/iframe/index.js | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/packages/block-editor/src/components/iframe/index.js b/packages/block-editor/src/components/iframe/index.js index c4454d17ff003a..e59e564da3e6a8 100644 --- a/packages/block-editor/src/components/iframe/index.js +++ b/packages/block-editor/src/components/iframe/index.js @@ -141,13 +141,6 @@ function Iframe( { function onLoad() { const { contentDocument, ownerDocument } = node; const { documentElement } = contentDocument; - // Get any CSS classes the iframe document body may initially have - // to re-apply them later together with the ones of the main document - // body. This is necessary for some CSS classes for example the - // `is-dark-theme` class added by useDarkThemeBodyClassName. - const initialIframeBodyClasses = Array.from( - contentDocument.body.classList - ); iFrameDocument = contentDocument; documentElement.classList.add( 'block-editor-iframe__html' ); @@ -158,15 +151,12 @@ function Iframe( { // be added in the editor too, which we'll somehow have to get from // the server in the future (which will run the PHP filters). setBodyClasses( - Array.from( ownerDocument.body.classList ) - .concat( initialIframeBodyClasses ) - .filter( - ( name ) => - name.startsWith( 'admin-color-' ) || - name.startsWith( 'post-type-' ) || - name === 'wp-embed-responsive' || - name === 'is-dark-theme' - ) + Array.from( ownerDocument.body.classList ).filter( + ( name ) => + name.startsWith( 'admin-color-' ) || + name.startsWith( 'post-type-' ) || + name === 'wp-embed-responsive' + ) ); contentDocument.dir = ownerDocument.dir;