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
added new "create note" button
zadamb0217ee04c10
diff --git a/src/public/app/services/date_notes.js b/src/public/app/services/date_notes.jsindex f786487d67..d31273ad08 100644--- a/src/public/app/services/date_notes.js+++ b/src/public/app/services/date_notes.js@@ -1,6 +1,13 @@import treeCache from "./tree_cache.js";import server from "./server.js";+/** @return {NoteShort} */+async function getInboxNote() {+ const note = await server.get('date-notes/inbox/' + dayjs().format("YYYY-MM-DD"), "date-note");++ return await treeCache.getNote(note.noteId);+}+/** @return {NoteShort} */async function getTodayNote() {return await getDateNote(dayjs().format("YYYY-MM-DD"));@@ -42,6 +49,7 @@ async function createSearchNote() {}export default {+ getInboxNote,getTodayNote,getDateNote,getMonthNote,diff --git a/src/public/app/services/entrypoints.js b/src/public/app/services/entrypoints.jsindex 0202c37ee9..755673b208 100644--- a/src/public/app/services/entrypoints.js+++ b/src/public/app/services/entrypoints.js@@ -62,14 +62,14 @@ export default class Entrypoints extends Component {findInPage.openFindWindow();}- async createNoteIntoDayNoteCommand() {- const todayNote = await dateNoteService.getTodayNote();+ async createNoteIntoInboxCommand() {+ const inboxNote = await dateNoteService.getInboxNote();- const {note} = await server.post(`notes/${todayNote.noteId}/children?target=into`, {+ const {note} = await server.post(`notes/${inboxNote.noteId}/children?target=into`, {title: 'new note',content: '',type: 'text',- isProtected: todayNote.isProtected+ isProtected: inboxNote.isProtected});await ws.waitForMaxKnownEntityChangeId();diff --git a/src/public/app/widgets/standard_top_widget.js b/src/public/app/widgets/standard_top_widget.jsindex 30dfdd900b..ee18e22f96 100644--- a/src/public/app/widgets/standard_top_widget.js+++ b/src/public/app/widgets/standard_top_widget.js@@ -34,17 +34,22 @@ const TPL = `</style><div style="flex-grow: 100; display: flex;">- <button class="btn btn-sm search-button" data-trigger-command="searchNotes" data-command="searchNotes">+ <button class="btn btn-sm" data-trigger-command="createNoteIntoInbox">+ <span class="bx bx-file-blank"></span>+ New note+ </button>++ <button class="btn btn-sm" data-trigger-command="searchNotes"><span class="bx bx-search"></span>Search</button>- <button class="btn btn-sm jump-to-note-dialog-button" data-trigger-command="jumpToNote">+ <button class="btn btn-sm" data-trigger-command="jumpToNote"><span class="bx bx-send"></span>Jump to note</button>- <button class="btn btn-sm recent-changes-button" data-trigger-command="showRecentChanges">+ <button class="btn btn-sm" data-trigger-command="showRecentChanges"><span class="bx bx-history"></span>Recent changesdiff --git a/src/routes/api/date_notes.js b/src/routes/api/date_notes.jsindex d00e1f6482..9e127c738e 100644--- a/src/routes/api/date_notes.js+++ b/src/routes/api/date_notes.js@@ -4,6 +4,12 @@ const dateNoteService = require('../../services/date_notes');const sql = require('../../services/sql');const dateUtils = require('../../services/date_utils');const noteService = require('../../services/notes');+const attributeService = require('../../services/attributes');++function getInboxNote(req) {+ return attributeService.getNoteWithLabel('inbox')+ || dateNoteService.getDateNote(req.params.date);+}function getDateNote(req) {return dateNoteService.getDateNote(req.params.date);@@ -68,6 +74,7 @@ function createSearchNote() {}module.exports = {+ getInboxNote,getDateNote,getMonthNote,getYearNote,diff --git a/src/routes/routes.js b/src/routes/routes.jsindex 9caf540275..1f42e842ef 100644--- a/src/routes/routes.js+++ b/src/routes/routes.js@@ -186,6 +186,7 @@ function register(app) {apiRoute(POST, '/api/notes/:noteId/link-map', linkMapRoute.getLinkMap);+ apiRoute(GET, '/api/date-notes/inbox/:date', dateNotesRoute.getInboxNote);apiRoute(GET, '/api/date-notes/date/:date', dateNotesRoute.getDateNote);apiRoute(GET, '/api/date-notes/month/:month', dateNotesRoute.getMonthNote);apiRoute(GET, '/api/date-notes/year/:year', dateNotesRoute.getYearNote);diff --git a/src/services/attributes.js b/src/services/attributes.jsindex 3cf9d69a4c..3623d63f73 100644--- a/src/services/attributes.js+++ b/src/services/attributes.js@@ -8,6 +8,7 @@ const ATTRIBUTE_TYPES = [ 'label', 'relation' ];const BUILTIN_ATTRIBUTES = [// label names+ { type: 'label', name: 'inbox' },{ type: 'label', name: 'disableVersioning' },{ type: 'label', name: 'calendarRoot' },{ type: 'label', name: 'archived' },diff --git a/src/services/keyboard_actions.js b/src/services/keyboard_actions.jsindex 2bac4be6f5..5358b87013 100644--- a/src/services/keyboard_actions.js+++ b/src/services/keyboard_actions.js@@ -85,9 +85,9 @@ const DEFAULT_KEYBOARD_ACTIONS = [scope: "window"},{- actionName: "createNoteIntoDayNote",+ actionName: "createNoteIntoInbox",defaultShortcuts: ["global:CommandOrControl+Alt+P"],- description: "Create and open subnote of a current day note",+ description: "Create and open in the inbox (if defined) or day note",scope: "window"},{