From e3a27d2065534a87feba83c68d286520d2dccee8 Mon Sep 17 00:00:00 2001 From: Miu Razvan Date: Tue, 2 Apr 2024 13:49:33 +0300 Subject: [PATCH] fix(toc): use the correct function to render entries in toc --- src/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index 54dfe24..27f79e9 100644 --- a/src/index.js +++ b/src/index.js @@ -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)) {