mirror of
https://github.com/felvesthe/Note-Locker.git
synced 2026-07-22 05:44:06 +00:00
Add locked note's rename handling
Signed-off-by: Felvesthe <23108389+Felvesthe@users.noreply.github.com>
This commit is contained in:
parent
8c1788f259
commit
9012fba28f
1 changed files with 13 additions and 0 deletions
13
main.ts
13
main.ts
|
|
@ -39,6 +39,19 @@ export default class NoteLockerPlugin extends Plugin {
|
|||
this.updateLeafMode(leaf)
|
||||
)
|
||||
);
|
||||
|
||||
this.registerEvent(
|
||||
this.app.vault.on("rename", async (file, oldPath) => {
|
||||
if (this.settings.lockedNotes.delete(oldPath)) {
|
||||
if (!this.settings.lockedNotes.has(file.path)) {
|
||||
this.settings.lockedNotes.add(file.path);
|
||||
} else {
|
||||
new Notice(`⚠️ Lock skipped: "${file.name}" was already locked`);
|
||||
}
|
||||
await this.saveSettings();
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private initializeExistingLeaves() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue