diff --git a/src/public/app/widgets/attribute_widgets/attribute_detail.js b/src/public/app/widgets/attribute_widgets/attribute_detail.js
index fefcc047e..7ca7a05da 100644
--- a/src/public/app/widgets/attribute_widgets/attribute_detail.js
+++ b/src/public/app/widgets/attribute_widgets/attribute_detail.js
@@ -196,7 +196,16 @@ const ATTR_HELP = {
"iconClass": "value of this label is added as a CSS class to the icon on the tree which can help visually distinguish the notes in the tree. Example might be bx bx-home - icons are taken from boxicons. Can be used in template notes.",
"pageSize": "number of items per page in note listing",
"customRequestHandler": 'see Custom request handler',
- "customResourceProvider": 'see Custom request handler'
+ "customResourceProvider": 'see Custom request handler',
+ "widget": "marks this note as a custom widget which will be added to the Trilium component tree",
+ "workspace": "marks this note as a workspace which allows easy hoisting",
+ "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",
+ "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",
+ "hoistedInbox": "default inbox location for new notes when hoisted to some ancestor of this note",
+ "sqlConsoleHome": "default location of SQL console notes",
},
"relation": {
"runOnNoteCreation": "executes when note is created on backend",
diff --git a/src/routes/api/date_notes.js b/src/routes/api/date_notes.js
index 03c4ccee9..b28ad3aa7 100644
--- a/src/routes/api/date_notes.js
+++ b/src/routes/api/date_notes.js
@@ -9,8 +9,27 @@ const cls = require('../../services/cls');
const repository = require('../../services/repository');
function getInboxNote(req) {
- return attributeService.getNoteWithLabel('inbox')
- || dateNoteService.getDateNote(req.params.date);
+ const hoistedNote = getHoistedNote();
+
+ let inbox;
+
+ if (hoistedNote) {
+ ([inbox] = hoistedNote.getDescendantNotesWithLabel('hoistedInbox'));
+
+ if (!inbox) {
+ ([inbox] = hoistedNote.getDescendantNotesWithLabel('inbox'));
+ }
+
+ if (!inbox) {
+ inbox = hoistedNote;
+ }
+ }
+ else {
+ inbox = attributeService.getNoteWithLabel('inbox')
+ || dateNoteService.getDateNote(req.params.date);
+ }
+
+ return inbox;
}
function getDateNote(req) {
@@ -66,27 +85,18 @@ function createSearchNote(req) {
const searchString = params.searchString || "";
let ancestorNoteId = params.ancestorNoteId;
- const hoistedNote = cls.getHoistedNoteId() && cls.getHoistedNoteId() !== 'root'
- ? repository.getNote(cls.getHoistedNoteId())
- : null;
+ const hoistedNote = getHoistedNote();
let searchHome;
if (hoistedNote) {
([searchHome] = hoistedNote.getDescendantNotesWithLabel('hoistedSearchHome'));
- }
- if (!searchHome) {
- const today = dateUtils.localNowDate();
+ if (!searchHome) {
+ ([searchHome] = hoistedNote.getDescendantNotesWithLabel('searchHome'));
+ }
- searchHome = attributeService.getNoteWithLabel('searchHome')
- || dateNoteService.getDateNote(today);
- }
-
- if (hoistedNote) {
-
- if (!hoistedNote.getDescendantNoteIds().includes(searchHome.noteId)) {
- // otherwise the note would be saved outside of the hoisted context which is weird
+ if (!searchHome) {
searchHome = hoistedNote;
}
@@ -94,6 +104,12 @@ function createSearchNote(req) {
ancestorNoteId = hoistedNote.noteId;
}
}
+ else {
+ const today = dateUtils.localNowDate();
+
+ searchHome = attributeService.getNoteWithLabel('searchHome')
+ || dateNoteService.getDateNote(today);
+ }
const {note} = noteService.createNewNote({
parentNoteId: searchHome.noteId,
@@ -112,6 +128,12 @@ function createSearchNote(req) {
return note;
}
+function getHoistedNote() {
+ return cls.getHoistedNoteId() && cls.getHoistedNoteId() !== 'root'
+ ? repository.getNote(cls.getHoistedNoteId())
+ : null;
+}
+
module.exports = {
getInboxNote,
getDateNote,
diff --git a/src/services/attributes.js b/src/services/attributes.js
index 3a684adbc..ae78130f8 100644
--- a/src/services/attributes.js
+++ b/src/services/attributes.js
@@ -37,6 +37,7 @@ const BUILTIN_ATTRIBUTES = [
{ type: 'label', name: 'workspaceIconClass' },
{ type: 'label', name: 'workspaceTabBackgroundColor' },
{ type: 'label', name: 'searchHome' },
+ { type: 'label', name: 'hoistedInbox' },
{ type: 'label', name: 'hoistedSearchHome' },
{ type: 'label', name: 'sqlConsoleHome' },
{ type: 'label', name: 'datePattern' },