Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Move the edit template blocks notification to editor package #56901

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
NAVIGATION_POST_TYPE,
} from '../../utils/constants';
import { unlock } from '../../lock-unlock';
import PageContentFocusNotifications from '../page-content-focus-notifications';

export default function SiteEditorCanvas() {
const { clearSelectedBlock } = useDispatch( blockEditorStore );
Expand Down Expand Up @@ -60,50 +59,46 @@ export default function SiteEditorCanvas() {
const forceFullHeight = isNavigationFocusMode;

return (
<>
<EditorCanvasContainer.Slot>
{ ( [ editorCanvasView ] ) =>
editorCanvasView ? (
<div className="edit-site-visual-editor is-focus-mode">
{ editorCanvasView }
</div>
) : (
<BlockTools
className={ classnames( 'edit-site-visual-editor', {
'is-focus-mode':
isFocusMode || !! editorCanvasView,
'is-view-mode': isViewMode,
} ) }
__unstableContentRef={ contentRef }
onClick={ ( event ) => {
// Clear selected block when clicking on the gray background.
if ( event.target === event.currentTarget ) {
clearSelectedBlock();
}
} }
<EditorCanvasContainer.Slot>
{ ( [ editorCanvasView ] ) =>
editorCanvasView ? (
<div className="edit-site-visual-editor is-focus-mode">
{ editorCanvasView }
</div>
) : (
<BlockTools
className={ classnames( 'edit-site-visual-editor', {
'is-focus-mode': isFocusMode || !! editorCanvasView,
'is-view-mode': isViewMode,
} ) }
__unstableContentRef={ contentRef }
onClick={ ( event ) => {
// Clear selected block when clicking on the gray background.
if ( event.target === event.currentTarget ) {
clearSelectedBlock();
}
} }
>
<BackButton />
<ResizableEditor
enableResizing={ enableResizing }
height={
sizes.height && ! forceFullHeight
? sizes.height
: '100%'
}
>
<BackButton />
<ResizableEditor
<EditorCanvas
enableResizing={ enableResizing }
height={
sizes.height && ! forceFullHeight
? sizes.height
: '100%'
}
settings={ settings }
contentRef={ contentRef }
>
<EditorCanvas
enableResizing={ enableResizing }
settings={ settings }
contentRef={ contentRef }
>
{ resizeObserver }
</EditorCanvas>
</ResizableEditor>
</BlockTools>
)
}
</EditorCanvasContainer.Slot>
<PageContentFocusNotifications contentRef={ contentRef } />
</>
{ resizeObserver }
</EditorCanvas>
</ResizableEditor>
</BlockTools>
)
}
</EditorCanvasContainer.Slot>
);
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { useEffect, useState, useRef } from '@wordpress/element';
import { store as noticesStore } from '@wordpress/notices';
import { __ } from '@wordpress/i18n';
import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
import { store as editorStore } from '@wordpress/editor';

/**
* Internal dependencies
*/
import { store as editorStore } from '../../store';

/**
* Component that:
Expand All @@ -22,7 +26,7 @@ import { store as editorStore } from '@wordpress/editor';
* @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block
* editor iframe canvas.
*/
export default function EditTemplateNotification( { contentRef } ) {
export default function EditTemplateBlocksNotification( { contentRef } ) {
const renderingMode = useSelect(
( select ) => select( editorStore ).getRenderingMode(),
[]
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/components/editor-canvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { useMergeRefs } from '@wordpress/compose';
import PostTitle from '../post-title';
import { store as editorStore } from '../../store';
import { unlock } from '../../lock-unlock';
import EditTemplateBlocksNotification from './edit-template-blocks-notification';

const {
LayoutStyle,
Expand Down Expand Up @@ -361,6 +362,7 @@ function EditorCanvas(
}
renderAppender={ renderAppender }
/>
<EditTemplateBlocksNotification contentRef={ localRef } />
</RecursionProvider>
{ children }
</BlockCanvas>
Expand Down
Loading