diff --git a/manifest-beta.json b/manifest-beta.json index d5bca44..a930519 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "2.10.0", + "version": "2.10.1", "minAppVersion": "1.1.6", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/manifest.json b/manifest.json index a374542..4db45ed 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "2.10.0", + "version": "2.10.1", "minAppVersion": "1.1.6", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/package.json b/package.json index 5a7a39b..03bb9ce 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "license": "MIT", "dependencies": { "@popperjs/core": "^2.11.8", - "@zsviczian/excalidraw": "0.18.0-6", + "@zsviczian/excalidraw": "0.18.0-7", "chroma-js": "^2.4.2", "clsx": "^2.0.0", "@zsviczian/colormaster": "^1.2.2", diff --git a/src/core/settings.ts b/src/core/settings.ts index c7a774a..3752513 100644 --- a/src/core/settings.ts +++ b/src/core/settings.ts @@ -380,6 +380,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = { DYNAMIC_COLOR: true, COLOR: "#000000", OPACITY: 50, + GRID_DIRECTION: {horizontal: true, vertical: true}, }, laserSettings: { DECAY_LENGTH: 50, @@ -1380,6 +1381,42 @@ export class ExcalidrawSettingTab extends PluginSettingTab { getExcalidrawViews(this.app).forEach(excalidrawView=>excalidrawView.updateGridColor()); }; + const updateGridDirection = () => { + getExcalidrawViews(this.app).forEach(excalidrawView=> + excalidrawView.updateGridDirection(this.plugin.settings.gridSettings.GRID_DIRECTION)); + } + + new Setting(detailsEl) + .setName(t("GRID_DIRECTION_NAME")) + .setDesc(t("GRID_DIRECTION_DESC")) + .addToggle((toggle) => + toggle + .setTooltip(t("GRID_HORIZONTAL")) + .setValue(this.plugin.settings.gridSettings.GRID_DIRECTION?.horizontal ?? true) + .onChange((value) => { + if(!this.plugin.settings.gridSettings.GRID_DIRECTION) { + this.plugin.settings.gridSettings.GRID_DIRECTION = { horizontal: true, vertical: true }; + } //2.10.1 migration + this.plugin.settings.gridSettings.GRID_DIRECTION.horizontal = value; + this.applySettingsUpdate(); + updateGridDirection(); + }), + ) + .addToggle((toggle) => + toggle + .setTooltip(t("GRID_VERTICAL")) + .setValue(this.plugin.settings.gridSettings.GRID_DIRECTION?.vertical ?? true) + .onChange((value) => { + if(!this.plugin.settings.gridSettings.GRID_DIRECTION) { + this.plugin.settings.gridSettings.GRID_DIRECTION = { horizontal: true, vertical: true }; + } //2.10.1 migration + this.plugin.settings.gridSettings.GRID_DIRECTION.vertical = value; + this.applySettingsUpdate(); + updateGridDirection(); + }), + ); + + // Dynamic color toggle let gridColorSection: HTMLDivElement; new Setting(detailsEl) diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index 2e3f776..d8ca1e9 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -427,6 +427,10 @@ FILENAME_HEAD: "Filename", GRID_OPACITY_NAME: "Grid opacity", GRID_OPACITY_DESC: "Grid opacity will also control the opacity of the binding box when binding an arrow to an element.
" + "Set the opacity of the grid. 0 is transparent, 100 is opaque.", + GRID_DIRECTION_NAME: "Grid direction", + GRID_DIRECTION_DESC: "The first toggle shows/hides the horizontal grid, the second toggle shows/hides the vertical grid.", + GRID_HORIZONTAL: "Render horizontal grid", + GRID_VERTICAL: "Render vertical grid", LASER_HEAD: "Laser pointer", LASER_COLOR: "Laser pointer color", LASER_DECAY_TIME_NAME: "Laser pointer decay time", diff --git a/src/shared/Dialogs/Messages.ts b/src/shared/Dialogs/Messages.ts index f41f1cb..c38c1e4 100644 --- a/src/shared/Dialogs/Messages.ts +++ b/src/shared/Dialogs/Messages.ts @@ -11,12 +11,32 @@ Thank you & Enjoy! `; export const RELEASE_NOTES: { [k: string]: string } = { - Intro: `After each update you'll be prompted with the release notes. You can disable this in plugin settings. + Intro: `After each update, you’ll see these release notes (you can turn this off in the plugin settings). -I develop this plugin as a hobby, spending my free time doing this. If you find it valuable, then please say THANK YOU or... +I build this plugin in my free time, as a labor of love. Curious about the philosophy behind it? Check out [📕 Sketch Your Mind](https://sketch-your-mind.com). If you find it valuable, say THANK YOU or…
Buy Me a Coffee at ko-fi.com
`, +"2.10.1": ` + +## Fixed by Excalidraw.com +- Eraser performance improvement regression. Erasing locked elements. [#9400](https://github.com/excalidraw/excalidraw/pull/9400) + +## New +- Grid Customization Options in plugin settings (appearance and behavior/grid): You can now selectively show or hide vertical and horizontal grid lines independently. This allows you to create alternative grid styles, such as horizontal-only lined grids instead of the traditional checkered pattern. + +## Fixed in ExcalidrawAutomate +- ${String.fromCharCode(96)}ea.createSVG${String.fromCharCode(96)} throws error [#2321]https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2321) + +--- + +## ❤️ Enjoying the plugin? + +Support my work by checking out my new book, now available for pre-order: +[Sketch Your Mind: Nurture a Playful and Creative Brain](https://sketch-your-mind.com) is about visual Personal Knowledge Management. It explores the thinking behind Excalidraw and how it helps you structure and evolve ideas visually. It’s the book I wish I had when I began my own PKM journey. + +
Pre-order Sketch Your Mind
+`, "2.10.0": ` ## New from Excalidraw.com - Lasso select [#9169](https://github.com/excalidraw/excalidraw/pull/9169) @@ -28,7 +48,7 @@ I develop this plugin as a hobby, spending my free time doing this. If you find - Keep arrow label horizontal [#9364](https://github.com/excalidraw/excalidraw/pull/9364) ## Fixed in ExcalidrawAutomate -- ea.addText did not honor the width parameter. +- ${String.fromCharCode(96)}ea.addText${String.fromCharCode(96)} did not honor the width parameter. `, "2.9.2":` - More minor fix. Toolbars are not responsive when dynamic styling is turned off. [#2287](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2287) diff --git a/src/shared/ExcalidrawAutomate.ts b/src/shared/ExcalidrawAutomate.ts index b0f1355..9564df0 100644 --- a/src/shared/ExcalidrawAutomate.ts +++ b/src/shared/ExcalidrawAutomate.ts @@ -1096,13 +1096,14 @@ export class ExcalidrawAutomate { ? "light" : undefined; } - if (theme && !exportSettings) { + if (!exportSettings) { exportSettings = { withBackground: this.plugin.settings.exportWithBackground, withTheme: true, isMask: false, + skipInliningFonts: !embedFont, }; - } + } if (!loader) { loader = new EmbeddedFilesLoader( this.plugin, diff --git a/src/types/types.d.ts b/src/types/types.d.ts index d216250..c519595 100644 --- a/src/types/types.d.ts +++ b/src/types/types.d.ts @@ -18,6 +18,7 @@ export type GridSettings = { DYNAMIC_COLOR: boolean; // Whether the grid color is dynamic COLOR: string; // The grid color (in hex format) OPACITY: number; // The grid opacity (hex value between "00" and "FF") + GRID_DIRECTION: {horizontal: boolean, vertical: boolean}; // Whether the grid is horizontal or vertical }; export type DeviceType = { diff --git a/src/view/ExcalidrawView.ts b/src/view/ExcalidrawView.ts index fa3b58a..5db542a 100644 --- a/src/view/ExcalidrawView.ts +++ b/src/view/ExcalidrawView.ts @@ -155,6 +155,7 @@ import { ImageInfo } from "src/types/excalidrawAutomateTypes"; import { exportToPDF, getMarginValue, getPageDimensions, PageOrientation, PageSize } from "src/utils/exportUtils"; import { FrameRenderingOptions } from "src/types/utilTypes"; import { CaptureUpdateAction } from "src/constants/constants"; +import { FlipHorizontal } from "lucide-react"; const EMBEDDABLE_SEMAPHORE_TIMEOUT = 2000; const PREVENT_RELOAD_TIMEOUT = 2000; @@ -2769,6 +2770,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ allowWheelZoom: this.plugin.settings.allowWheelZoom, pinnedScripts: this.plugin.settings.pinnedScripts, customPens: this.plugin.settings.customPens.slice(0,this.plugin.settings.numberOfCustomPens), + gridDirection: this.plugin.settings.gridSettings.GRID_DIRECTION ?? {horizontal: true, vertical: true}, }, captureUpdate: CaptureUpdateAction.NEVER, }, @@ -2797,6 +2799,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ allowWheelZoom: this.plugin.settings.allowWheelZoom, pinnedScripts: this.plugin.settings.pinnedScripts, customPens: this.plugin.settings.customPens.slice(0,this.plugin.settings.numberOfCustomPens), + gridDirection: this.plugin.settings.gridSettings.GRID_DIRECTION, }, files: excalidrawData.files, libraryItems: await this.getLibrary(), @@ -3939,6 +3942,13 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ window.setTimeout(()=>this.updateScene({appState:{gridColor: this.getGridColor(canvasColor, st)}, captureUpdate: CaptureUpdateAction.NEVER})); } + public updateGridDirection(gridDirection: {horizontal: boolean, vertical: boolean}) { + window.setTimeout(()=>this.updateScene({appState:{gridDirection: { + horizontal: gridDirection.horizontal, + vertical: gridDirection.vertical} + }, captureUpdate: CaptureUpdateAction.NEVER})); + } + private canvasColorChangeHook(st: AppState) { (process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.canvasColorChangeHook, "ExcalidrawView.canvasColorChangeHook", st); const canvasColor = st.viewBackgroundColor === "transparent" ? "white" : st.viewBackgroundColor;