feat(templates): add support for built-in templates

This commit is contained in:
Elian Doran
2025-06-17 18:36:20 +03:00
parent 7e399cc10c
commit fa11295693
3 changed files with 61 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ import migrationService from "./migration.js";
import { t } from "i18next";
import { cleanUpHelp, getHelpHiddenSubtreeData } from "./in_app_help.js";
import buildLaunchBarConfig from "./hidden_subtree_launcherbar.js";
import buildHiddenSubtreeTemplates from "./hidden_subtree_templates.js";
const LBTPL_ROOT = "_lbTplRoot";
const LBTPL_BASE = "_lbTplBase";
@@ -257,7 +258,8 @@ function buildHiddenSubtreeDefinition(helpSubtree: HiddenSubtreeItem[]): HiddenS
icon: "bx-help-circle",
children: helpSubtree,
isExpanded: true
}
},
buildHiddenSubtreeTemplates()
]
};
}

View File

@@ -0,0 +1,28 @@
import { HiddenSubtreeItem } from "@triliumnext/commons";
export default function buildHiddenSubtreeTemplates() {
const templates: HiddenSubtreeItem = {
id: "_templates",
title: "Built-in templates",
type: "book",
children: [
{
id: "_template_text_snippet",
type: "text",
title: "Text Snippet",
attributes: [
{
name: "template",
type: "label"
},
{
name: "textSnippet",
type: "label"
}
]
}
]
};
return templates;
}