Skip to content

Commit

Permalink
Rename the iframeDocument prop
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Apr 23, 2021
1 parent f6539b7 commit 06790fd
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function BlockControlsFill( {
const Fill = groups[ group ].Fill;

return (
<StyleProvider iframeDocument={ document }>
<StyleProvider document={ document }>
<Fill>
{ ( fillProps ) => {
// Children passed to BlockControlsFill will not have access to any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
*/
function BlockSettingsMenuControls( { ...props } ) {
return (
<StyleProvider iframeDocument={ document }>
<StyleProvider document={ document }>
<Fill { ...props } />
</StyleProvider>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function Iframe( { contentRef, children, head, headHTML, ...props }, ref ) {
>
{ iframeDocument &&
createPortal(
<StyleProvider iframeDocument={ iframeDocument }>
<StyleProvider document={ iframeDocument }>
{ children }
</StyleProvider>,
iframeDocument.body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const { Fill, Slot } = createSlotFill( name );
function InspectorAdvancedControls( { children } ) {
const { isSelected } = useBlockEditContext();
return isSelected ? (
<StyleProvider iframeDocument={ document }>
<StyleProvider document={ document }>
<Fill>{ children }</Fill>
</StyleProvider>
) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { Fill, Slot } = createSlotFill( 'InspectorControls' );

function InspectorControls( { children } ) {
return useDisplayBlockControls() ? (
<StyleProvider iframeDocument={ document }>
<StyleProvider document={ document }>
<Fill>{ children }</Fill>
</StyleProvider>
) : null;
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/style-provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const memoizedCreateCacheWithContainer = memoize( ( container ) => {
return createCache( { container } );
} );

export default function StyleProvider( { children, iframeDocument } ) {
if ( ! iframeDocument ) {
export default function StyleProvider( { children, document } ) {
if ( ! document ) {
return null;
}

const cache = memoizedCreateCacheWithContainer( iframeDocument.head );
const cache = memoizedCreateCacheWithContainer( document.head );

return <CacheProvider value={ cache }>{ children }</CacheProvider>;
}

0 comments on commit 06790fd

Please sign in to comment.