Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
fix: no active editor won't break plugin now, set a minimum time for …
Browse files Browse the repository at this point in the history
…plugin run the second time

fix #29
  • Loading branch information
JYC333 committed Dec 26, 2023
1 parent 1ec6243 commit 7faf232
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
10 changes: 8 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -561,7 +567,7 @@ export default class AttachmentNameFormatting extends Plugin {
} else {
console.log("No attachments found...");
}
this.renaming = false;
setTimeout(() => (this.renaming = false), 3000);
}

/*
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 7faf232

Please sign in to comment.