mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Fixed one last sync issue
This commit is contained in:
parent
b8a2d7cc45
commit
7a5b246a78
2 changed files with 10 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "folder-notes",
|
||||
"name": "Folder notes",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.8",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Create notes within folders that can be accessed without collapsing the folder, similar to the functionality offered in Notion.",
|
||||
"author": "Lost Paul",
|
||||
|
|
|
|||
13
src/main.ts
13
src/main.ts
|
|
@ -107,7 +107,8 @@ export default class FolderNotesPlugin extends Plugin {
|
|||
const folder = this.app.vault.getAbstractFileByPath(oldPath.substring(0,
|
||||
oldPath.lastIndexOf('/' || '\\') >= 0 ? oldPath.lastIndexOf('/') : oldPath.length));
|
||||
if (folder?.name + '.md' === file.name) return;
|
||||
const oldFileName = oldPath.substring(oldPath.lastIndexOf('/' || '\\') >= 0 ? oldPath.lastIndexOf('/') +1 : oldPath.length);
|
||||
const oldFileName = oldPath.substring(oldPath.lastIndexOf('/' || '\\') >= 0 ? oldPath.lastIndexOf('/') + 1 : oldPath.length);
|
||||
|
||||
if (!folder) return;
|
||||
|
||||
const excludedFolder = this.settings.excludeFolders.find(
|
||||
|
|
@ -129,9 +130,13 @@ export default class FolderNotesPlugin extends Plugin {
|
|||
return new Notice('A folder with the same name already exists');
|
||||
}
|
||||
if (folder instanceof TFolder) {
|
||||
this.app.vault.rename(folder, folder.path.substring(0,
|
||||
folder.path.lastIndexOf('/' || '\\') >= 0 ? folder.path.lastIndexOf('/') : folder.path.length) + '/' +
|
||||
file.name.substring(0, file.name.lastIndexOf('.')));
|
||||
if (folder.path.indexOf('/') >= 0) {
|
||||
this.app.vault.rename(folder, folder.path.substring(0,
|
||||
folder.path.lastIndexOf('/' || '\\') >= 0 ? folder.path.lastIndexOf('/') : folder.path.length) + '/' +
|
||||
file.name.substring(0, file.name.lastIndexOf('.')));
|
||||
} else {
|
||||
this.app.vault.rename(folder, file.name.substring(0, file.name.lastIndexOf('.')));
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
|
|
|||
Loading…
Reference in a new issue