From de4cc95e406b10bd92975abd5eef8f708cbf8f02 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 10 Oct 2024 22:32:52 -0400
Subject: fixed being able to use text menu on text in comparison box.  Allow
 TextDocuments to be created with a RichText field.  Changed comparisonBox to
 horizontally center flashcard text.

---
 src/client/views/nodes/formattedText/FormattedTextBox.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 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 18b8c9d34..c57307974 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1328,7 +1328,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
         );
 
         this._disposers.selected = reaction(
-            () => this._props.rootSelected?.(),
+            () => this._props.rootSelected?.() || this._props.isContentActive(),
             action(selected => {
                 this.prepareForTyping();
                 if (FormattedTextBox._globalHighlights.has('Bold Text')) {
@@ -1514,7 +1514,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
                     dispatch(state.tr.insertText(startupText));
                 }
                 const textAlign = StrCast(this.dataDoc.text_align, StrCast(Doc.UserDoc().textAlign, 'left'));
-                if (textAlign !== 'left') {
+                if (textAlign && textAlign !== 'left') {
                     selectAll(this._editorView.state, tr => {
                         this._editorView!.dispatch(tr.replaceSelectionWith(state.schema.nodes.paragraph.create({ align: textAlign })));
                     });
@@ -1775,7 +1775,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
                 }
             }
         }
-        if (RichTextMenu.Instance?.view === this._editorView && !this._props.rootSelected?.()) {
+        if (RichTextMenu.Instance?.view === this._editorView && !(this._props.isContentActive() || this._props.rootSelected?.())) {
             RichTextMenu.Instance?.updateMenu(undefined, undefined, undefined, undefined);
         }
 
-- 
cgit v1.2.3-70-g09d2

