fix: autocomplete fallback markdown + error catch
This commit is contained in:
@@ -1743,13 +1743,18 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig
|
|||||||
m.searchWikilinks(result.partial || '', function(items) {
|
m.searchWikilinks(result.partial || '', function(items) {
|
||||||
showAutocomplete(items, 'Wikilinks');
|
showAutocomplete(items, 'Wikilinks');
|
||||||
});
|
});
|
||||||
} else if (result.items.length > 0) {
|
} else if (result.items && result.items.length > 0) {
|
||||||
var ctxLabels = {
|
var ctxLabels = {
|
||||||
mermaid: 'Mermaid', code: 'Code', fence_open: 'Langage',
|
mermaid: 'Mermaid', code: 'Code', fence_open: 'Langage',
|
||||||
frontmatter: 'Frontmatter', markdown: 'Markdown'
|
frontmatter: 'Frontmatter', markdown: 'Markdown'
|
||||||
};
|
};
|
||||||
showAutocomplete(result.items, ctxLabels[result.context] || result.context);
|
showAutocomplete(result.items, ctxLabels[result.context] || result.context);
|
||||||
|
} else {
|
||||||
|
// Fallback: show markdown formatting suggestions
|
||||||
|
showAutocomplete(m.MARKDOWN_FORMAT, 'Markdown');
|
||||||
}
|
}
|
||||||
|
}).catch(function(err) {
|
||||||
|
console.error('[Autocomplete] Failed to load module:', err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
loadAndTrigger();
|
loadAndTrigger();
|
||||||
|
|||||||
Reference in New Issue
Block a user