mirror of
https://github.com/zadam/trilium.git
synced 2025-11-04 13:39:01 +01:00
feat(insert_note): add dedicated section for collections
This commit is contained in:
parent
fc4a595725
commit
035b72a08d
@ -81,7 +81,8 @@ let rootCreationDate: Date | undefined;
|
|||||||
async function getNoteTypeItems(command?: TreeCommandNames) {
|
async function getNoteTypeItems(command?: TreeCommandNames) {
|
||||||
const items: MenuItem<TreeCommandNames>[] = [
|
const items: MenuItem<TreeCommandNames>[] = [
|
||||||
...getBlankNoteTypes(command),
|
...getBlankNoteTypes(command),
|
||||||
...await getBuiltInTemplates(command),
|
...await getBuiltInTemplates("Collections", command, true),
|
||||||
|
...await getBuiltInTemplates(null, command, false),
|
||||||
...await getUserTemplates(command)
|
...await getUserTemplates(command)
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -139,7 +140,7 @@ async function getUserTemplates(command?: TreeCommandNames) {
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getBuiltInTemplates(command?: TreeCommandNames) {
|
async function getBuiltInTemplates(title: string | null, command: TreeCommandNames | undefined, filterCollections: boolean) {
|
||||||
const templatesRoot = await froca.getNote("_templates");
|
const templatesRoot = await froca.getNote("_templates");
|
||||||
if (!templatesRoot) {
|
if (!templatesRoot) {
|
||||||
console.warn("Unable to find template root.");
|
console.warn("Unable to find template root.");
|
||||||
@ -155,7 +156,18 @@ async function getBuiltInTemplates(command?: TreeCommandNames) {
|
|||||||
SEPARATOR
|
SEPARATOR
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (title) {
|
||||||
|
items.push({
|
||||||
|
title: title,
|
||||||
|
enabled: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
for (const templateNote of childNotes) {
|
for (const templateNote of childNotes) {
|
||||||
|
if (templateNote.hasLabel("collection") !== filterCollections) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const item: MenuItem<TreeCommandNames> = {
|
const item: MenuItem<TreeCommandNames> = {
|
||||||
title: templateNote.title,
|
title: templateNote.title,
|
||||||
uiIcon: templateNote.getIcon(),
|
uiIcon: templateNote.getIcon(),
|
||||||
|
|||||||
@ -37,6 +37,10 @@ export default function buildHiddenSubtreeTemplates() {
|
|||||||
name: "template",
|
name: "template",
|
||||||
type: "label"
|
type: "label"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "collection",
|
||||||
|
type: "label"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "viewType",
|
name: "viewType",
|
||||||
type: "label",
|
type: "label",
|
||||||
@ -54,6 +58,10 @@ export default function buildHiddenSubtreeTemplates() {
|
|||||||
name: "template",
|
name: "template",
|
||||||
type: "label"
|
type: "label"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "collection",
|
||||||
|
type: "label"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "viewType",
|
name: "viewType",
|
||||||
type: "label",
|
type: "label",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user