aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/FormattedTextBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBox.tsx26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 5fdfbce99..563b6a25d 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1145,20 +1145,22 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FieldViewProps
return Doc.NativeAspect(this.rootDoc, this.dataDoc, false) ? this.props.NativeDimScaling?.() || 1 : 1;
}
+ @action
checkBackgroundColor() {
- console.log('checking bg color');
+ console.log('checking bg color 1');
+ if (BoolCast(Doc.UserDoc().settingBgColor)) return;
+ console.log('checking bg color 2');
+ let fontColor = '#000000';
if (isDarkMode(StrCast(this.rootDoc._backgroundColor))) {
- console.log('in dark mode');
- // set text to white
- if (!this._editorView) return;
- const tr = this._editorView?.state.tr;
-
- tr.setSelection(TextSelection.create(tr.doc, 0, tr.doc.content.size));
- tr.addMark(0, tr.doc.content.size, schema.marks.pFontColor.create({ color: '#ffffff' }));
- this._editorView.dispatch(tr);
- } else {
- // leave as is
+ fontColor = '#ffffff';
}
+ // set text to white
+ if (!this._editorView) return;
+ const tr = this._editorView?.state.tr;
+
+ tr.setSelection(TextSelection.create(tr.doc, 0, tr.doc.content.size));
+ tr.addMark(0, tr.doc.content.size, schema.marks.pFontColor.create({ color: fontColor }));
+ this._editorView.dispatch(tr);
}
componentDidMount() {
@@ -1183,7 +1185,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FieldViewProps
({ width, scrollHeight, layout_autoHeight }) => width && layout_autoHeight && this.resetNativeHeight(scrollHeight),
{ fireImmediately: true }
);
- this._disposers.width = reaction(
+ this._disposers.bgColor = reaction(
() => this.rootDoc._backgroundColor,
color => this.checkBackgroundColor()
);