From 9c8e3bc33f39d2478b6f1ff18708bf0d50afa780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sch=C3=B6dler?= Date: Tue, 4 Apr 2023 13:21:11 +0200 Subject: [PATCH] Fixes replaceChildren bug --- src/view/view.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/view/view.ts b/src/view/view.ts index 76e1a6a..903e9e9 100644 --- a/src/view/view.ts +++ b/src/view/view.ts @@ -96,8 +96,10 @@ export class CrossbowView extends ItemView { // Insert / append the new suggestion, depending on whether it already existed if (existingSuggestion) { - this.contentEl.replaceChild(suggestion, existingSuggestion); - existingSuggestion.isCollapsed() ? null : suggestion.expand(); + existingSuggestion.replaceWith(suggestion); + existingSuggestion.isCollapsed() + ? suggestion.collapse() + : suggestion.expand(); existingSuggestion?.remove(); } else { this.contentEl.appendChild(suggestion); @@ -173,6 +175,7 @@ export class CrossbowView extends ItemView { ch: occurrence.value.ch + suggestion.hash.length, line: occurrence.value.line, } as EditorPosition; + const link = match.value.item ? this.app.fileManager.generateMarkdownLink( match.value.file, @@ -203,10 +206,6 @@ export class CrossbowView extends ItemView { suggestion.addTreeItems(occurrences); - const w = window as any; - w.suggestions = w.suggestions || []; - w.suggestions.push({ suggestion, occurrences }); - return suggestion; } }