From 6c8effb77029db96bccab92152a6b68a0aefc132 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 1 Apr 2025 13:30:06 -0400
Subject: fixed text views to write/read font_<props> from data doc.

---
 .../views/nodes/formattedText/FormattedTextBox.tsx | 38 +++++++++++-----------
 1 file changed, 19 insertions(+), 19 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 6955e5401..f7e6d8e1e 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -141,20 +141,20 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
 
     @observable _showSidebar = false;
 
-    @computed get fontColor()      { return this._props.styleProvider?.(this.layoutDoc, this._props, StyleProp.FontColor) as string; } // prettier-ignore
-    @computed get fontSize()       { return this._props.styleProvider?.(this.layoutDoc, this._props, StyleProp.FontSize) as string; } // prettier-ignore
-    @computed get fontFamily()     { return this._props.styleProvider?.(this.layoutDoc, this._props, StyleProp.FontFamily) as string; } // prettier-ignore
-    @computed get fontWeight()     { return this._props.styleProvider?.(this.layoutDoc, this._props, StyleProp.FontWeight) as string;  } // prettier-ignore
-    @computed get fontStyle()      { return this._props.styleProvider?.(this.layoutDoc, this._props, StyleProp.FontStyle) as string;  } // prettier-ignore
-    @computed get fontDecoration() { return this._props.styleProvider?.(this.layoutDoc, this._props, StyleProp.FontDecoration) as string;  } // prettier-ignore
-
-    set _recordingDictation(value) {
+    @computed get fontColor()      { return this._props.styleProvider?.(this.dataDoc, this._props, StyleProp.FontColor) as string; } // prettier-ignore
+    @computed get fontSize()       { return this._props.styleProvider?.(this.dataDoc, this._props, StyleProp.FontSize) as string; } // prettier-ignore
+    @computed get fontFamily()     { return this._props.styleProvider?.(this.dataDoc, this._props, StyleProp.FontFamily) as string; } // prettier-ignore
+    @computed get fontWeight()     { return this._props.styleProvider?.(this.dataDoc, this._props, StyleProp.FontWeight) as string;  } // prettier-ignore
+    @computed get fontStyle()      { return this._props.styleProvider?.(this.dataDoc, this._props, StyleProp.FontStyle) as string;  } // prettier-ignore
+    @computed get fontDecoration() { return this._props.styleProvider?.(this.dataDoc, this._props, StyleProp.FontDecoration) as string;  } // prettier-ignore
+
+    set recordingDictation(value) {
         !this.dataDoc[`${this.fieldKey}_recordingSource`] && (this.dataDoc.mediaState = value ? mediaState.Recording : undefined);
     }
 
     // eslint-disable-next-line no-return-assign
     @computed get config()                     { return FormattedTextBox.MakeConfig(this._rules = new RichTextRules(this.Document, this), this); } // prettier-ignore
-    @computed get _recordingDictation()        { return this.dataDoc?.mediaState === mediaState.Recording; } // prettier-ignore
+    @computed get recordingDictation()        { return this.dataDoc?.mediaState === mediaState.Recording; } // prettier-ignore
     @computed get SidebarShown()               {  return !!(this._showSidebar || this.layoutDoc._layout_showSidebar);  } // prettier-ignore
     @computed get allSidebarDocs()             { return DocListCast(this.dataDoc[this.sidebarKey]); } // prettier-ignore
     @computed get noSidebar()                  { return this.DocumentView?.()._props.hideDecorationTitle || this._props.noSidebar || this.Document._layout_noSidebar; } // prettier-ignore
@@ -1034,14 +1034,14 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
     };
 
     breakupDictation = () => {
-        if (this.EditorView && this._recordingDictation) {
+        if (this.EditorView && this.recordingDictation) {
             this.stopDictation(/* true */);
             this._break = true;
             const { state } = this.EditorView;
             const { to } = state.selection;
             const updated = TextSelection.create(state.doc, to, to);
             this.EditorView.dispatch(state.tr.setSelection(updated).insert(to, state.schema.nodes.paragraph.create({})));
-            if (this._recordingDictation) {
+            if (this.recordingDictation) {
                 this.recordDictation();
             }
         }
@@ -1333,14 +1333,14 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
 
         if (!this._props.dontRegisterView) {
             this._disposers.record = reaction(
-                () => this._recordingDictation,
+                () => this.recordingDictation,
                 () => {
                     this.stopDictation(/* true */);
-                    this._recordingDictation && this.recordDictation();
+                    this.recordingDictation && this.recordDictation();
                 },
                 { fireImmediately: true }
             );
-            if (this._recordingDictation) setTimeout(this.recordDictation);
+            if (this.recordingDictation) setTimeout(this.recordDictation);
         }
         this._disposers.scroll = reaction(
             () => NumCast(this.layoutDoc._layout_scrollTop),
@@ -1560,8 +1560,8 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
     };
 
     componentWillUnmount() {
-        if (this._recordingDictation) {
-            this._recordingDictation = !this._recordingDictation;
+        if (this.recordingDictation) {
+            this.recordingDictation = !this.recordingDictation;
         }
         Object.values(this._disposers).forEach(disposer => disposer?.());
         this.endUndoTypingBatch();
@@ -1596,7 +1596,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
                 }
             });
         }
-        if (this._recordingDictation && !e.ctrlKey && e.button === 0) {
+        if (this.recordingDictation && !e.ctrlKey && e.button === 0) {
             this.breakupDictation();
         }
         FormattedTextBoxComment.textBox = this;
@@ -1909,7 +1909,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
             .scale(1 / NumCast(this.layoutDoc._freeform_scale, 1) / (this._props.NativeDimScaling?.() || 1));
 
     @computed get audioHandle() {
-        return !this._recordingDictation ? null : (
+        return !this.recordingDictation ? null : (
             <div
                 className="formattedTextBox-dictation"
                 onPointerDown={e =>
@@ -1919,7 +1919,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
                         returnFalse,
                         emptyFunction,
                         action(() => {
-                            this._recordingDictation = !this._recordingDictation;
+                            this.recordingDictation = !this.recordingDictation;
                         })
                     )
                 }>
-- 
cgit v1.2.3-70-g09d2

