From 66f120531a7e86a7a6bfac30e9c966c3baaed99d Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 12 May 2021 13:18:33 -0400
Subject: fixed issue with link panel appearing on text boxes when no link is
 clicked.

---
 src/client/views/nodes/formattedText/FormattedTextBoxComment.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/client/views/nodes/formattedText/FormattedTextBoxComment.tsx')

diff --git a/src/client/views/nodes/formattedText/FormattedTextBoxComment.tsx b/src/client/views/nodes/formattedText/FormattedTextBoxComment.tsx
index 6821935a0..1fde6e5f0 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBoxComment.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBoxComment.tsx
@@ -85,7 +85,7 @@ export class FormattedTextBoxComment {
     static update(textBox: FormattedTextBox, view: EditorView, lastState?: EditorState, hrefs: string = "") {
         FormattedTextBoxComment.textBox = textBox;
         if ((hrefs || !lastState?.doc.eq(view.state.doc) || !lastState?.selection.eq(view.state.selection))) {
-            FormattedTextBoxComment.setupPreview(view, textBox, hrefs?.trim().split(" "));
+            FormattedTextBoxComment.setupPreview(view, textBox, hrefs?.trim().split(" ").filter(h => h));
         }
     }
 
@@ -109,7 +109,7 @@ export class FormattedTextBoxComment {
         }
 
         // this checks if the selection is a hyperlink.  If so, it displays the target doc's text for internal links, and the url of the target for external links. 
-        if (state.selection.$from && hrefs) {
+        if (state.selection.$from && hrefs?.length) {
             const nbef = findStartOfMark(state.selection.$from, view, findLinkMark);
             const naft = findEndOfMark(state.selection.$from, view, findLinkMark) || nbef;
             nbef && naft && LinkDocPreview.SetLinkInfo({
-- 
cgit v1.2.3-70-g09d2

