mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Fix function for getting the folder of a folder note
This commit is contained in:
parent
86bd49d873
commit
2683ee1a1a
2 changed files with 9 additions and 2 deletions
|
|
@ -188,11 +188,11 @@ async function updateFolderNamesInPath(
|
|||
const folderNote = getFolderNote(plugin, folderPath);
|
||||
const viewHeaderTitle = titleContainer.querySelector('.view-header-title');
|
||||
|
||||
if (viewHeaderTitle) {
|
||||
if (viewHeaderTitle && folderNote) {
|
||||
const filePath = path + (viewHeaderTitle as HTMLElement).innerText.trim() + '.md';
|
||||
const file = plugin.app.vault.getAbstractFileByPath(
|
||||
filePath);
|
||||
const folder = getFolderNoteFolder(plugin, file?.path ?? '', file?.name ?? '');
|
||||
const folder = getFolderNoteFolder(plugin, folderNote, file?.name ?? '');
|
||||
if (folder && file && file.path === folderNote?.path && file.parent?.path !== '/') {
|
||||
viewHeaderTitle.parentElement?.classList.add('hide-folder-note-title-in-path');
|
||||
viewHeaderTitle.classList.add('path-is-folder-note');
|
||||
|
|
|
|||
|
|
@ -556,6 +556,13 @@ export function getFolderNoteFolder(
|
|||
filePath = folderNote.path;
|
||||
}
|
||||
const folderName = extractFolderName(plugin.settings.folderNoteName, fileName);
|
||||
if (!plugin.settings.folderNoteName.includes('{{folder_name}}') && plugin.settings.storageLocation === 'insideFolder') {
|
||||
if (folderNote instanceof TFile) {
|
||||
return folderNote.parent;
|
||||
}
|
||||
const file = plugin.app.vault.getAbstractFileByPath(filePath);
|
||||
return file instanceof TFile ? file.parent : null;
|
||||
}
|
||||
if (!folderName) return null;
|
||||
let folderPath = getFolderPathFromString(filePath);
|
||||
if (plugin.settings.storageLocation === 'parentFolder') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue