Skip to content

Commit

Permalink
fix table of content not working
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan-shafi committed Mar 12, 2024
1 parent 4dba914 commit 5011b83
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/blocks.build.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => '1b751209a223fdb9d3a8');
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'c98ee4ec86adce85e1a5');
1 change: 1 addition & 0 deletions dist/blocks.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -82947,6 +82947,7 @@ var TableOfContents = /*#__PURE__*/function (_Component2) {
var hasHeadings = Array.isArray(_this2.state.headers) && _this2.state.headers.length > 0;
var newHeaders = headers.map(function (header, i) {
return {
blockName: header.blockName,
clientId: header.clientId,
content: header.content,
level: header.level,
Expand Down
2 changes: 1 addition & 1 deletion dist/blocks.build.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ That's it. You're done!
* NEW: Number settings (Show Number, Number Prefix, Number Suffix) in the progress bar block.
* IMPROVE: Change default counter, and label font size in the counter block.
* FIX: Counter bug when change animation.
* FIX: Advanced heading not working in table of content.
* FIX: Image slider not showing properly in row block
* PRO: NEW: Load more pagination in post grid.
* PRO: FIX: Schema indexing error Bad escape sequence in string in review block.
Expand Down
6 changes: 5 additions & 1 deletion src/blocks/table-of-contents/block.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ function ub_makeListItem($num, $item, $listStyle, $blockID, $currentGaps){
$anchor = '#' . str_replace("themeisle-otter ", "", $item["anchor"]);
}
else{
$anchor = '#' . $item["anchor"];
if(isset($item['blockName']) && 'ub/advanced-heading' === $item['blockName']){
$anchor = '#ub-advanced-heading-' . $item["clientId"];
} else {
$anchor = '#' . $item["anchor"];
}
}

if(count($currentGaps) > $num && get_query_var('page') !== $currentGaps[$num]){
Expand Down
1 change: 1 addition & 0 deletions src/blocks/table-of-contents/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ class TableOfContents extends Component {
Array.isArray(this.state.headers) && this.state.headers.length > 0;

const newHeaders = headers.map((header, i) => ({
blockName: header.blockName,
clientId: header.clientId,
content: header.content,
level: header.level,
Expand Down

0 comments on commit 5011b83

Please sign in to comment.