mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
feat(text-snippets): reload when a new template is added
This commit is contained in:
parent
97799bfacc
commit
3e40a35c19
@ -36,6 +36,11 @@ export default async function getTemplates() {
|
||||
return definitions;
|
||||
}
|
||||
|
||||
function handleFullReload() {
|
||||
console.warn("Full text editor reload needed");
|
||||
appContext.triggerCommand("reloadTextEditor");
|
||||
}
|
||||
|
||||
async function handleContentUpdate(affectedNoteIds: string[]) {
|
||||
const updatedNoteIds = new Set(affectedNoteIds);
|
||||
const templateNoteIds = new Set(templateCache.keys());
|
||||
@ -66,8 +71,7 @@ async function handleContentUpdate(affectedNoteIds: string[]) {
|
||||
}
|
||||
|
||||
if (fullReloadNeeded) {
|
||||
console.warn("Full text editor reload needed");
|
||||
appContext.triggerCommand("reloadTextEditor");
|
||||
handleFullReload();
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,6 +81,11 @@ export function updateTemplateCache(loadResults: LoadResults): boolean {
|
||||
debouncedHandleContentUpdate(affectedNoteIds);
|
||||
}
|
||||
|
||||
if (loadResults.getAttributeRows().find((attr) =>
|
||||
attr.type === "label" &&
|
||||
attr.name === "textSnippet")) {
|
||||
handleFullReload();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user