diff --git a/packages/block-editor/src/components/block-list/index.js b/packages/block-editor/src/components/block-list/index.js index 9f6130e95f7ae..96e46284d6b95 100644 --- a/packages/block-editor/src/components/block-list/index.js +++ b/packages/block-editor/src/components/block-list/index.js @@ -21,6 +21,7 @@ import { store as blockEditorStore } from '../../store'; import { usePreParsePatterns } from '../../utils/pre-parse-patterns'; import { LayoutProvider, defaultLayout } from './layout'; import BlockToolsBackCompat from '../block-tools/back-compat'; +import { useBlockSelectionClearer } from '../block-selection-clearer'; export const IntersectionObserver = createContext(); @@ -48,6 +49,7 @@ function Root( { className, children } ) { return (
{ if ( ! node ) { return; @@ -143,7 +149,7 @@ function Iframe( { contentRef, children, head, headHTML, ...props }, ref ) { function setDocumentIfReady() { const { contentDocument } = node; - const { readyState, body } = contentDocument; + const { readyState, body, documentElement } = contentDocument; if ( readyState !== 'interactive' && readyState !== 'complete' ) { return false; @@ -161,6 +167,8 @@ function Iframe( { contentRef, children, head, headHTML, ...props }, ref ) { bubbleEvents( contentDocument ); setBodyClassName( contentDocument ); setIframeDocument( contentDocument ); + clearerRef( documentElement ); + clearerRef( body ); return true; } diff --git a/packages/block-editor/src/components/use-canvas-click-redirect/index.js b/packages/block-editor/src/components/use-canvas-click-redirect/index.js index 58ace96e5623a..47c2711db6a9c 100644 --- a/packages/block-editor/src/components/use-canvas-click-redirect/index.js +++ b/packages/block-editor/src/components/use-canvas-click-redirect/index.js @@ -37,6 +37,13 @@ export function useCanvasClickRedirect() { return; } + const { bottom } = target.getBoundingClientRect(); + + // Ensure the click is below the last block. + if ( event.clientY < bottom ) { + return; + } + placeCaretAtHorizontalEdge( target, true ); event.preventDefault(); } diff --git a/packages/edit-post/src/components/visual-editor/index.js b/packages/edit-post/src/components/visual-editor/index.js index bc0cc88f9c164..8ec40471b77e4 100644 --- a/packages/edit-post/src/components/visual-editor/index.js +++ b/packages/edit-post/src/components/visual-editor/index.js @@ -159,7 +159,7 @@ export default function VisualEditor( { styles } ) { useBlockSelectionClearer(), ] ); - const blockSelectionClearerRef = useBlockSelectionClearer( true ); + const blockSelectionClearerRef = useBlockSelectionClearer(); const [ , RecursionProvider ] = useNoRecursiveRenders( wrapperUniqueId, diff --git a/packages/edit-post/src/components/visual-editor/style.scss b/packages/edit-post/src/components/visual-editor/style.scss index fecfda3fa3e6e..97fc66e137360 100644 --- a/packages/edit-post/src/components/visual-editor/style.scss +++ b/packages/edit-post/src/components/visual-editor/style.scss @@ -33,12 +33,6 @@ // color doesn't show through. background-color: $white; flex: 1; - - cursor: text; - - > * { - cursor: auto; - } } // Ideally this wrapper div is not needed but if we want to match the positioning of blocks diff --git a/packages/edit-site/src/components/block-editor/index.js b/packages/edit-site/src/components/block-editor/index.js index 109daadb92570..e168c40f7f258 100644 --- a/packages/edit-site/src/components/block-editor/index.js +++ b/packages/edit-site/src/components/block-editor/index.js @@ -14,7 +14,6 @@ import { BlockTools, __unstableBlockSettingsMenuFirstItem, __experimentalUseResizeCanvas as useResizeCanvas, - __unstableUseBlockSelectionClearer as useBlockSelectionClearer, __unstableUseTypingObserver as useTypingObserver, __unstableUseMouseMoveTypingReset as useMouseMoveTypingReset, __unstableEditorStyles as EditorStyles, @@ -57,11 +56,7 @@ export default function BlockEditor( { setIsInserterOpen } ) { const resizedCanvasStyles = useResizeCanvas( deviceType, true ); const ref = useMouseMoveTypingReset(); const contentRef = useRef(); - const mergedRefs = useMergeRefs( [ - contentRef, - useBlockSelectionClearer(), - useTypingObserver(), - ] ); + const mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] ); return (