From b171b939743de6126f3fb5ca1e2d34bba7cbe428 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 2 Nov 2022 12:54:18 -0400
Subject: fix sidebar so active filters add proper metadata to newly created
 documents

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

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

diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 0e48dd93a..ee97e5e62 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1398,9 +1398,10 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FieldViewProps
             } else if (this._editorView) {
                 this._editorView.dispatch(this._editorView.state.tr.addStoredMark(schema.marks.user_mark.create({ userid: Doc.CurrentUserEmail, modified: Math.floor(Date.now() / 1000) })));
             }
-            FormattedTextBox.DontSelectInitialText = false;
         }
-        selectOnLoad && this._editorView!.focus();
+        if (FormattedTextBox.DontSelectInitialText) setTimeout(() => selectOnLoad && this._editorView!.focus(), 0);
+        else selectOnLoad && this._editorView!.focus();
+        FormattedTextBox.DontSelectInitialText = false;
         // add user mark for any first character that was typed since the user mark that gets set in KeyPress won't have been called yet.
         if (this._editorView) {
             this._editorView.state.storedMarks = [
-- 
cgit v1.2.3-70-g09d2

