diff --git a/manifest.json b/manifest.json
index f08c957..d8d9e1e 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
- "version": "1.7.24",
+ "version": "1.7.25",
"minAppVersion": "0.15.6",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",
diff --git a/package.json b/package.json
index 563486c..c9da068 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "obsidian-excalidraw-plugin",
- "version": "1.7.23",
+ "version": "1.7.25",
"description": "This is an Obsidian.md plugin that lets you view and edit Excalidraw drawings",
"main": "lib/index.js",
"types": "lib/index.d.ts",
diff --git a/src/ExcalidrawAutomate.ts b/src/ExcalidrawAutomate.ts
index 68f986a..05fd7ff 100644
--- a/src/ExcalidrawAutomate.ts
+++ b/src/ExcalidrawAutomate.ts
@@ -1491,6 +1491,15 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface {
pointerPosition: { x: number; y: number }; //the pointer position on canvas at the time of drop
}) => boolean = null;
+ /**
+ * If set, this callback is triggered whenever the active canvas color changes
+ */
+ onCanvasColorChangeHook: (
+ ea: ExcalidrawAutomate,
+ view: ExcalidrawView, //the excalidraw view
+ color: string,
+ ) => void = null;
+
/**
* utility function to generate EmbeddedFilesLoader object
* @param isDark
@@ -1858,6 +1867,10 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface {
log("Creates a CM object. Visit https://github.com/lbragile/ColorMaster for documentation.");
return;
}
+ if(typeof color === "string") {
+ color = this.colorNameToHex(color);
+ }
+
return CM(color);
}
};
diff --git a/src/ExcalidrawView.ts b/src/ExcalidrawView.ts
index 0305b2d..af2a0a3 100644
--- a/src/ExcalidrawView.ts
+++ b/src/ExcalidrawView.ts
@@ -1441,7 +1441,7 @@ export default class ExcalidrawView extends TextFileView {
this.previousSceneVersion = 0;
}
- private isLoaded: boolean = false;
+ public isLoaded: boolean = false;
async setViewData(data: string, clear: boolean = false) {
if(this.plugin.settings.showNewVersionNotification) checkExcalidrawVersion(app);
this.isLoaded = false;
@@ -2784,6 +2784,15 @@ export default class ExcalidrawView extends TextFileView {
libraryReturnUrl: "app://obsidian.md",
autoFocus: true,
onChange: (et: ExcalidrawElement[], st: AppState) => {
+ const canvasColorChangeHook = () => {
+ if(this.plugin.ea.onCanvasColorChangeHook) {
+ this.plugin.ea.onCanvasColorChangeHook(
+ this.plugin.ea,
+ this,
+ st.viewBackgroundColor
+ )
+ }
+ }
viewModeEnabled = st.viewModeEnabled;
if (this.semaphores.justLoaded) {
this.semaphores.justLoaded = false;
@@ -2792,6 +2801,7 @@ export default class ExcalidrawView extends TextFileView {
}
this.previousSceneVersion = this.getSceneVersion(et);
this.previousBackgroundColor = st.viewBackgroundColor;
+ canvasColorChangeHook();
return;
}
if (this.semaphores.dirty) {
@@ -2816,6 +2826,7 @@ export default class ExcalidrawView extends TextFileView {
this.previousSceneVersion = sceneVersion;
this.previousBackgroundColor = st.viewBackgroundColor;
this.setDirty(6);
+ canvasColorChangeHook();
}
}
},
diff --git a/src/dialogs/Messages.ts b/src/dialogs/Messages.ts
index a6c7677..300e880 100644
--- a/src/dialogs/Messages.ts
+++ b/src/dialogs/Messages.ts
@@ -17,6 +17,31 @@ I develop this plugin as a hobby, spending most of my free time doing this. If y
`,
+"1.7.25":`## Fixed
+- Tool buttons did not "stick" the first time you clicked them.
+- Tray (in tray mode) was higher when the help button was visible. The tray in tablet mode was too large and the help button was missing.
+- ExcalidrawAutomate ${String.fromCharCode(96)}getCM(color:TInput): ColorMaster;${String.fromCharCode(96)} function will now properly convert valid [css color names](https://www.w3schools.com/colors/colors_names.asp) to ColorMaster objects.
+- The downloaded script icons in the Excalidraw-Obsidian menu were not always correct
+- The obsidian mobile navigation bar at the bottom overlapped with Excalidraw
+
+## New
+- Created ExcalidrawAutomate hook for styling script when the canvas color changes. See sample [onCanvasColorChangeHook](https://gist.github.com/zsviczian/c7223c5b4af30d5c88a0cae05300305c) implementation following the link.
+
+