From 3001edd6ec46a2820a8af2bca3c8dbde346b16ac Mon Sep 17 00:00:00 2001 From: Floper Date: Fri, 5 Jun 2026 09:58:48 +0200 Subject: [PATCH] AutoSyncMarkdown optimisation check isAutoSyncMarkdownEnabled first.then check file extension --- src/main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index 705d56d..614a8db 100644 --- a/src/main.ts +++ b/src/main.ts @@ -753,16 +753,16 @@ export default class SupernotePlugin extends Plugin { this.registerEvent( this.app.vault.on('create', (file) => { - if (!(file instanceof TFile) || file.extension !== 'note') return; if (!this.settings.isAutoSyncMarkdownEnabled) return; + if (!(file instanceof TFile) || file.extension !== 'note') return; vw.attachMarkdownFile(file, true).catch(e => console.error('Supernote auto-sync (create) error:', e)); }) ); this.registerEvent( this.app.vault.on('modify', (file) => { - if (!(file instanceof TFile) || file.extension !== 'note') return; if (!this.settings.isAutoSyncMarkdownEnabled) return; + if (!(file instanceof TFile) || file.extension !== 'note') return; const existing = syncDebounceMap.get(file.path); if (existing) clearTimeout(existing); syncDebounceMap.set(file.path, setTimeout(() => {