How to lock innerBlocks within a block variation?

I think I’ve figured this out. Instead of creating a block variation, I just created a brand new block using a block template. import { registerBlockType } from “@wordpress/blocks”; import { useBlockProps, InnerBlocks } from “@wordpress/block-editor”; const BLOCKS_TEMPLATE = [ [“core/heading”, { level: 2, placeholder: “Heading” }], [“core/gallery”, {}], ]; registerBlockType(“logo-grid”, { apiVersion: 2, title: … Read more

Gutenberg get index of gutenberg innerblock

You may now retrieve the index of a inner block via the core/block-editor data module. You may pair it with the useSelect hook to keep the indexes up to date on changes. Something like this. Intentionally verbose for clarity. import {useSelect} from ‘@wordpress/data’; const Answer = ( blockProps ) => { const {index} = useSelect( … Read more

Detect if a block has been deleted

Maybe you will find this snippet helpful. I’m still searching for a better way to do this but as far as I can tell blocks are not aware of their own deletion. Instead we have to monitor the blocks from above. If you have a parent block type that has children, you can subscribe to … Read more

WordPress npm run build and start only outputs wp-scripts start but does nothing

I’ve managed to pull and get it to run as I would expect. $ npm run start:random-game > [email protected] start:random-game C:\Users\…\game-review-block > wp-scripts start blocks/random-game/src/index.js –output-path=blocks/random-game/build/ <i> [LiveReloadPlugin] Live Reload listening on port 35729 asset index.js 25.4 KiB [emitted] (name: index) 1 related asset asset style-index.css 858 bytes [emitted] (name: style-index) (id hint: style) 1 … Read more

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş