From 447f8ab4e68dd673f4dd89ea58fc74558df25f4f Mon Sep 17 00:00:00 2001 From: Jeremy Valentine <38669521+valentine195@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:41:23 -0400 Subject: [PATCH] fix: Fixes issue where dice integration no longer works (close #398) --- src/view/Statblock.svelte | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/view/Statblock.svelte b/src/view/Statblock.svelte index e63283bb..56bfab85 100644 --- a/src/view/Statblock.svelte +++ b/src/view/Statblock.svelte @@ -21,9 +21,6 @@ import Bar from "./ui/Bar.svelte"; import ColumnContainer from "./ui/ColumnContainer.svelte"; - import { nanoid } from "src/util/util"; - import { Bestiary } from "src/bestiary/bestiary"; - import copy from "fast-copy"; const dispatch = createEventDispatcher(); @@ -38,23 +35,25 @@ const monsterStore = writable(); $: $monsterStore = monster; - $: maxColumns = + const maxColumns = !isNaN(Number(monster.columns ?? layout.columns)) && Number(monster.columns ?? layout.columns) > 0 ? Number(monster.columns ?? layout.columns) : 2; - $: monsterColumnWidth = Number(`${monster.columnWidth}`.replace(/\D/g, "")); - $: columnWidth = + const monsterColumnWidth = Number( + `${monster.columnWidth}`.replace(/\D/g, "") + ); + const columnWidth = !isNaN(monsterColumnWidth ?? layout.columnWidth) && (monsterColumnWidth ?? layout.columnWidth) > 0 ? monsterColumnWidth : 400; - $: canExport = monster.export ?? plugin.settings.export; - $: canDice = + const canExport = monster.export ?? plugin.settings.export; + const canDice = plugin.canUseDiceRoller && (monster.dice ?? plugin.settings.useDice); - $: canRender = monster.render ?? plugin.settings.renderDice; + const canRender = monster.render ?? plugin.settings.renderDice; setContext("plugin", plugin); setContext("tryToRenderLinks", plugin.settings.tryToRenderLinks);