From 29e55ca6b124d243879092301687945862e4330b Mon Sep 17 00:00:00 2001 From: Joe Krill Date: Thu, 22 Feb 2024 17:28:47 -0500 Subject: [PATCH] Store extracted customStyles in uiSettings (#731) --- type/web.ts | 1 + web/client.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/type/web.ts b/type/web.ts index 3e6ceba7..7423ddcb 100644 --- a/type/web.ts +++ b/type/web.ts @@ -81,6 +81,7 @@ export type AppViewState = { vimMode: boolean; darkMode: boolean; forcedROMode: boolean; + customStyles?: string; }; // Page navigator mode diff --git a/web/client.ts b/web/client.ts index 8d3d132b..d072dafb 100644 --- a/web/client.ts +++ b/web/client.ts @@ -1087,9 +1087,13 @@ export class Client { console.error("Failed to load custom styles", e); } } - document.getElementById("custom-styles")!.innerHTML = accumulatedCSS.join( - "\n\n", - ); + const customStylesContent = accumulatedCSS.join("\n\n"); + this.ui.viewDispatch({ + type: "set-ui-option", + key: "customStyles", + value: customStylesContent, + }); + document.getElementById("custom-styles")!.innerHTML = customStylesContent; } }