-
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
Block Editor: Check for multiple block usage in the block-editor package #62086
Block Editor: Check for multiple block usage in the block-editor package #62086
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. |
Size Change: -309 B (-0.02%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
923bf2f
to
276e906
Compare
onReplace, | ||
} ) { | ||
const { selectBlock } = useDispatch( blockEditorStore ); | ||
const blockType = getBlockType( name ); |
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.
Should we use the store here?
@@ -49,6 +53,7 @@ export default function BlockEdit( { | |||
const layoutSupport = | |||
hasBlockSupport( name, 'layout', false ) || | |||
hasBlockSupport( name, '__experimentalLayout', false ); | |||
const originalBlockClientId = useOriginalBlockOnlyUseOnce( clientId ); |
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.
Not sure I like this, we are adding another block-editor subscription. Could you move this to the private context provider where we select all the needed data for a block?
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.
We can :) just noting that we were already doing this though.
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.
Let me know if I did it properly.
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.
Looks like we have an e2e test so that's good :)
…age (WordPress#62086) Co-authored-by: youknowriad <[email protected]> Co-authored-by: ellatrix <[email protected]>
The code was commented because it was breaking the build after dependencies update. The functionality is now directly included in the block editor so we can safely remove the code. See WordPress/gutenberg#62086 [MAILPOET-6054]
The code was commented because it was breaking the build after dependencies update. The functionality is now directly included in the block editor so we can safely remove the code. See WordPress/gutenberg#62086 [MAILPOET-6054]
The code was commented because it was breaking the build after dependencies update. The functionality is now directly included in the block editor so we can safely remove the code. See WordPress/gutenberg#62086 [MAILPOET-6054]
The code was commented because it was breaking the build after dependencies update. The functionality is now directly included in the block editor so we can safely remove the code. See WordPress/gutenberg#62086 [MAILPOET-6054]
…age (WordPress#62086) Co-authored-by: youknowriad <[email protected]> Co-authored-by: ellatrix <[email protected]>
The code was commented because it was breaking the build after dependencies update. The functionality is now directly included in the block editor so we can safely remove the code. See WordPress/gutenberg#62086 [MAILPOET-6054]
Related #52632
What?
While navigating the post editor code base, I noticed that we have some code that shows a warning when a block that doesn't allow multiple usage is used more than once.
That said, this code has nothing specific to the post editor and should be something that is bundled in the block-editor package to work in all contexts (like the site editor).
Testing instructions
1- Create a page with a "more" block.
2- Copy/paste the block to insert it twice
3- Notice the warning message
4- Save the page and open it in the site editor
5- The warning should still be visible.