Make it possible to use folder overview plugin at the same time

This commit is contained in:
Lost Paul 2025-01-08 22:26:01 +01:00
parent 1e4ed4b102
commit a44cba7ef8
3 changed files with 12 additions and 9 deletions

View file

@ -1,7 +1,7 @@
{
"id": "folder-notes",
"name": "Folder notes",
"version": "1.7.32",
"version": "1.7.33",
"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",

View file

@ -140,8 +140,8 @@ export async function createFolderNote(plugin: FolderNotesPlugin, folderPath: st
const folder = plugin.app.vault.getAbstractFileByPath(folderPath);
if (!(folder instanceof TFolder)) return;
addCSSClassToTitleEL(plugin, path, 'is-folder-note', true);
addCSSClassToTitleEL(plugin, folder.path, 'has-folder-note');
addCSSClassToTitleEL(path, 'is-folder-note', true);
addCSSClassToTitleEL(folder.path, 'has-folder-note');
}
export async function turnIntoFolderNote(plugin: FolderNotesPlugin, file: TFile, folder: TFolder, folderNote?: TFile | null | TAbstractFile, skipConfirmation?: boolean) {
@ -186,8 +186,8 @@ export async function turnIntoFolderNote(plugin: FolderNotesPlugin, file: TFile,
}
await plugin.app.fileManager.renameFile(file, path);
addCSSClassToTitleEL(plugin, path, 'is-folder-note', true);
addCSSClassToTitleEL(plugin, folder.path, 'has-folder-note');
addCSSClassToTitleEL(path, 'is-folder-note', true);
addCSSClassToTitleEL(folder.path, 'has-folder-note');
if (plugin.activeFolderDom) {
plugin.activeFolderDom.removeClass('fn-is-active');

View file

@ -118,9 +118,12 @@ export default class FolderNotesPlugin extends Plugin {
handleDelete(file, this);
}));
this.registerMarkdownCodeBlockProcessor('folder-overview', (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => {
this.handleOverviewBlock(source, el, ctx);
});
const folderOverviewEnabled = this.app.plugins.getPlugin('folder-overview')
if (!folderOverviewEnabled) {
this.registerMarkdownCodeBlockProcessor('folder-overview', (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => {
this.handleOverviewBlock(source, el, ctx);
});
}
if (this.app.workspace.layoutReady) {
// loadFileClasses(undefined, this);
@ -155,7 +158,7 @@ export default class FolderNotesPlugin extends Plugin {
// @ts-ignore
const editMode = view.editMode ?? view.sourceMode ?? this.app.workspace.activeEditor?.editMode;
if (!editMode) { return; }
// console.log('editMode', editMode);
const plugin = this;