Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
add #workspaceTemplate which works as workspace-scoped template, closes #3137
zadamb816773d02c4
diff --git a/src/public/app/widgets/attribute_widgets/attribute_detail.js b/src/public/app/widgets/attribute_widgets/attribute_detail.jsindex 2e2c0d0138..c11db3d96c 100644--- a/src/public/app/widgets/attribute_widgets/attribute_detail.js+++ b/src/public/app/widgets/attribute_widgets/attribute_detail.js@@ -207,6 +207,7 @@ const ATTR_HELP = {"workspaceIconClass": "defines box icon CSS class which will be used in tab when hoisted to this note","workspaceTabBackgroundColor": "CSS color used in the note tab when hoisted to this note","workspaceCalendarRoot": "Defines per-workspace calendar root",+ "workspaceTemplate": "This note will appear in the selection of available template when creating new note, but only when hoisted into a workspace containing this template","searchHome": "new search notes will be created as children of this note","hoistedSearchHome": "new search notes will be created as children of this note when hoisted to some ancestor of this note","inbox": "default inbox location for new notes",diff --git a/src/routes/api/search.js b/src/routes/api/search.jsindex 2b00fc6071..f07afcefaa 100644--- a/src/routes/api/search.js+++ b/src/routes/api/search.js@@ -6,6 +6,7 @@ const log = require('../../services/log');const scriptService = require('../../services/script');const searchService = require('../../services/search/services/search');const bulkActionService = require("../../services/bulk_actions");+const cls = require("../../services/cls");const {formatAttrForSearch} = require("../../services/attribute_formatter");function searchFromNoteInt(note) {@@ -189,7 +190,9 @@ function getRelatedNotes(req) {}function searchTemplates() {- const query = formatAttrForSearch({type: 'label', name: "template"}, false);+ const query = cls.getHoistedNoteId() === 'root'+ ? '#template'+ : '#template OR #workspaceTemplate';return searchService.searchNotes(query, {includeArchivedNotes: true,diff --git a/src/services/builtin_attributes.js b/src/services/builtin_attributes.jsindex 58e47f842b..64b1b19599 100644--- a/src/services/builtin_attributes.js+++ b/src/services/builtin_attributes.js@@ -30,6 +30,7 @@ module.exports = [{ type: 'label', name: 'workspaceIconClass' },{ type: 'label', name: 'workspaceTabBackgroundColor' },{ type: 'label', name: 'workspaceCalendarRoot' },+ { type: 'label', name: 'workspaceTemplate' },{ type: 'label', name: 'searchHome' },{ type: 'label', name: 'hoistedInbox' },{ type: 'label', name: 'hoistedSearchHome' },