Fixed front matter title plugin bugs

This commit is contained in:
Lost Paul 2023-07-26 21:35:48 +02:00
parent b9f5c63011
commit d7423a148b
2 changed files with 5 additions and 4 deletions

View file

@ -60,7 +60,7 @@ export default class FolderNotesPlugin extends Plugin {
const folderPath = path.slice(0, -1);
breadcrumb.setAttribute('data-path', folderPath);
const folder = this.fmtpHandler?.modifiedFolders.get(folderPath);
if (folder) {
if (folder && this.settings.frontMatterTitle.path && this.settings.frontMatterTitle.enabled) {
breadcrumb.setAttribute('old-name', folder.name || '');
breadcrumb.innerText = folder.newName || '';
}
@ -251,7 +251,7 @@ export default class FolderNotesPlugin extends Plugin {
}
fileExplorerItem = fileExplorerItem.querySelector('div.nav-folder-title-content')
if (!fileExplorerItem) { return; }
if (this.settings.frontMatterTitle.explorer) {
if (this.settings.frontMatterTitle.explorer && this.settings.frontMatterTitle.enabled) {
fileExplorerItem.innerText = name;
fileExplorerItem.setAttribute('old-name', folder.name);
} else {

View file

@ -403,6 +403,9 @@ export class SettingsTab extends PluginSettingTab {
if (this.plugin.fmtpHandler) {
this.plugin.updateBreadcrumbs(true);
}
this.plugin.app.vault.getFiles().forEach((file) => {
this.plugin.fmtpHandler?.handleRename({ id: '', result: false, path: file.path }, false);
});
this.plugin.fmtpHandler?.deleteEvent();
this.plugin.fmtpHandler = null;
}
@ -423,7 +426,6 @@ export class SettingsTab extends PluginSettingTab {
this.plugin.app.vault.getFiles().forEach((file) => {
this.plugin.fmtpHandler?.handleRename({ id: '', result: false, path: file.path }, false);
});
this.display();
})
);
@ -441,7 +443,6 @@ export class SettingsTab extends PluginSettingTab {
} else {
this.plugin.updateBreadcrumbs(true);
}
this.display();
})
);
}