Merge branch 'master' into next55

This commit is contained in:
zadam 2022-08-03 22:23:58 +02:00
commit 82c596d1e3
16 changed files with 81 additions and 88 deletions

File diff suppressed because one or more lines are too long

64
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "trilium", "name": "trilium",
"version": "0.53.2", "version": "0.54.0-beta",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "trilium", "name": "trilium",
"version": "0.53.2", "version": "0.54.0-beta",
"hasInstallScript": true, "hasInstallScript": true,
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"dependencies": { "dependencies": {
@ -51,8 +51,8 @@
"open": "8.4.0", "open": "8.4.0",
"portscanner": "2.2.0", "portscanner": "2.2.0",
"rand-token": "1.0.1", "rand-token": "1.0.1",
"react": "18.2.0", "react": "17.0.2",
"react-dom": "18.2.0", "react-dom": "17.0.2",
"request": "2.88.2", "request": "2.88.2",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"safe-compare": "1.1.4", "safe-compare": "1.1.4",
@ -8421,26 +8421,28 @@
} }
}, },
"node_modules/react": { "node_modules/react": {
"version": "18.2.0", "version": "17.0.2",
"resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz",
"integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==",
"dependencies": { "dependencies": {
"loose-envify": "^1.1.0" "loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
}, },
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/react-dom": { "node_modules/react-dom": {
"version": "18.2.0", "version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz",
"integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==",
"dependencies": { "dependencies": {
"loose-envify": "^1.1.0", "loose-envify": "^1.1.0",
"scheduler": "^0.23.0" "object-assign": "^4.1.1",
"scheduler": "^0.20.2"
}, },
"peerDependencies": { "peerDependencies": {
"react": "^18.2.0" "react": "17.0.2"
} }
}, },
"node_modules/read-config-file": { "node_modules/read-config-file": {
@ -8832,11 +8834,12 @@
} }
}, },
"node_modules/scheduler": { "node_modules/scheduler": {
"version": "0.23.0", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz",
"integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==",
"dependencies": { "dependencies": {
"loose-envify": "^1.1.0" "loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
} }
}, },
"node_modules/schema-utils": { "node_modules/schema-utils": {
@ -17261,20 +17264,22 @@
} }
}, },
"react": { "react": {
"version": "18.2.0", "version": "17.0.2",
"resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz",
"integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==",
"requires": { "requires": {
"loose-envify": "^1.1.0" "loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
} }
}, },
"react-dom": { "react-dom": {
"version": "18.2.0", "version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz",
"integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==",
"requires": { "requires": {
"loose-envify": "^1.1.0", "loose-envify": "^1.1.0",
"scheduler": "^0.23.0" "object-assign": "^4.1.1",
"scheduler": "^0.20.2"
} }
}, },
"read-config-file": { "read-config-file": {
@ -17598,11 +17603,12 @@
} }
}, },
"scheduler": { "scheduler": {
"version": "0.23.0", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz",
"integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==",
"requires": { "requires": {
"loose-envify": "^1.1.0" "loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
} }
}, },
"schema-utils": { "schema-utils": {

View File

@ -2,7 +2,7 @@
"name": "trilium", "name": "trilium",
"productName": "Trilium Notes", "productName": "Trilium Notes",
"description": "Trilium Notes", "description": "Trilium Notes",
"version": "0.54.0-beta", "version": "0.54.1-beta",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"main": "electron.js", "main": "electron.js",
"bin": { "bin": {

View File

@ -131,10 +131,10 @@ function ajax(url, method, data, headers) {
headers: respHeaders headers: respHeaders
}); });
}, },
error: async (jqXhr, status, error) => { error: async (jqXhr, status) => {
await reportError(method, url, status, error); await reportError(method, url, status, jqXhr.responseText);
rej(error); rej(jqXhr.responseText);
} }
}; };

View File

@ -1,6 +1,4 @@
import FlexContainer from "./flex_container.js"; import FlexContainer from "./flex_container.js";
import utils from "../../services/utils.js";
import appContext from "../../services/app_context.js";
export default class RootContainer extends FlexContainer { export default class RootContainer extends FlexContainer {
constructor() { constructor() {
@ -9,38 +7,4 @@ export default class RootContainer extends FlexContainer {
this.id('root-widget'); this.id('root-widget');
this.css('height', '100%'); this.css('height', '100%');
} }
refresh() {
this.$widget.removeClass(); // remove all classes
const note = appContext.tabManager.getActiveContextNote();
if (note) {
this.$widget.addClass(note.getCssClass());
this.$widget.addClass(utils.getNoteTypeClass(note.type));
this.$widget.addClass(utils.getMimeTypeClass(note.mime));
this.$widget.toggleClass("protected", note.isProtected);
}
}
noteSwitchedEvent() {
this.refresh();
}
activeContextChangedEvent() {
this.refresh();
}
noteSwitchedAndActivatedEvent() {
this.refresh();
}
entitiesReloadedEvent({loadResults}) {
const note = appContext.tabManager.getActiveContextNote();
if (note && loadResults.isNoteReloaded(note.noteId)) {
this.refresh();
}
}
} }

View File

@ -37,7 +37,7 @@ const TPL = `
<div class="modal-dialog modal-xl" role="document"> <div class="modal-dialog modal-xl" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title mr-auto">Bulk assign attributes</h5> <h5 class="modal-title mr-auto">Bulk actions</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;"> <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>

View File

@ -36,7 +36,7 @@ const TPL = `
right: 10px; right: 10px;
width: 400px; width: 400px;
border-radius: 10px; border-radius: 10px;
background-color: var(--more-accented-background-color); background-color: var(--accented-background-color);
color: var(--main-text-color); color: var(--main-text-color);
padding: 20px; padding: 20px;
overflow-y: auto; overflow-y: auto;

View File

@ -156,7 +156,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
// https://github.com/zadam/trilium/issues/2522 // https://github.com/zadam/trilium/issues/2522
this.$widget.toggleClass("full-height", this.$widget.toggleClass("full-height",
!this.noteContext.hasNoteList() !this.noteContext.hasNoteList()
&& ['editable-text', 'editable-code', 'canvas', 'web-view'].includes(this.type) && ['editable-text', 'editable-code', 'canvas', 'web-view', 'note-map'].includes(this.type)
&& this.mime !== 'text/x-sqlite;schema=trilium'); && this.mime !== 'text/x-sqlite;schema=trilium');
} }

View File

@ -8,8 +8,9 @@ import linkContextMenuService from "../services/link_context_menu.js";
const TPL = `<div class="note-map-widget" style="position: relative;"> const TPL = `<div class="note-map-widget" style="position: relative;">
<style> <style>
.type-special .note-detail, .note-detail-note-map { .note-detail-note-map {
height: 100%; height: 100%;
overflow: hidden;
} }
.map-type-switcher { .map-type-switcher {
@ -51,7 +52,7 @@ export default class NoteMapWidget extends NoteContextAwareWidget {
this.$container = this.$widget.find(".note-map-container"); this.$container = this.$widget.find(".note-map-container");
this.$styleResolver = this.$widget.find('.style-resolver'); this.$styleResolver = this.$widget.find('.style-resolver');
window.addEventListener('resize', () => this.setHeight(), false); window.addEventListener('resize', () => this.setDimensions(), false);
this.$widget.find(".map-type-switcher button").on("click", async e => { this.$widget.find(".map-type-switcher button").on("click", async e => {
const type = $(e.target).closest("button").attr("data-type"); const type = $(e.target).closest("button").attr("data-type");
@ -62,7 +63,7 @@ export default class NoteMapWidget extends NoteContextAwareWidget {
super.doRender(); super.doRender();
} }
setHeight() { setDimensions() {
if (!this.graph) { // no graph has been even rendered if (!this.graph) { // no graph has been even rendered
return; return;
} }
@ -85,7 +86,7 @@ export default class NoteMapWidget extends NoteContextAwareWidget {
this.mapType = this.note.getLabelValue("mapType") === "tree" ? "tree" : "link"; this.mapType = this.note.getLabelValue("mapType") === "tree" ? "tree" : "link";
this.setHeight(); this.setDimensions();
await libraryLoader.requireLibrary(libraryLoader.FORCE_GRAPH); await libraryLoader.requireLibrary(libraryLoader.FORCE_GRAPH);

View File

@ -767,7 +767,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
await this.batchUpdate(async () => { await this.batchUpdate(async () => {
await node.load(true); await node.load(true);
if (node.data.noteId !== 'root') { // root is always expanded if (node.data.noteId !== hoistedNoteService.getHoistedNoteId()) { // hoisted note should be always expanded
await node.setExpanded(isExpanded, {noEvents: true, noAnimation: true}); await node.setExpanded(isExpanded, {noEvents: true, noAnimation: true});
} }
}); });

View File

@ -1,4 +1,6 @@
import FlexContainer from "./containers/flex_container.js"; import FlexContainer from "./containers/flex_container.js";
import utils from "../services/utils.js";
import attributeService from "../services/attributes.js";
export default class NoteWrapperWidget extends FlexContainer { export default class NoteWrapperWidget extends FlexContainer {
constructor() { constructor() {
@ -33,17 +35,33 @@ export default class NoteWrapperWidget extends FlexContainer {
} }
refresh() { refresh() {
this.$widget.removeClass();
const note = this.noteContext?.note; const note = this.noteContext?.note;
if (!note) {
return;
}
this.$widget.toggleClass("full-content-width", this.$widget.toggleClass("full-content-width",
['image', 'mermaid', 'book', 'render', 'canvas', 'web-view'].includes(note?.type) ['image', 'mermaid', 'book', 'render', 'canvas', 'web-view'].includes(note.type)
|| !!note?.hasLabel('fullContentWidth') || !!note?.hasLabel('fullContentWidth')
); );
this.$widget.addClass(note.getCssClass());
this.$widget.addClass(utils.getNoteTypeClass(note.type));
this.$widget.addClass(utils.getMimeTypeClass(note.mime));
this.$widget.toggleClass("protected", note.isProtected);
} }
async entitiesReloadedEvent({loadResults}) { async entitiesReloadedEvent({loadResults}) {
// listening on changes of note.type // listening on changes of note.type and CSS class
if (loadResults.isNoteReloaded(this.noteContext?.noteId)) {
const noteId = this.noteContext?.noteId;
if (loadResults.isNoteReloaded(noteId)
|| loadResults.getAttributes().find(attr => attr.type === 'label' && attr.name === 'cssClass' && attributeService.isAffecting(attr, this.noteContext?.note))) {
this.refresh(); this.refresh();
} }
} }

View File

@ -77,7 +77,7 @@ export default class NoteMapRibbonWidget extends NoteContextAwareWidget {
this.openState = 'full'; this.openState = 'full';
this.noteMapWidget.setHeight(); this.noteMapWidget.setDimensions();
}); });
this.$collapseButton = this.$widget.find('.collapse-button'); this.$collapseButton = this.$widget.find('.collapse-button');
@ -89,7 +89,7 @@ export default class NoteMapRibbonWidget extends NoteContextAwareWidget {
this.openState = 'small'; this.openState = 'small';
this.noteMapWidget.setHeight(); this.noteMapWidget.setDimensions();
}); });
window.addEventListener('resize', () => { window.addEventListener('resize', () => {

View File

@ -7,7 +7,6 @@ const utils = require('../../services/utils');
const log = require('../../services/log'); const log = require('../../services/log');
const TaskContext = require('../../services/task_context'); const TaskContext = require('../../services/task_context');
const fs = require('fs'); const fs = require('fs');
const noteRevisionService = require("../../services/note_revisions");
const becca = require("../../becca/becca"); const becca = require("../../becca/becca");
function getNote(req) { function getNote(req) {

View File

@ -19,6 +19,11 @@ function init(app) {
getHeader: name => respHeaders[name], getHeader: name => respHeaders[name],
setHeader: (name, value) => { setHeader: (name, value) => {
respHeaders[name] = value.toString(); respHeaders[name] = value.toString();
return res;
},
header: (name, value) => {
respHeaders[name] = value.toString();
return res;
}, },
status: statusCode => { status: statusCode => {
res.statusCode = statusCode; res.statusCode = statusCode;

View File

@ -1 +1 @@
module.exports = { buildDate:"2022-08-01T22:37:40+02:00", buildRevision: "edff1be16d50e71e3ddedb2ab725598b877c7b76" }; module.exports = { buildDate:"2022-08-02T21:56:34+02:00", buildRevision: "12af3d05f04b9406af55ac301c0069eb385957c8" };

View File

@ -36,7 +36,7 @@ function getRootCalendarNote() {
rootNote = searchService.findFirstNoteWithQuery('#workspaceCalendarRoot', new SearchContext({ignoreHoistedNote: false})); rootNote = searchService.findFirstNoteWithQuery('#workspaceCalendarRoot', new SearchContext({ignoreHoistedNote: false}));
} }
if (rootNote === null) { if (!rootNote) {
rootNote = attributeService.getNoteWithLabel(CALENDAR_ROOT_LABEL); rootNote = attributeService.getNoteWithLabel(CALENDAR_ROOT_LABEL);
} }