-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Post Editor: Set the default value of the editorTool to edit #66636
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -62,6 +62,7 @@ export function initializeEditor( | |||
dispatch( preferencesStore ).setDefaults( 'core', { | |||
allowRightClickOverrides: true, | |||
editorMode: 'visual', | |||
editorTool: 'edit', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to initialize the default value to edit here? Or we could just change the condition here to editorMode !== 'navigation'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on the fence here. On one hand, I don't think it would cause much harm to set the default here, but then we'd probably to add a default for edit-post
too (and would it also be 'edit'
? probably). On the other hand, fixing the condition to editorMode !== 'navigation'
seems to more precisely target the underlying issue, which is that hiding the side inserter should be seen as the exception and not the norm — and once you fix that you don't care which editor you're in, nor what state is persisted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes agreed, changing the condition for rendering the inserter would be preferable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was the right fix (adding the default) because there could be a lot more places impacted than just the inserter check. That said, I would love for us to avoid these imperative setDefault
calls somehow at some point, it doesn't feel like a great API. Or maybe the "setDefaults" are not done in the right place, we shouldn't have to duplicate this code everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That said, I would love for us to avoid these imperative
setDefault
calls somehow at some point, it doesn't feel like a great API. Or maybe the "setDefaults" are not done in the right place, we shouldn't have to duplicate this code everywhere
+1
Size Change: +12 B (0%) Total Size: 1.81 MB
ℹ️ View Unchanged
|
I tested this PR, but it doesn't fix the issue for me. That said, I did not delete existing persisted data, because a normal user can't do that. Also, I have difficulty understanding how the inserter is missing because of a default value. Why not adjust the conditions for which the inserter appears? |
The more I think about this, the more I think the fix should be twofold:
|
@ellatrix The value might not be
I think it's better to give it the default value for the long term as @mcsf suggested. It doesn't make sense that |
I've updated the PR as follows
|
Flaky tests detected in 421541d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11623314338
|
Is this likely to get backported to 19.6? |
I just cherry-picked this PR to the release/19.5 branch to get it included in the next release: d65a196 |
* 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
* 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
I just cherry-picked this PR to the release/19.6 branch to get it included in the next release: 9b9a367 |
…ss#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
What?
Fixes #66632.
Fix the
editorTool
might not be initialized on the post editor.Why?
Referring to #66632, the block inserter is missing because the
editorMode
is notedit
How?
Initialize the default value of the
editorTool
to theedit
on the post editor. Note that the site editor initializes the value here, and the tool selector just checks whether the value is navigation.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast