From b69bca9ebf90ca6c39d11b966e4a0e2f9f9fd612 Mon Sep 17 00:00:00 2001 From: arthur791004 Date: Fri, 1 Nov 2024 20:36:48 +0900 Subject: [PATCH] Post Editor: Set the default value of the editorTool to edit (#66636) * Post Editor: Set the default value of the editorTool to edit * Change the condition of _showEmptyBlockSideInserter * Set the default value of the editorTool to "edit" for both post editor and site editor --- .../src/components/block-tools/use-show-block-tools.js | 4 +++- packages/edit-post/src/index.js | 1 + packages/edit-post/src/index.native.js | 1 + packages/edit-site/src/index.js | 1 + packages/edit-site/src/posts.js | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/block-tools/use-show-block-tools.js b/packages/block-editor/src/components/block-tools/use-show-block-tools.js index 61b5be891fd54..db651bce00fec 100644 --- a/packages/block-editor/src/components/block-tools/use-show-block-tools.js +++ b/packages/block-editor/src/components/block-tools/use-show-block-tools.js @@ -40,7 +40,9 @@ export function useShowBlockTools() { const _showEmptyBlockSideInserter = clientId && ! isTyping() && - editorMode === 'edit' && + // Hide the block inserter on the navigation mode. + // See https://github.com/WordPress/gutenberg/pull/66636#discussion_r1824728483. + editorMode !== 'navigation' && isEmptyDefaultBlock; const _showBlockToolbarPopover = ! getSettings().hasFixedToolbar && diff --git a/packages/edit-post/src/index.js b/packages/edit-post/src/index.js index 685ffc56f63a8..b01fa693ed5a7 100644 --- a/packages/edit-post/src/index.js +++ b/packages/edit-post/src/index.js @@ -62,6 +62,7 @@ export function initializeEditor( dispatch( preferencesStore ).setDefaults( 'core', { allowRightClickOverrides: true, editorMode: 'visual', + editorTool: 'edit', fixedToolbar: false, hiddenBlockTypes: [], inactivePanels: [], diff --git a/packages/edit-post/src/index.native.js b/packages/edit-post/src/index.native.js index 613f394134e0c..d26ddf7b8a25c 100644 --- a/packages/edit-post/src/index.native.js +++ b/packages/edit-post/src/index.native.js @@ -29,6 +29,7 @@ export function initializeEditor( id, postType, postId ) { welcomeGuide: true, } ); dispatch( preferencesStore ).setDefaults( 'core', { + editorTool: 'edit', hiddenBlockTypes: [], inactivePanels: [], openPanels: [ 'post-status' ], diff --git a/packages/edit-site/src/index.js b/packages/edit-site/src/index.js index 83d25bcd0c03a..7f124e6b5f7ac 100644 --- a/packages/edit-site/src/index.js +++ b/packages/edit-site/src/index.js @@ -68,6 +68,7 @@ export function initializeEditor( id, settings ) { allowRightClickOverrides: true, distractionFree: false, editorMode: 'visual', + editorTool: 'edit', fixedToolbar: false, focusMode: false, inactivePanels: [], diff --git a/packages/edit-site/src/posts.js b/packages/edit-site/src/posts.js index 78d823b56c4c1..9c31fdd0040ca 100644 --- a/packages/edit-site/src/posts.js +++ b/packages/edit-site/src/posts.js @@ -65,6 +65,7 @@ export function initializePostsDashboard( id, settings ) { allowRightClickOverrides: true, distractionFree: false, editorMode: 'visual', + editorTool: 'edit', fixedToolbar: false, focusMode: false, inactivePanels: [],