diff --git a/manifest-beta.json b/manifest-beta.json index a64b897..dd5626c 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "2.12.2", + "version": "2.12.3", "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 7649762..a06f6ac 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "2.12.2", + "version": "2.12.3", "minAppVersion": "1.1.6", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/package-lock.json b/package-lock.json index 9b487c9..495209b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@popperjs/core": "^2.11.8", "@zsviczian/colormaster": "^1.2.2", - "@zsviczian/excalidraw": "0.18.0-21", + "@zsviczian/excalidraw": "0.18.0-23", "chroma-js": "^2.4.2", "clsx": "^2.0.0", "es6-promise-pool": "2.5.0", @@ -3494,10 +3494,9 @@ "license": "MIT" }, "node_modules/@zsviczian/excalidraw": { - "version": "0.18.0-21", - "resolved": "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.18.0-21.tgz", - "integrity": "sha512-j7ltw+FY8SrcN7a2NlPACNnUsiG6eZCLAwjZNg275U2puDf4CVGzCl6d4hB24jUn9DL5F4HKrcKLspBhxJHKaA==", - "license": "MIT", + "version": "0.18.0-23", + "resolved": "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.18.0-23.tgz", + "integrity": "sha512-IFRPjBUZo2cfnhuc8EuXST17J/koJuu0m5A2SKl8yKBANUYmiszrNIL2nDVPPP3ZM3Io/prPpID6ZMUlgNEufQ==", "dependencies": { "@braintree/sanitize-url": "6.0.2", "@excalidraw/random-username": "1.1.0", diff --git a/package.json b/package.json index e95dc1c..84b4f1d 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "license": "MIT", "dependencies": { "@popperjs/core": "^2.11.8", - "@zsviczian/excalidraw": "0.18.0-21", + "@zsviczian/excalidraw": "0.18.0-23", "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 666e308..64adad2 100644 --- a/src/core/settings.ts +++ b/src/core/settings.ts @@ -69,7 +69,9 @@ export interface ExcalidrawSettings { drawingFilnameEmbedPostfix: string; drawingFilenameDateTime: string; useExcalidrawExtension: boolean; + cropSuffix: string; cropPrefix: string; + annotateSuffix: string; annotatePrefix: string; annotatePreserveSize: boolean; displaySVGInPreview: boolean; //No longer used since 1.9.13 @@ -252,7 +254,9 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = { drawingFilnameEmbedPostfix: " ", drawingFilenameDateTime: "YYYY-MM-DD HH.mm.ss", useExcalidrawExtension: true, + cropSuffix: "", cropPrefix: CROPPED_PREFIX, + annotateSuffix: "", annotatePrefix: ANNOTATED_PREFIX, annotatePreserveSize: false, displaySVGInPreview: undefined, @@ -320,7 +324,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = { experimentalFileTag: "✏️", experimentalLivePreview: true, fadeOutExcalidrawMarkup: false, - loadPropertySuggestions: true, + loadPropertySuggestions: false, experimentalEnableFourthFont: false, experimantalFourthFont: "Virgil", addDummyTextElement: false, @@ -956,7 +960,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab { .setDesc(fragWithHTML(t("CROP_PREFIX_DESC"))) .addText((text) => text - .setPlaceholder("e.g.: Cropped_ ") + .setPlaceholder("e.g.: cropped_") .setValue(this.plugin.settings.cropPrefix) .onChange(async (value) => { this.plugin.settings.cropPrefix = value.replaceAll( @@ -968,12 +972,29 @@ export class ExcalidrawSettingTab extends PluginSettingTab { }), ); + new Setting(detailsEl) + .setName(t("CROP_SUFFIX_NAME")) + .setDesc(fragWithHTML(t("CROP_SUFFIX_DESC"))) + .addText((text) => + text + .setPlaceholder("e.g.: _cropped") + .setValue(this.plugin.settings.cropSuffix) + .onChange(async (value) => { + this.plugin.settings.cropSuffix = value.replaceAll( + /[<>:"/\\|?*]/g, + "_", + ); + text.setValue(this.plugin.settings.cropSuffix); + this.applySettingsUpdate(); + }), + ); + new Setting(detailsEl) .setName(t("ANNOTATE_PREFIX_NAME")) .setDesc(fragWithHTML(t("ANNOTATE_PREFIX_DESC"))) .addText((text) => text - .setPlaceholder("e.g.: Annotated_ ") + .setPlaceholder("e.g.: annotated_") .setValue(this.plugin.settings.annotatePrefix) .onChange(async (value) => { this.plugin.settings.annotatePrefix = value.replaceAll( @@ -984,7 +1005,24 @@ export class ExcalidrawSettingTab extends PluginSettingTab { this.applySettingsUpdate(); }), ); - + + new Setting(detailsEl) + .setName(t("ANNOTATE_SUFFIX_NAME")) + .setDesc(fragWithHTML(t("ANNOTATE_SUFFIX_DESC"))) + .addText((text) => + text + .setPlaceholder("e.g.: _annotated") + .setValue(this.plugin.settings.annotateSuffix) + .onChange(async (value) => { + this.plugin.settings.annotateSuffix = value.replaceAll( + /[<>:"/\\|?*]/g, + "_", + ); + text.setValue(this.plugin.settings.annotateSuffix); + this.applySettingsUpdate(); + }), + ); + new Setting(detailsEl) .setName(t("ANNOTATE_PRESERVE_SIZE_NAME")) .setDesc(fragWithHTML(t("ANNOTATE_PRESERVE_SIZE_DESC"))) diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index 2e80d98..8a1f199 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -203,14 +203,22 @@ export default { FOLDER_NAME: "Excalidraw folder (CAsE sEnsITive!)", FOLDER_DESC: "Default location for new drawings. If empty, drawings will be created in the Vault root.", + CROP_SUFFIX_NAME: "Crop file suffix", + CROP_SUFFIX_DESC: + "The last part of the filename for new drawings created when cropping an image. " + + "Leave empty if you don't need a sufix.", CROP_PREFIX_NAME: "Crop file prefix", CROP_PREFIX_DESC: "The first part of the filename for new drawings created when cropping an image. " + - "If empty the default 'cropped_' will be used.", + "Leave empty if you don't need a prefix.", + ANNOTATE_SUFFIX_NAME: "Annotation file suffix", + ANNOTATE_SUFFIX_DESC: + "The last part of the filename for new drawings created when annotating an image. " + + "Leave empty if you don't need a suffix.", ANNOTATE_PREFIX_NAME: "Annotation file prefix", ANNOTATE_PREFIX_DESC: "The first part of the filename for new drawings created when annotating an image. " + - "If empty the default 'annotated_' will be used.", + "Leave empty if you don't need a prefix.", ANNOTATE_PRESERVE_SIZE_NAME: "Preserve image size when annotating", ANNOTATE_PRESERVE_SIZE_DESC: "When annotating an image in markdown the replacment image link will include the width of the original image.", diff --git a/src/shared/Dialogs/Messages.ts b/src/shared/Dialogs/Messages.ts index ceddc8a..b8af288 100644 --- a/src/shared/Dialogs/Messages.ts +++ b/src/shared/Dialogs/Messages.ts @@ -17,6 +17,17 @@ I build this plugin in my free time, as a labor of love. Curious about the philo
Buy Me a Coffee at ko-fi.com
`, +"2.12.3":` +## Minor fixes +- Includes all recent updates and fixes from excalidraw.com +- Fixed issue with line editor snapping out of edit mode +- Fixed long-standing issue with wireframe to code calling a deprecated OpenAI endpoint +- "Load Excalidraw Properties into Obsidian Suggester" setting now defaults to false for new installations. [#2380](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2380) +- Taskbone OCR result does not get saved to frontmatter in some cases [#1123](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1123) + +## New +- If the cropped file or annotated file prefix is set to empty, there will now be no prefix added to the file name. Additionally, now you can also set a suffix to the file name. [#2370](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2370) +`, "2.12.2": ` ## Fixed - BUG: Excalidraw theme changes to Light from Dark when clicking line element node [#2360](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2360) diff --git a/src/shared/OCR/Taskbone.ts b/src/shared/OCR/Taskbone.ts index da65a76..fd6849d 100644 --- a/src/shared/OCR/Taskbone.ts +++ b/src/shared/OCR/Taskbone.ts @@ -114,7 +114,7 @@ export default class Taskbone { if(addToFrontmatter) { fe.setKey("taskbone-ocr",text); view.data = fe.data; - view.save(false); + view.save(false, true, true); } window.navigator.clipboard.writeText(text); new Notice(`I placed the recognized text onto the system clipboard${addToFrontmatter?" and to document properties":""}.`); diff --git a/src/utils/fileUtils.ts b/src/utils/fileUtils.ts index 8d1d1bc..2061e68 100644 --- a/src/utils/fileUtils.ts +++ b/src/utils/fileUtils.ts @@ -405,8 +405,8 @@ export const getAliasWithSize = (alias: string, size: string): string => { export const getCropFileNameAndFolder = async (plugin: ExcalidrawPlugin, hostPath: string, baseNewFileName: string):Promise<{folderpath: string, filename: string}> => { let prefix = plugin.settings.cropPrefix || ""; - if(prefix.trim() === "") prefix = CROPPED_PREFIX; - const filename = prefix + baseNewFileName + ".md"; + let suffix = plugin.settings.cropSuffix || ""; + const filename = prefix + baseNewFileName + suffix + ".md"; if(!plugin.settings.cropFolder || plugin.settings.cropFolder.trim() === "") { const folderpath = (await getAttachmentsFolderAndFilePath(plugin.app, hostPath, filename)).folder; return {folderpath, filename}; @@ -418,8 +418,8 @@ export const getCropFileNameAndFolder = async (plugin: ExcalidrawPlugin, hostPat export const getAnnotationFileNameAndFolder = async (plugin: ExcalidrawPlugin, hostPath: string, baseNewFileName: string):Promise<{folderpath: string, filename: string}> => { let prefix = plugin.settings.annotatePrefix || ""; - if(prefix.trim() === "") prefix = ANNOTATED_PREFIX; - const filename = prefix + baseNewFileName + ".md"; + let suffix = plugin.settings.annotateSuffix || ""; + const filename = prefix + baseNewFileName + suffix + ".md"; if(!plugin.settings.annotateFolder || plugin.settings.annotateFolder.trim() === "") { const folderpath = (await getAttachmentsFolderAndFilePath(plugin.app, hostPath, filename)).folder; return {folderpath, filename}; diff --git a/src/view/ExcalidrawView.ts b/src/view/ExcalidrawView.ts index e14ea7c..4708b44 100644 --- a/src/view/ExcalidrawView.ts +++ b/src/view/ExcalidrawView.ts @@ -2518,6 +2518,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ if (!this.excalidrawAPI) { return; } + const loader = new EmbeddedFilesLoader(this.plugin); const runLoader = (l: EmbeddedFilesLoader) => { @@ -2705,7 +2706,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ if(this.getSceneVersion(inData.scene.elements) !== this.previousSceneVersion) { this.setDirty(3); } - this.updateScene({elements: sceneElements, storeAction: "capture"}); + this.updateScene({elements: sceneElements, captureUpdate: CaptureUpdateAction.IMMEDIATELY}); if(reloadFiles.size>0) { this.loadSceneFiles(false,reloadFiles); }