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
Merge branch 'master' into next55
zadamc16f7a5e02b6
diff --cc package.jsonindex 1bf872d5cf,4b7c96c4d5..ca6b6145c9--- a/package.json+++ b/package.json@@@ -34,21 -36,21 +36,22 @@@"chokidar": "3.5.3","cls-hooked": "4.2.2","commonmark": "0.30.0",+ "compression": "1.7.4","cookie-parser": "1.4.6","csurf": "1.11.0",- "dayjs": "1.11.4",+ "dayjs": "1.11.5","dayjs-plugin-utc": "^0.1.2",+ "debounce": "^1.2.1","ejs": "3.1.8","electron-debug": "3.2.0",- "electron-dl": "3.3.1",+ "electron-dl": "3.4.0","electron-window-state": "5.0.3",- "express": "4.18.1",+ "express": "4.18.2","express-partial-content": "1.0.2",- "express-rate-limit": "6.5.1",+ "express-rate-limit": "6.6.0","express-session": "1.17.3","fs-extra": "10.1.0",- "helmet": "5.1.1",+ "helmet": "6.0.0","html": "1.0.0","html2plaintext": "2.1.4","http-proxy-agent": "5.0.0",diff --cc src/public/app/layouts/desktop_layout.jsindex 1f16b97c98,c39e02b9a4..81c88a1d47--- a/src/public/app/layouts/desktop_layout.js+++ b/src/public/app/layouts/desktop_layout.js@@@ -73,8 -78,9 +73,11 @@@ import OptionsDialog from "../widgets/dimport FloatingButtons from "../widgets/floating_buttons/floating_buttons.js";import RelationMapButtons from "../widgets/floating_buttons/relation_map_buttons.js";import MermaidExportButton from "../widgets/floating_buttons/mermaid_export_button.js";+import ShortcutContainer from "../widgets/containers/shortcut_container.js";+import NoteRevisionsButton from "../widgets/buttons/note_revisions_button.js";+ import EditableCodeButtonsWidget from "../widgets/type_widgets/editable_code_buttons.js";+ import ApiLogWidget from "../widgets/api_log.js";+ import HideFloatingButtonsButton from "../widgets/floating_buttons/hide_floating_buttons_button.js";export default class DesktopLayout {constructor(customWidgets) {@@@ -114,59 -146,66 +117,62 @@@.collapsible().id('center-pane').child(new SplitNoteContainer(() =>- new NoteWrapperWidget()- .child(new FlexContainer('row').class('title-row')- .css("height", "50px")- .css('align-items', "center")- .cssBlock('.title-row > * { margin: 5px; }')- .child(new NoteIconWidget())- .child(new NoteTitleWidget())- .child(new SpacerWidget(0, 1))- .child(new ClosePaneButton())- .child(new CreatePaneButton())- )- .child(- new RibbonContainer()- .ribbon(new SearchDefinitionWidget())- .ribbon(new EditedNotesWidget())- .ribbon(new BookPropertiesWidget())- .ribbon(new NotePropertiesWidget())- .ribbon(new FilePropertiesWidget())- .ribbon(new ImagePropertiesWidget())- .ribbon(new PromotedAttributesWidget())- .ribbon(new BasicPropertiesWidget())- .ribbon(new OwnedAttributeListWidget())- .ribbon(new InheritedAttributesWidget())- .ribbon(new NotePathsWidget())- .ribbon(new NoteMapRibbonWidget())- .ribbon(new SimilarNotesWidget())- .ribbon(new NoteInfoWidget())- .button(new EditButton())- .button(new ButtonWidget()- .icon('bx-history')- .title("Note Revisions")- .command("showNoteRevisions")- .titlePlacement("bottom"))- .button(new NoteActionsWidget())- )- .child(new SharedInfoWidget())- .child(new NoteUpdateStatusWidget())- .child(new FloatingButtons()- .child(new RelationMapButtons())- .child(new MermaidExportButton())- .child(new BacklinksWidget())- .child(new HideFloatingButtonsButton())- )- .child(new MermaidWidget())- .child(- new ScrollingContainer()- .filling()- .child(new SqlTableSchemasWidget())- .child(new NoteDetailWidget())- .child(new NoteListWidget())- .child(new SearchResultWidget())- .child(new SqlResultWidget())- )- .child(new EditableCodeButtonsWidget())- .child(new ApiLogWidget())- .child(new FindWidget())- .child(- ...this.customWidgets.get('node-detail-pane'), // typo, let's keep it for a while as BC- ...this.customWidgets.get('note-detail-pane')- )+ new NoteWrapperWidget()+ .child(new FlexContainer('row').class('title-row')+ .css("height", "50px")+ .css('align-items', "center")+ .cssBlock('.title-row > * { margin: 5px; }')+ .child(new NoteIconWidget())+ .child(new NoteTitleWidget())+ .child(new SpacerWidget(0, 1))+ .child(new ClosePaneButton())+ .child(new CreatePaneButton())+ )+ .child(+ new RibbonContainer()+ .ribbon(new SearchDefinitionWidget())+ .ribbon(new EditedNotesWidget())+ .ribbon(new BookPropertiesWidget())+ .ribbon(new NotePropertiesWidget())+ .ribbon(new FilePropertiesWidget())+ .ribbon(new ImagePropertiesWidget())+ .ribbon(new PromotedAttributesWidget())+ .ribbon(new BasicPropertiesWidget())+ .ribbon(new OwnedAttributeListWidget())+ .ribbon(new InheritedAttributesWidget())+ .ribbon(new NotePathsWidget())+ .ribbon(new NoteMapRibbonWidget())+ .ribbon(new SimilarNotesWidget())+ .ribbon(new NoteInfoWidget())+ .button(new EditButton())+ .button(new NoteRevisionsButton())+ .button(new NoteActionsWidget())+ )+ .child(new SharedInfoWidget())+ .child(new NoteUpdateStatusWidget())+ .child(new FloatingButtons()+ .child(new RelationMapButtons())+ .child(new MermaidExportButton())+ .child(new BacklinksWidget())++ .child(new HideFloatingButtonsButton())+ )+ .child(new MermaidWidget())+ .child(+ new ScrollingContainer()+ .filling()+ .child(new SqlTableSchemasWidget())+ .child(new NoteDetailWidget())+ .child(new NoteListWidget())+ .child(new SearchResultWidget())+ .child(new SqlResultWidget())+ )++ .child(new EditableCodeButtonsWidget())++ .child(new ApiLogWidget())+ .child(new FindWidget())+ .child(+ ...this.customWidgets.get('node-detail-pane'), // typo, let's keep it for a while as BC+ ...this.customWidgets.get('note-detail-pane')+ ))).child(...this.customWidgets.get('center-pane'))diff --cc src/public/app/services/branches.jsindex eefa5e28e9,c516155245..0b885bb02b--- a/src/public/app/services/branches.js+++ b/src/public/app/services/branches.js@@@ -124,13 -124,10 +124,13 @@@ async function moveNodeUpInHierarchy(noreturn;}- const resp = await server.put('branches/' + node.data.branchId + '/move-after/' + node.getParent().data.branchId);+ const targetBranchId = node.getParent().data.branchId;+ const branchIdToMove = node.data.branchId;++ const resp = await server.put(`branches/${branchIdToMove}/move-after/${targetBranchId}`);if (!resp.success) {- alert(resp.message);+ toastService.showError(resp.message);return;}diff --cc src/public/app/widgets/containers/container.jsindex a298ab95e1,15ee0e9280..ba47a8db0c--- a/src/public/app/widgets/containers/container.js+++ b/src/public/app/widgets/containers/container.js@@@ -1,39 -1,9 +1,12 @@@import BasicWidget from "../basic_widget.js";export default class Container extends BasicWidget {- constructor() {- super();-- this.children = [];-- this.positionCounter = 10;- }-- child(...components) {- if (!components) {- return this;- }-- super.child(...components);-- for (const component of components) {- if (!component.position) {- component.position = this.positionCounter;- this.positionCounter += 10;- }- }-- this.children.sort((a, b) => a.position - b.position < 0 ? -1 : 1);-- return this;- }-doRender() {this.$widget = $(`<div>`);+ this.renderChildren();+ }+ renderChildren() {for (const widget of this.children) {this.$widget.append(widget.render());}diff --cc src/routes/routes.jsindex 71bea43bba,928204ba6f..e66c41bc7c--- a/src/routes/routes.js+++ b/src/routes/routes.js@@@ -293,12 -318,11 +318,12 @@@ function register(app)apiRoute(POST, '/api/special-notes/save-sql-console', specialNotesRoute.saveSqlConsole);apiRoute(POST, '/api/special-notes/search-note', specialNotesRoute.createSearchNote);apiRoute(POST, '/api/special-notes/save-search-note', specialNotesRoute.saveSearchNote);+ apiRoute(POST, '/api/special-notes/shortcuts/:parentNoteId/:type', specialNotesRoute.createShortcut);- // :filename is not used by trilium, but instead used for "save as" to assign a human readable filename+ // :filename is not used by trilium, but instead used for "save as" to assign a human-readable filenameroute(GET, '/api/images/:noteId/:filename', [auth.checkApiAuthOrElectron], imageRoute.returnImage);- route(POST, '/api/images', [auth.checkApiAuthOrElectron, uploadMiddleware, csrfMiddleware], imageRoute.uploadImage, apiResultHandler);- route(PUT, '/api/images/:noteId', [auth.checkApiAuthOrElectron, uploadMiddleware, csrfMiddleware], imageRoute.updateImage, apiResultHandler);+ route(POST, '/api/images', [auth.checkApiAuthOrElectron, uploadMiddlewareWithErrorHandling, csrfMiddleware], imageRoute.uploadImage, apiResultHandler);+ route(PUT, '/api/images/:noteId', [auth.checkApiAuthOrElectron, uploadMiddlewareWithErrorHandling, csrfMiddleware], imageRoute.updateImage, apiResultHandler);apiRoute(GET, '/api/recent-changes/:ancestorNoteId', recentChangesApiRoute.getRecentChanges);