mirror of
https://github.com/philips/supernote-obsidian-plugin.git
synced 2026-07-22 09:50:25 +00:00
AutoSyncMarkdown optimisation
check isAutoSyncMarkdownEnabled first.then check file extension
This commit is contained in:
parent
35d0f0051a
commit
3001edd6ec
1 changed files with 2 additions and 2 deletions
|
|
@ -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(() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue