可重用块在core/block
名称
我试图将其添加到allowed_block_types
过滤器,下面是一个示例:
add_filter( \'allowed_block_types\', \'wpse324908_allowed_block_types\', 10, 2 );
function wpse324908_allowed_block_types( $allowed_blocks, $post ) {
$allowed_blocks = array(
\'core/block\', // <-- Include to show reusable blocks in the block inserter.
\'core/image\',
\'core/paragraph\',
);
return $allowed_blocks;
}
如果至少还包括两个其他块,则显示了块插入器中可重复使用的块:
查看
/wp-includes/js/dist/editor.js
例如,我们可以查看此支票
core/block
关于在块插入器中包含可重用块:
var selectors_canIncludeReusableBlockInInserter = function canIncludeReusableBlockInInserter(state, reusableBlock, rootClientId) {
if (!selectors_canInsertBlockTypeUnmemoized(state, \'core/block\', rootClientId)) {
return false;
}