From 2187ffed46e2e8d64b3cd0247d4f0bd83a054c54 Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Sat, 15 Feb 2025 21:19:48 +0800 Subject: [PATCH 1/3] Adding GB 2.0 compatibility and new filter for devs to update blocks. --- plugin.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/plugin.php b/plugin.php index 3a2145e..0754eff 100644 --- a/plugin.php +++ b/plugin.php @@ -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("/( Date: Sat, 15 Feb 2025 21:25:30 +0800 Subject: [PATCH 2/3] Fixing tabs vs spaces. --- plugin.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/plugin.php b/plugin.php index 0754eff..7df7436 100644 --- a/plugin.php +++ b/plugin.php @@ -313,21 +313,21 @@ function filter_headings_recursive($blocks) } } - $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 - ); + $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. From fe8c9942a973f39a88e97c3a2e3a5950b6f63a97 Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Sat, 15 Feb 2025 21:26:14 +0800 Subject: [PATCH 3/3] Fixing version. --- plugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.php b/plugin.php index 7df7436..22a90d3 100644 --- a/plugin.php +++ b/plugin.php @@ -640,7 +640,7 @@ function enqueue_accordion_frontend() 'simpletoc-accordion', plugin_dir_url(__FILE__) . 'assets/accordion.js', array(), - '6.6.0', + '6.6.1', true ); @@ -648,7 +648,7 @@ function enqueue_accordion_frontend() 'simpletoc-accordion', plugin_dir_url(__FILE__) . 'assets/accordion.css', array(), - '6.6.0' + '6.6.1' ); }