mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +02:00
feat(collection/presentation): add default content to the two slides
This commit is contained in:
parent
f9a24bf601
commit
d801d8a053
@ -345,17 +345,24 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
|
||||
let branch;
|
||||
|
||||
if (!note) {
|
||||
// Missing item, add it.
|
||||
({ note, branch } = noteService.createNewNote({
|
||||
noteId: item.id,
|
||||
title: item.title,
|
||||
type: item.type,
|
||||
parentNoteId: parentNoteId,
|
||||
content: "",
|
||||
content: item.content ?? "",
|
||||
ignoreForbiddenParents: true
|
||||
}));
|
||||
} else {
|
||||
// Existing item, check if it's in the right state.
|
||||
branch = note.getParentBranches().find((branch) => branch.parentNoteId === parentNoteId);
|
||||
|
||||
if (item.content && note.getContent() !== item.content) {
|
||||
console.log(`Updating content of ${item.id}.`);
|
||||
note.setContent(item.content);
|
||||
}
|
||||
|
||||
// Clean up any branches that shouldn't exist according to the meta definition
|
||||
// For hidden subtree notes, we want to ensure they only exist in their designated locations
|
||||
if (item.enforceBranches || item.id.startsWith("_help")) {
|
||||
|
@ -264,6 +264,7 @@ export default function buildHiddenSubtreeTemplates() {
|
||||
id: "_template_presentation_first",
|
||||
type: "text",
|
||||
title: t("hidden_subtree_templates.presentation_slide_first"),
|
||||
content: t("hidden_subtree_templates.presentation_slide_first"),
|
||||
attributes: [
|
||||
{
|
||||
name: "template",
|
||||
@ -276,6 +277,7 @@ export default function buildHiddenSubtreeTemplates() {
|
||||
id: "_template_presentation_second",
|
||||
type: "text",
|
||||
title: t("hidden_subtree_templates.presentation_slide_second"),
|
||||
content: t("hidden_subtree_templates.presentation_slide_second"),
|
||||
attributes: [
|
||||
{
|
||||
name: "template",
|
||||
|
@ -54,4 +54,10 @@ export interface HiddenSubtreeItem {
|
||||
* definitions will be removed.
|
||||
*/
|
||||
enforceAttributes?: boolean;
|
||||
/**
|
||||
* Optionally, a content to be set in the hidden note. If undefined, an empty string will be set instead.
|
||||
*
|
||||
* The value is also checked at every startup to ensure that it's kept up to date according to the definition.
|
||||
*/
|
||||
content?: string;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user