CYS: fix: Assembler follows admin color schema (#49159)
* CYS: fix: Assembler follows admin color schema * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
1675c63bba
commit
9fc207b1a6
|
@ -39,6 +39,8 @@ function Iframe( {
|
|||
} ) {
|
||||
const [ iframeDocument, setIframeDocument ] = useState();
|
||||
|
||||
const [ bodyClasses, setBodyClasses ] = useState( [] );
|
||||
|
||||
const { resolvedAssets } = useSelect( ( select ) => {
|
||||
const settings = select( blockEditorStore ).getSettings();
|
||||
|
||||
|
@ -54,6 +56,28 @@ function Iframe( {
|
|||
node._load = () => {
|
||||
setIframeDocument( node.contentDocument );
|
||||
};
|
||||
function onLoad() {
|
||||
const { contentDocument, ownerDocument } = node;
|
||||
const { documentElement } = contentDocument;
|
||||
|
||||
documentElement.classList.add( 'block-editor-iframe__html' );
|
||||
|
||||
setBodyClasses(
|
||||
Array.from( ownerDocument?.body.classList ).filter(
|
||||
( name ) =>
|
||||
name.startsWith( 'admin-color-' ) ||
|
||||
name.startsWith( 'post-type-' ) ||
|
||||
name === 'wp-embed-responsive'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
node.addEventListener( 'load', onLoad );
|
||||
|
||||
return () => {
|
||||
delete node._load;
|
||||
node.removeEventListener( 'load', onLoad );
|
||||
};
|
||||
}, [] );
|
||||
|
||||
const disabledRef = useDisabled( { isDisabled: ! readonly } );
|
||||
|
@ -125,7 +149,8 @@ function Iframe( {
|
|||
ref={ bodyRef }
|
||||
className={ clsx(
|
||||
'block-editor-iframe__body',
|
||||
'editor-styles-wrapper'
|
||||
'editor-styles-wrapper',
|
||||
...bodyClasses
|
||||
) }
|
||||
>
|
||||
{ contentResizeListener }
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: fix
|
||||
|
||||
CYS: fix: Assembler follows admin color schema.
|
Loading…
Reference in New Issue