From 8a685f9f16a751785d079f8bd0f5ff532a73763e Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Thu, 10 Aug 2023 22:04:57 +0200 Subject: [PATCH] Remove on layout ready code block handling --- src/main.ts | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/main.ts b/src/main.ts index 3fc3928..9ab22ae 100644 --- a/src/main.ts +++ b/src/main.ts @@ -159,18 +159,11 @@ export default class FolderNotesPlugin extends Plugin { if (!this.settings.syncDelete) { return; } this.app.vault.delete(folderNote); })); - if (this.app.workspace.layoutReady) { - this.registerMarkdownCodeBlockProcessor('folder-overview', (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => { - this.handleOverviewBlock(source, el, ctx); - }); - } else { - this.app.workspace.onLayoutReady(() => { - console.log('layout ready'); - this.registerMarkdownCodeBlockProcessor('folder-overview', (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => { - this.handleOverviewBlock(source, el, ctx); - }); - }); - } + + this.registerMarkdownCodeBlockProcessor('folder-overview', (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => { + this.handleOverviewBlock(source, el, ctx); + }); + if (this.app.workspace.layoutReady) { this.loadFileClasses(); } else { @@ -196,8 +189,8 @@ export default class FolderNotesPlugin extends Plugin { subtree: true, }); try { - const folderOverview = new FolderOverview(this, ctx, source, el); - folderOverview.create(this, parseYaml(source), el, ctx); + const folderOverview = new FolderOverview(this, ctx, source, el); + folderOverview.create(this, parseYaml(source), el, ctx); } catch (e) { new Notice('Error creating folder overview (folder notes plugin) - check console for more details'); console.error(e);