From 12594baac6feb017e982ef6d7bdf74f99a87da7e Mon Sep 17 00:00:00 2001 From: zsviczian Date: Sun, 23 Apr 2023 08:42:03 +0200 Subject: [PATCH] 1.8.26 --- manifest.json | 2 +- src/MarkdownPostProcessor.ts | 2 +- src/dialogs/Messages.ts | 7 +++++++ src/main.ts | 5 +++-- src/utils/DynamicStyling.ts | 11 +++++------ 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/manifest.json b/manifest.json index d1b088c..5af6bc1 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "1.8.25", + "version": "1.8.26", "minAppVersion": "1.1.6", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/src/MarkdownPostProcessor.ts b/src/MarkdownPostProcessor.ts index d5595e7..581890b 100644 --- a/src/MarkdownPostProcessor.ts +++ b/src/MarkdownPostProcessor.ts @@ -21,7 +21,7 @@ import { svgToBase64, } from "./utils/Utils"; import { isObsidianThemeDark } from "./utils/ObsidianUtils"; -import { isCTRL, isMETA, linkClickModifierType } from "./utils/ModifierkeyHelper"; +import { linkClickModifierType } from "./utils/ModifierkeyHelper"; interface imgElementAttributes { file?: TFile; diff --git a/src/dialogs/Messages.ts b/src/dialogs/Messages.ts index e848a55..8887cc4 100644 --- a/src/dialogs/Messages.ts +++ b/src/dialogs/Messages.ts @@ -17,6 +17,13 @@ I develop this plugin as a hobby, spending my free time doing this. If you find
`, +"1.8.26":` +## Fixed +- Dynamic styling did not pick up correctly + - the accent color with the default Obsidian theme + - the drawing theme color with the out of the box, default new drawing (not using a template) +- The Obsidian tools panel did not pick up user scripts when installing your very first script. A reload of Obsidian was required. +`, "1.8.25": `
diff --git a/src/main.ts b/src/main.ts index 3a76335..1f0f9c0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -103,8 +103,6 @@ import { Packages } from "./types"; import { ScriptInstallPrompt } from "./dialogs/ScriptInstallPrompt"; import Taskbone from "./ocr/Taskbone"; import { emulateCTRLClickForLinks, linkClickModifierType, PaneTarget } from "./utils/ModifierkeyHelper"; -import { ColorMap } from "./EmbeddedFileLoader"; - declare module "obsidian" { interface App { @@ -495,6 +493,9 @@ export default class ExcalidrawPlugin extends Plugin { svgPath, ); setButtonText("UPTODATE"); + if(Object.keys(this.scriptEngine.scriptIconMap).length === 0) { + this.scriptEngine.loadScripts(); + } new Notice(`Installed: ${(scriptFile as TFile).basename}`); } catch (e) { new Notice(`Error installing script: ${fname}`); diff --git a/src/utils/DynamicStyling.ts b/src/utils/DynamicStyling.ts index 4cfecf9..ec8e196 100644 --- a/src/utils/DynamicStyling.ts +++ b/src/utils/DynamicStyling.ts @@ -23,7 +23,9 @@ export const setDynamicStyle = ( return; } const doc = view.ownerDocument; - const isLightTheme = view?.excalidrawData?.scene?.appState?.theme === "light"; + const isLightTheme = + view?.excalidrawAPI?.getAppState?.()?.theme === "light" || + view?.excalidrawData?.scene?.appState?.theme === "light"; const darker = "#202020"; const lighter = "#fbfbfb"; @@ -43,11 +45,8 @@ export const setDynamicStyle = ( const bgLightness = cmBG().lightness; const isDark = cmBG().isDark(); - const docStyle = doc.querySelector("body").style; - const accentColorString = `hsl(${ - docStyle.getPropertyValue("--accent-h")},${ - docStyle.getPropertyValue("--accent-s")},${ - docStyle.getPropertyValue("--accent-l")})`; + //@ts-ignore + const accentColorString = app.getAccentColor(); const accent = () => ea.getCM(accentColorString); const cmBlack = () => ea.getCM("#000000").lightnessTo(bgLightness);