diff --git a/apps/desktop/src/components/editor-area/index.tsx b/apps/desktop/src/components/editor-area/index.tsx index 811442373..27a086edb 100644 --- a/apps/desktop/src/components/editor-area/index.tsx +++ b/apps/desktop/src/components/editor-area/index.tsx @@ -258,9 +258,34 @@ export function useEnhanceMutation({ const [actualIsLocalLlm, setActualIsLocalLlm] = useState(isLocalLlm); const queryClient = useQueryClient(); + // ✅ Extract H1 headers at component level (always available) + const extractH1Headers = useCallback((htmlContent: string): string[] => { + if (!htmlContent) return []; + + const h1Regex = /