From fd5aabf4c774003da4af8d87125b8f33b362ee0a Mon Sep 17 00:00:00 2001 From: Jeremy Valentine <38669521+valentine195@users.noreply.github.com> Date: Mon, 16 Oct 2023 19:33:08 -0400 Subject: [PATCH] fix: Enables a Fudge/Fate dice icon (toggleable in settings) (close #251) --- src/main.ts | 3 ++- src/settings/settings.ts | 10 ++++++++++ src/view/view.ts | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index f33ae2f..9ecafd2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -41,7 +41,6 @@ import { Round, ExpectedValue, RollerOptions } from "./types"; import { inlinePlugin } from "./live-preview"; import API from "./api/api"; /* import GenesysView, { GENESYS_VIEW_TYPE } from "./view/genesys"; */ - String.prototype.matchAll = String.prototype.matchAll || function* matchAll(regexp: RegExp): IterableIterator { @@ -128,6 +127,7 @@ declare global { } } interface DiceRollerSettings { + showFudgeIcon: boolean; rollLinksForTags: boolean; copyContentButton: boolean; displayResultsInline: boolean; @@ -168,6 +168,7 @@ interface DiceRollerSettings { } export const DEFAULT_SETTINGS: DiceRollerSettings = { + showFudgeIcon: false, rollLinksForTags: false, copyContentButton: true, customFormulas: [], diff --git a/src/settings/settings.ts b/src/settings/settings.ts index ce5da0c..ed63a59 100644 --- a/src/settings/settings.ts +++ b/src/settings/settings.ts @@ -326,6 +326,16 @@ export default class SettingTab extends PluginSettingTab { await this.plugin.saveSettings(); }); }); + new Setting(containerEl) + .setName("Display Fudge/Fate Dice Icon") + .addToggle((t) => { + t.setValue(this.plugin.data.showFudgeIcon); + t.onChange(async (v) => { + this.plugin.data.showFudgeIcon = v; + this.plugin.view?.buildButtons(); + await this.plugin.saveSettings(); + }); + }); } buildRender(containerEl: HTMLDivElement) { containerEl.empty(); diff --git a/src/view/view.ts b/src/view/view.ts index 42ce2a0..b8589c4 100644 --- a/src/view/view.ts +++ b/src/view/view.ts @@ -19,6 +19,7 @@ export const VIEW_TYPE = "DICE_ROLLER_VIEW"; const D4 = ``; const D6 = ``; +const DF = ``; const D8 = ``; const D10 = ``; const D12 = ``; @@ -27,6 +28,7 @@ const D100 = `