diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f048e1..e6341da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [2.1.7](https://github.com/JYC333/obsidian-file-structure-format/compare/2.1.6...2.1.7) (2023-12-26) + + +### Bug Fixes + +* no active editor won't break plugin now, set a minimum time for plugin run the second time ([c11e44a](https://github.com/JYC333/obsidian-file-structure-format/commit/c11e44ab14d3f5ab0eac50f568322e5f1bf86b3e)), closes [#29](https://github.com/JYC333/obsidian-file-structure-format/issues/29) + + + ## [2.1.5](https://github.com/JYC333/obsidian-file-structure-format/compare/2.1.4...2.1.5) (2023-12-07) diff --git a/manifest.json b/manifest.json index c4a017f..0855d29 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-attachment-name-formatting", "name": "Attachment Name Formatting", - "version": "2.1.5", + "version": "2.1.7", "minAppVersion": "0.12.0", "description": "Obsidian plugin for formatting attachments name (filename attachmentType indexNumber.xxx)", "author": "JYC333", diff --git a/package.json b/package.json index 245873b..b41f29f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-attachment-name-formattion", - "version": "2.1.5", + "version": "2.1.7", "description": "Obsidian plugin for formatting attachments name (filename attachmentType indexNumber.xxx)", "main": "main.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index f43e94e..477c80f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -249,7 +249,13 @@ export default class AttachmentNameFormatting extends Plugin { } this.renaming = true; timeInterval = new Date(); - const editor = this.app.workspace.activeEditor.editor; + + let editor; + try { + editor = this.app.workspace.activeEditor.editor; + } catch { + console.log("No active editor."); + } await this.getVaultAttachmentFolderPath(); @@ -561,7 +567,7 @@ export default class AttachmentNameFormatting extends Plugin { } else { console.log("No attachments found..."); } - this.renaming = false; + setTimeout(() => (this.renaming = false), 3000); } /* diff --git a/versions.json b/versions.json index 992fb63..6c14e3d 100644 --- a/versions.json +++ b/versions.json @@ -27,5 +27,6 @@ "2.1.2": "0.12.0", "2.1.3": "0.12.0", "2.1.4": "0.12.0", - "2.1.5": "0.12.0" + "2.1.5": "0.12.0", + "2.1.7": "0.12.0" } \ No newline at end of file