From e75744aa91e8f93be811aee51e24be320247a53b Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Fri, 20 Sep 2024 16:35:02 -0400 Subject: [PATCH 1/2] fix: Remove redundant `getEditorSettings` invocation This appears to already be invoked by the `EditorProvider`. The redundant invocation was likely erroneously left in place when we began using the `EditorProvider` recently. https://github.com/wordpress-mobile/GutenbergKit/pull/24 https://github.com/WordPress/gutenberg/blob/219065c3be5881a68a8667fda9c04c7b7f546763/packages/editor/src/components/provider/index.js#L178 --- ReactApp/src/components/Editor.jsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ReactApp/src/components/Editor.jsx b/ReactApp/src/components/Editor.jsx index 20579e35b..f970a7280 100644 --- a/ReactApp/src/components/Editor.jsx +++ b/ReactApp/src/components/Editor.jsx @@ -12,7 +12,6 @@ import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks'; import { registerCoreBlocks } from '@wordpress/block-library'; import { parse, serialize } from '@wordpress/blocks'; import { - store as editorStore, mediaUpload, EditorProvider, EditorSnackbars, @@ -77,14 +76,12 @@ function Editor({ post }) { const { blockPatterns, currentPost, - editorSettings, hasLoadedPost, hasUploadPermissions, reusableBlocks, } = useSelect((select) => { const { getEntityRecord, getEntityRecords, hasFinishedResolution } = select(coreStore); - const { getEditorSettings } = select(editorStore); const user = getEntityRecord('root', 'user', post.author); const currentPost = getEntityRecord('postType', post.type, post.id); const hasLoadedPost = post?.id @@ -98,7 +95,6 @@ function Editor({ post }) { return { blockPatterns: select(coreStore).getBlockPatterns(), currentPost, - editorSettings: getEditorSettings(), hasLoadedPost, hasUploadPermissions: user?.capabilities?.upload_files ?? true, reusableBlocks: getEntityRecords('postType', 'wp_block'), @@ -132,13 +128,12 @@ function Editor({ post }) { const settings = useMemo( () => ({ - ...editorSettings, hasFixedToolbar: true, mediaUpload: hasUploadPermissions ? mediaUpload : undefined, __experimentalReusableBlocks: reusableBlocks, __experimentalBlockPatterns: blockPatterns, }), - [blockPatterns, editorSettings, hasUploadPermissions, reusableBlocks] + [blockPatterns, hasUploadPermissions, reusableBlocks] ); const styles = useEditorStyles(); From 5a73bfaa1f3b09f023132957f5293f8ac04f1ff3 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Fri, 20 Sep 2024 16:36:43 -0400 Subject: [PATCH 2/2] fix: Disable the editor sub-registry Reinstate the editor singleton registry so that third-party blocks may query the block editor state. --- ReactApp/src/components/Editor.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ReactApp/src/components/Editor.jsx b/ReactApp/src/components/Editor.jsx index f970a7280..643c3fcfc 100644 --- a/ReactApp/src/components/Editor.jsx +++ b/ReactApp/src/components/Editor.jsx @@ -145,7 +145,11 @@ function Editor({ post }) { return ( hasLoadedPost && (
- +