Skip to content

Commit

Permalink
fix(toc): use the correct function to render entries in toc
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Apr 2, 2024
1 parent 574e0f7 commit e3a27d2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ export default function install(config) {
'#BED3F3',
'#D4C4FB',
],
tocEntry: (block = {}, tocData) => {
tocEntries: (block = {}, tocData) => {
// integration with volto-block-toc
const headlines = tocData.levels || ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
let entries = [];
const sorted_column_blocks = getBlocks(block?.data || {});
sorted_column_blocks.forEach((column_block) => {
const sorted_blocks = getBlocks(column_block[1]);
sorted_blocks.forEach((block) => {
const columns = getBlocks(block?.data || {});
columns.forEach((column) => {
const blocks = getBlocks(column[1]);
blocks.forEach((block) => {
const { value, plaintext } = block[1];
const type = value?.[0]?.type;
if (headlines.includes(type)) {
Expand Down

0 comments on commit e3a27d2

Please sign in to comment.