Table block – Wrap table

You can search for the <table> strings and replace them with the wrapper element: function pb_table_render_block($block_content, $block) { if ($block[‘blockName’] == ‘core/table’) { $block_content = str_replace(‘<table’, ‘<div class=”table-wrapper”><table’, $block_content); $block_content = str_replace(‘</table>’, ‘</table></div>’, $block_content); } return $block_content; } add_filter(‘render_block’, ‘pb_table_render_block’, 10, 2);

useSelect in block Edit always returns default store value

It turned out that allItems gets populated …eventually. So the code in the beginning of the block must be extended to respond when allItems is populated: export default function Edit(props) { const { attributes, setAttributes } = props; const allItems = useSelect(select => select(‘REST-extra_table’).readItems(LECTURERS_TABLE)); const [populated, setPopulated] = useState(false); if (! populated && allItems.length !== … Read more

Quasy – modal component does not hide itself

The problem is that you’re using setIsOpen() incorrectly. Your code initialises isOpen as false, and your code implies that it can be either true or false, but that’s not what you’re setting it as. The setIsOpen() function updates isOpen to the value you pass to it, and you’re passing an object with an isOpen property, … Read more

Gutenberg InnerBlocks allowed types and reusable blocks

Yes, “why you can’t insert a reusable block inside your custom block when you’ve used alllowedBlocks?” This is what I am trying to get This is because you haven’t allowed them: allowedBlocks={[‘example/children’]} The list of allowed blocks does not include reusable blocks ( core/block ), so they are not allowed and cannot be inserted. Add … Read more