mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge branch 'stable'
This commit is contained in:
commit
f9645e8971
@ -2,12 +2,18 @@ module.exports = () => {
|
|||||||
const cls = require("../../src/services/cls");
|
const cls = require("../../src/services/cls");
|
||||||
const beccaLoader = require("../../src/becca/becca_loader");
|
const beccaLoader = require("../../src/becca/becca_loader");
|
||||||
const becca = require("../../src/becca/becca");
|
const becca = require("../../src/becca/becca");
|
||||||
|
const log = require("../../src/services/log");
|
||||||
|
|
||||||
cls.init(() => {
|
cls.init(() => {
|
||||||
beccaLoader.load();
|
beccaLoader.load();
|
||||||
|
|
||||||
const hidden = becca.getNote("_hidden");
|
const hidden = becca.getNote("_hidden");
|
||||||
|
|
||||||
|
if (!hidden) {
|
||||||
|
log.info("MIGRATION 212: no _hidden note, skipping.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (const noteId of hidden.getSubtreeNoteIds({includeHidden: true})) {
|
for (const noteId of hidden.getSubtreeNoteIds({includeHidden: true})) {
|
||||||
if (noteId.startsWith("_")) { // is "named" note
|
if (noteId.startsWith("_")) { // is "named" note
|
||||||
const note = becca.getNote(noteId);
|
const note = becca.getNote(noteId);
|
||||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -1,12 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.59.1",
|
"version": "0.59.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "trilium",
|
"version": "0.59.2",
|
||||||
"version": "0.59.1",
|
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"productName": "Trilium Notes",
|
"productName": "Trilium Notes",
|
||||||
"description": "Trilium Notes",
|
"description": "Trilium Notes",
|
||||||
"version": "0.59.1",
|
"version": "0.59.2",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"main": "electron.js",
|
"main": "electron.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
@ -70,7 +70,9 @@ function reload() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function postProcessEntityUpdate(entityName, entity) {
|
function postProcessEntityUpdate(entityName, entity) {
|
||||||
if (entityName === 'branches') {
|
if (entityName === 'notes') {
|
||||||
|
noteUpdated(entity);
|
||||||
|
} else if (entityName === 'branches') {
|
||||||
branchUpdated(entity);
|
branchUpdated(entity);
|
||||||
} else if (entityName === 'attributes') {
|
} else if (entityName === 'attributes') {
|
||||||
attributeUpdated(entity);
|
attributeUpdated(entity);
|
||||||
@ -161,6 +163,15 @@ function branchDeleted(branchId) {
|
|||||||
delete becca.branches[branch.branchId];
|
delete becca.branches[branch.branchId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function noteUpdated(entity) {
|
||||||
|
const note = becca.notes[entity.noteId];
|
||||||
|
|
||||||
|
if (note) {
|
||||||
|
// type / mime could have been changed, and they are present in flatTextCache
|
||||||
|
note.flatTextCache = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function branchUpdated(branch) {
|
function branchUpdated(branch) {
|
||||||
const childNote = becca.notes[branch.noteId];
|
const childNote = becca.notes[branch.noteId];
|
||||||
|
|
||||||
|
@ -706,7 +706,14 @@ class FNote {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// attrs are not resorted if position changes after initial load
|
// attrs are not resorted if position changes after initial load
|
||||||
promotedAttrs.sort((a, b) => a.position < b.position ? -1 : 1);
|
promotedAttrs.sort((a, b) => {
|
||||||
|
if (a.noteId === b.noteId) {
|
||||||
|
return a.position < b.position ? -1 : 1;
|
||||||
|
} else {
|
||||||
|
// inherited promoted attributes should stay grouped: https://github.com/zadam/trilium/issues/3761
|
||||||
|
return a.noteId < b.noteId ? -1 : 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return promotedAttrs;
|
return promotedAttrs;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,18 @@ export default class InheritedAttributesWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getInheritedAttributes(note) {
|
getInheritedAttributes(note) {
|
||||||
return note.getAttributes().filter(attr => attr.noteId !== this.noteId);
|
const attrs = note.getAttributes().filter(attr => attr.noteId !== this.noteId);
|
||||||
|
|
||||||
|
attrs.sort((a, b) => {
|
||||||
|
if (a.noteId === b.noteId) {
|
||||||
|
return a.position < b.position ? -1 : 1;
|
||||||
|
} else {
|
||||||
|
// inherited attributes should stay grouped: https://github.com/zadam/trilium/issues/3761
|
||||||
|
return a.noteId < b.noteId ? -1 : 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return attrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
|
@ -60,7 +60,7 @@ export default class SqlResultWidget extends NoteContextAwareWidget {
|
|||||||
const $row = $("<tr>");
|
const $row = $("<tr>");
|
||||||
|
|
||||||
for (const key in result) {
|
for (const key in result) {
|
||||||
$row.append($("<th>").html(key));
|
$row.append($("<th>").text(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
$table.append($row);
|
$table.append($row);
|
||||||
@ -69,7 +69,7 @@ export default class SqlResultWidget extends NoteContextAwareWidget {
|
|||||||
const $row = $("<tr>");
|
const $row = $("<tr>");
|
||||||
|
|
||||||
for (const key in result) {
|
for (const key in result) {
|
||||||
$row.append($("<td>").html(result[key]));
|
$row.append($("<td>").text(result[key]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$table.append($row);
|
$table.append($row);
|
||||||
|
@ -1 +1 @@
|
|||||||
module.exports = { buildDate:"2023-02-28T23:39:34+01:00", buildRevision: "9eb3075f65af98bd8c4a8ca8cc241ae2ae05bfa9" };
|
module.exports = { buildDate:"2023-03-14T21:15:08+01:00", buildRevision: "d8e9086bdeb721db795783b5d92395a9bd6882c9" };
|
||||||
|
@ -156,7 +156,7 @@ class ConsistencyChecks {
|
|||||||
let message = `Branch '${branchId}' was was missing parent note '${parentNoteId}', so it was deleted. `;
|
let message = `Branch '${branchId}' was was missing parent note '${parentNoteId}', so it was deleted. `;
|
||||||
|
|
||||||
if (becca.getNote(noteId).getParentBranches().length === 0) {
|
if (becca.getNote(noteId).getParentBranches().length === 0) {
|
||||||
const newBranch = new Branch({
|
const newBranch = new BBranch({
|
||||||
parentNoteId: 'root',
|
parentNoteId: 'root',
|
||||||
noteId: noteId,
|
noteId: noteId,
|
||||||
prefix: 'recovered'
|
prefix: 'recovered'
|
||||||
@ -447,7 +447,7 @@ class ConsistencyChecks {
|
|||||||
branch.markAsDeleted("parent-is-search");
|
branch.markAsDeleted("parent-is-search");
|
||||||
|
|
||||||
// create a replacement branch in root parent
|
// create a replacement branch in root parent
|
||||||
new Branch({
|
new BBranch({
|
||||||
parentNoteId: 'root',
|
parentNoteId: 'root',
|
||||||
noteId: branch.noteId,
|
noteId: branch.noteId,
|
||||||
prefix: 'recovered'
|
prefix: 'recovered'
|
||||||
|
@ -299,7 +299,9 @@ function highlightSearchResults(searchResults, highlightedTokens) {
|
|||||||
// which would make the resulting HTML string invalid.
|
// which would make the resulting HTML string invalid.
|
||||||
// { and } are used for marking <b> and </b> tag (to avoid matches on single 'b' character)
|
// { and } are used for marking <b> and </b> tag (to avoid matches on single 'b' character)
|
||||||
// < and > are used for marking <small> and </small>
|
// < and > are used for marking <small> and </small>
|
||||||
highlightedTokens = highlightedTokens.map(token => token.replace('/[<\{\}]/g', ''));
|
highlightedTokens = highlightedTokens
|
||||||
|
.map(token => token.replace('/[<\{\}]/g', ''))
|
||||||
|
.filter(token => !!token?.trim());
|
||||||
|
|
||||||
// sort by the longest, so we first highlight the longest matches
|
// sort by the longest, so we first highlight the longest matches
|
||||||
highlightedTokens.sort((a, b) => a.length > b.length ? -1 : 1);
|
highlightedTokens.sort((a, b) => a.length > b.length ? -1 : 1);
|
||||||
@ -307,7 +309,7 @@ function highlightSearchResults(searchResults, highlightedTokens) {
|
|||||||
for (const result of searchResults) {
|
for (const result of searchResults) {
|
||||||
const note = becca.notes[result.noteId];
|
const note = becca.notes[result.noteId];
|
||||||
|
|
||||||
result.highlightedNotePathTitle = result.notePathTitle.replace('/[<\{\}]/g', '');
|
result.highlightedNotePathTitle = result.notePathTitle.replace(/[<{}]/g, '');
|
||||||
|
|
||||||
if (highlightedTokens.find(token => note.type.includes(token))) {
|
if (highlightedTokens.find(token => note.type.includes(token))) {
|
||||||
result.highlightedNotePathTitle += ` "type: ${note.type}'`;
|
result.highlightedNotePathTitle += ` "type: ${note.type}'`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user