mirror of
https://fast.feibisi.com/https://github.com/lubusIN/visual-blueprint-builder.git
synced 2025-10-03 04:01:24 +08:00
Fix: Prevent duplicate block appender at root level (#62)
This commit is contained in:
parent
ab43690642
commit
bdc43e9320
1 changed files with 8 additions and 1 deletions
|
@ -11,10 +11,17 @@ wp.hooks.addFilter(
|
|||
return blockOrder[blockOrder.length - 1]; // Get the last block's clientId
|
||||
}, []);
|
||||
|
||||
const rootClientId = useSelect((select) =>
|
||||
select('core/block-editor').getBlockRootClientId(props.clientId),
|
||||
[props.clientId]
|
||||
);
|
||||
// Only show if it's the last root-level block (not inside reusable or inner blocks)
|
||||
const shouldShowAppender = props.clientId === lastBlockClientId && rootClientId === null;
|
||||
|
||||
return (
|
||||
<>
|
||||
<BlockEdit {...props} />
|
||||
{props.clientId === lastBlockClientId && (
|
||||
{shouldShowAppender && (
|
||||
<div className={'block-list-appender wp-block'}>
|
||||
<ButtonBlockAppender
|
||||
rootClientId={null} // Since we don't have nested blocks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue