Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,23 @@ function filter_headings_recursive($blocks)
}
}

if (isset($blocks['blockName']) && ($blocks['blockName'] === 'generateblocks/headline') && $innerBlock !== 'core/heading') {
$supported_third_party_blocks = array(
'generateblocks/headline', /* GenerateBlocks 1.x */
'generateblocks/text', /* GenerateBlocks 2.0 */
);

/**
* Filter to add supported third party blocks.
*
* @param array $supported_third_party_blocks The array of supported third party blocks.
* @return array The modified array of supported third party blocks.
*/
$supported_third_party_blocks = apply_filters(
'simpletoc_supported_third_party_blocks',
$supported_third_party_blocks
);

if (isset($blocks['blockName']) && in_array($blocks['blockName'], $supported_third_party_blocks) && $innerBlock !== 'core/heading') {
// make sure it's a headline.
if (preg_match("/(<h1|<h2|<h3|<h4|<h5|<h6)/i", $innerBlock)) {
$arr[] = $innerBlock;
Expand Down