From 431c331154a10d59353a0fb260a7ee933abb9bdb Mon Sep 17 00:00:00 2001 From: Cyril Date: Wed, 1 Oct 2025 09:18:29 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(frontend)=20exclude=20h4-h6=20heading?= =?UTF-8?q?s=20from=20table=20of=20contents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit filters out h4-h6 so they no longer appear in the document outline Signed-off-by: Cyril --- CHANGELOG.md | 1 + .../features/docs/doc-editor/stores/useHeadingStore.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb06ec14..e2f8c9d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ and this project adheres to - 🐛(frontend) fix legacy role computation #1376 - 🛂(frontend) block editing title when not allowed #1412 - 🐛(frontend) scroll back to top when navigate to a document #1406 +- 🐛(frontend) exclude h4-h6 headings from table of contents #1441 - 🔒(frontend) prevent readers from changing callout emoji #1449 ## [3.7.0] - 2025-09-12 diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/stores/useHeadingStore.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/stores/useHeadingStore.tsx index c77ac3cf..17e90e3c 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/stores/useHeadingStore.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/stores/useHeadingStore.tsx @@ -29,7 +29,12 @@ export const useHeadingStore = create((set, get) => ({ headings: [], setHeadings: (editor) => { const headingBlocks = editor?.document - .filter((block) => block.type === 'heading') + .filter( + (block) => + block.type === 'heading' && + block.props.level >= 1 && + block.props.level <= 3, + ) .map((block) => ({ ...block, contentText: recursiveTextContent(