From b5c5410b4af5d2c68d2107d3f064f6e3ec4ac3f2 Mon Sep 17 00:00:00 2001 From: Sophie Zhang Date: Thu, 25 Jan 2024 11:28:40 -0500 Subject: add setting bg color --- src/client/views/global/globalScripts.ts | 4 ++++ .../views/nodes/formattedText/FormattedTextBox.tsx | 26 ++++++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/client/views/global/globalScripts.ts b/src/client/views/global/globalScripts.ts index 894afebfd..1f1fa2109 100644 --- a/src/client/views/global/globalScripts.ts +++ b/src/client/views/global/globalScripts.ts @@ -31,6 +31,10 @@ ScriptingGlobals.add(function setView(view: string) { selected ? (selected._type_collection = view) : console.log('[FontIconBox.tsx] changeView failed'); }); +ScriptingGlobals.add(function setSettingBgColor(isSetting: boolean) { + Doc.UserDoc().settingBgColor = isSetting; +}); + // toggle: Set overlay status of selected document ScriptingGlobals.add(function setBackgroundColor(color?: string, checkResult?: boolean) { const selectedViews = SelectionManager.Views(); 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 width && layout_autoHeight && this.resetNativeHeight(scrollHeight), { fireImmediately: true } ); - this._disposers.width = reaction( + this._disposers.bgColor = reaction( () => this.rootDoc._backgroundColor, color => this.checkBackgroundColor() ); -- cgit v1.2.3-70-g09d2