From e531fe8d0b782587b8cb0999c30e92d9313dc4b3 Mon Sep 17 00:00:00 2001 From: Jeremy Valentine <38669521+valentine195@users.noreply.github.com> Date: Fri, 22 Mar 2024 22:41:34 -0400 Subject: [PATCH] fix: Adds Theme toggles to Previewer in Layout Editor --- .../layout/previewer/Previewer.svelte | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/src/settings/layout/previewer/Previewer.svelte b/src/settings/layout/previewer/Previewer.svelte index be5bb8f0..ef5784c1 100644 --- a/src/settings/layout/previewer/Previewer.svelte +++ b/src/settings/layout/previewer/Previewer.svelte @@ -9,9 +9,11 @@ } from "obsidian"; import { MonsterSuggestionModal } from "src/util/creature"; import type { Monster } from "index"; - import { buildTextArea } from "src/util"; + import { buildTextArea, setNodeIcon } from "src/util"; import type { EditorView } from "@codemirror/view"; import StatBlockRenderer from "src/view/statblock"; + import { writable } from "svelte/store"; + import { ThemeMode } from "src/layouts/layout.css"; export let previewed: string; @@ -83,13 +85,25 @@ }, 500) ); }; + const mode = writable(ThemeMode.None); + const setMode = (current: ThemeMode) => { + if ($mode == current) { + $mode = ThemeMode.None; + } else { + $mode = current; + } + }; onDestroy(() => { if (editor) editor.destroy(); }); -
+
Select a creature to preview the layout, or enter your own definition below. @@ -98,7 +112,25 @@
- +
+
+
Set theme mode
+
+
+ + +
+