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;
|
let branch;
|
||||||
|
|
||||||
if (!note) {
|
if (!note) {
|
||||||
|
// Missing item, add it.
|
||||||
({ note, branch } = noteService.createNewNote({
|
({ note, branch } = noteService.createNewNote({
|
||||||
noteId: item.id,
|
noteId: item.id,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
type: item.type,
|
type: item.type,
|
||||||
parentNoteId: parentNoteId,
|
parentNoteId: parentNoteId,
|
||||||
content: "",
|
content: item.content ?? "",
|
||||||
ignoreForbiddenParents: true
|
ignoreForbiddenParents: true
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
|
// Existing item, check if it's in the right state.
|
||||||
branch = note.getParentBranches().find((branch) => branch.parentNoteId === parentNoteId);
|
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
|
// 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
|
// For hidden subtree notes, we want to ensure they only exist in their designated locations
|
||||||
if (item.enforceBranches || item.id.startsWith("_help")) {
|
if (item.enforceBranches || item.id.startsWith("_help")) {
|
||||||
|
@ -264,6 +264,7 @@ export default function buildHiddenSubtreeTemplates() {
|
|||||||
id: "_template_presentation_first",
|
id: "_template_presentation_first",
|
||||||
type: "text",
|
type: "text",
|
||||||
title: t("hidden_subtree_templates.presentation_slide_first"),
|
title: t("hidden_subtree_templates.presentation_slide_first"),
|
||||||
|
content: t("hidden_subtree_templates.presentation_slide_first"),
|
||||||
attributes: [
|
attributes: [
|
||||||
{
|
{
|
||||||
name: "template",
|
name: "template",
|
||||||
@ -276,6 +277,7 @@ export default function buildHiddenSubtreeTemplates() {
|
|||||||
id: "_template_presentation_second",
|
id: "_template_presentation_second",
|
||||||
type: "text",
|
type: "text",
|
||||||
title: t("hidden_subtree_templates.presentation_slide_second"),
|
title: t("hidden_subtree_templates.presentation_slide_second"),
|
||||||
|
content: t("hidden_subtree_templates.presentation_slide_second"),
|
||||||
attributes: [
|
attributes: [
|
||||||
{
|
{
|
||||||
name: "template",
|
name: "template",
|
||||||
|
@ -54,4 +54,10 @@ export interface HiddenSubtreeItem {
|
|||||||
* definitions will be removed.
|
* definitions will be removed.
|
||||||
*/
|
*/
|
||||||
enforceAttributes?: boolean;
|
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