Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .plugin-data
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "1.0.5",
"version": "1.0.6",
"slug": "blockparty-table-of-content"
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.6 - 2026-08-28

* Fix frontend TOC initialization by waiting for DOMContentLoaded

## 1.0.5 - 2026-06-25

* Rename plugin to "Blockparty Table of content"
Expand Down
4 changes: 2 additions & 2 deletions blockparty-table-of-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Description: A table of content block.
* Requires at least: 6.0
* Requires PHP: 7.4
* Version: 1.0.5
* Version: 1.0.6
* Author: Be API Technical team
* Author URI: https://beapi.fr
* License: GPL-2.0-or-later
Expand All @@ -16,7 +16,7 @@

namespace Beapi\Toc_Block;

define( 'BEAPI_TOC_BLOCK_VERSION', '1.0.5' );
define( 'BEAPI_TOC_BLOCK_VERSION', '1.0.6' );
define( 'BEAPI_TOC_BLOCK_URL', plugin_dir_url( __FILE__ ) );
define( 'BEAPI_TOC_BLOCK_DIR', plugin_dir_path( __FILE__ ) );
define( 'BEAPI_TOC_BLOCK_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blockparty-table-of-content",
"version": "1.0.5",
"version": "1.0.6",
"description": "A table of content block.",
"author": "Be API Technical team",
"license": "GPL-2.0-or-later",
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: beapi
Tags: block, table of content
Tested up to: 6.5
Stable tag: 1.0.5
Stable tag: 1.0.6
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -17,6 +17,9 @@ This plugin adds a block to the WordPress block editor that allows you to add a

== Changelog ==

= 1.0.6 =
* Fix frontend TOC initialization by waiting for DOMContentLoaded

= 1.0.5 =
* Rename plugin to "Blockparty Table of content"
* Improve heading level selector in the block editor with an icon toggle group
Expand Down
6 changes: 2 additions & 4 deletions src/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "blockparty/table-of-content",
"version": "1.0.5",
"version": "1.0.6",
"title": "Table of content",
"category": "widgets",
"icon": "editor-ul",
Expand All @@ -24,9 +24,7 @@
},
"levels": {
"type": "array",
"default": [
2
]
"default": [ 2 ]
},
"sticky": {
"type": "boolean",
Expand Down
10 changes: 8 additions & 2 deletions src/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,17 @@ class TOC {
};
}

window.addEventListener( 'load', function () {
function initTableOfContent() {
const tocBlocks = document.querySelectorAll(
'.blockparty-table-of-content'
);
for ( let i = 0; i < tocBlocks.length; i++ ) {
new TOC( tocBlocks[ i ] );
}
} );
}

if ( document.readyState === 'loading' ) {
document.addEventListener( 'DOMContentLoaded', initTableOfContent );
} else {
initTableOfContent();
}
Loading