new text editor block that contains core blocks as inner blocks and prevents them from being used at top level

This commit is contained in:
2025-11-27 07:14:31 +00:00
parent 00d0861014
commit 0055a25420
17 changed files with 218 additions and 45 deletions

View File

@@ -0,0 +1,12 @@
export default function isInsideMyACFBlock(blockName)
{
const editor = wp.data.select('core/block-editor');
const selectedId = editor.getSelectedBlockClientId();
if (!selectedId) return false;
const parents = editor.getBlockParents(selectedId);
const parentNames = parents.map(id => editor.getBlockName(id));
return parentNames.includes(blockName);
}