diff --git a/src/renderer/components/Editor/MarkdownEditor.tsx b/src/renderer/components/Editor/MarkdownEditor.tsx index 483f887..409b1f5 100644 --- a/src/renderer/components/Editor/MarkdownEditor.tsx +++ b/src/renderer/components/Editor/MarkdownEditor.tsx @@ -130,7 +130,6 @@ export function analyseAnnotation( const text = accumulated || ann.message const suggestion = extractBlockquote(text) ?? ann.suggestion ?? null tooltipAnalysisCache.set(ann.id, { text, suggestion }) - window.dispatchEvent(new CustomEvent('annotation-cached', { detail: { id: ann.id } })) onUpdate(text, false, suggestion) }).catch(() => { if (!cancelled) onUpdate(ann.message, false, ann.suggestion ?? null) @@ -138,7 +137,6 @@ export function analyseAnnotation( } else { const suggestion = ann.suggestion ?? null tooltipAnalysisCache.set(ann.id, { text: ann.message, suggestion }) - window.dispatchEvent(new CustomEvent('annotation-cached', { detail: { id: ann.id } })) onUpdate(ann.message, false, suggestion) } @@ -248,8 +246,11 @@ const annotationHoverTooltip = hoverTooltip( const cancelAnalysis = analyseAnnotation(ann, (text, streaming, suggestion) => { showText(text, streaming) - if (!streaming && suggestion && !dom.querySelector('.annotation-tooltip-apply')) { - showApplyButton(suggestion) + if (!streaming) { + window.dispatchEvent(new CustomEvent('annotation-cached', { detail: { id: ann.id } })) + if (suggestion && !dom.querySelector('.annotation-tooltip-apply')) { + showApplyButton(suggestion) + } } })