mirror of
https://github.com/zadam/trilium.git
synced 2025-06-04 17:08:41 +02:00
bug fixes
This commit is contained in:
parent
5cfd1c030d
commit
2b8c6e3dd0
44
package-lock.json
generated
44
package-lock.json
generated
@ -1334,11 +1334,11 @@
|
||||
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.21.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
||||
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
||||
"version": "0.21.3",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.3.tgz",
|
||||
"integrity": "sha512-JtoZ3Ndke/+Iwt5n+BgSli/3idTvpt5OjKyoCmz4LX5+lPiY5l7C1colYezhlxThjNa/NhngCUWZSZFypIFuaA==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.10.0"
|
||||
"follow-redirects": "^1.14.0"
|
||||
}
|
||||
},
|
||||
"bagpipe": {
|
||||
@ -1365,9 +1365,9 @@
|
||||
}
|
||||
},
|
||||
"better-sqlite3": {
|
||||
"version": "7.4.3",
|
||||
"resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-7.4.3.tgz",
|
||||
"integrity": "sha512-07bKjClZg/f4KMVRkzWtoIvazVPcF1gsvVKVIXlxwleC2DxuIhnra3KCMlUT1rFeRYXXckot2a46UciF2d9KLw==",
|
||||
"version": "7.1.4",
|
||||
"resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-7.1.4.tgz",
|
||||
"integrity": "sha512-9BvUSm8/xSyxZbnWpcRAwEZsfTK0196qi4592N5WoVMM3dAH9g0E3/colX0dxhGVSLcVfkiBUoCEBkFz8uvySw==",
|
||||
"requires": {
|
||||
"bindings": "^1.5.0",
|
||||
"prebuild-install": "^6.0.1",
|
||||
@ -1899,9 +1899,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30001252",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001252.tgz",
|
||||
"integrity": "sha512-I56jhWDGMtdILQORdusxBOH+Nl/KgQSdDmpJezYddnAkVOmnoU8zwjTV9xAjMIYxr0iPreEAVylCGcmHCjfaOw==",
|
||||
"version": "1.0.30001254",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001254.tgz",
|
||||
"integrity": "sha512-GxeHOvR0LFMYPmFGA+NiTOt9uwYDxB3h154tW2yBYwfz2EMX3i1IBgr6gmJGfU0K8KQsqPa5XqLD8zVdP5lUzA==",
|
||||
"dev": true
|
||||
},
|
||||
"caseless": {
|
||||
@ -3573,9 +3573,9 @@
|
||||
}
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.827",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.827.tgz",
|
||||
"integrity": "sha512-ye+4uQOY/jbjRutMcE/EmOcNwUeo1qo9aKL2tPyb09cU3lmxNeyDF4RWiemmkknW+p29h7dyDqy02higTxc9/A==",
|
||||
"version": "1.3.830",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.830.tgz",
|
||||
"integrity": "sha512-gBN7wNAxV5vl1430dG+XRcQhD4pIeYeak6p6rjdCtlz5wWNwDad8jwvphe5oi1chL5MV6RNRikfffBBiFuj+rQ==",
|
||||
"dev": true
|
||||
},
|
||||
"electron-window-state": {
|
||||
@ -4136,9 +4136,9 @@
|
||||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.13.1",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz",
|
||||
"integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg=="
|
||||
"version": "1.14.3",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.3.tgz",
|
||||
"integrity": "sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw=="
|
||||
},
|
||||
"forever-agent": {
|
||||
"version": "0.6.1",
|
||||
@ -7573,9 +7573,9 @@
|
||||
}
|
||||
},
|
||||
"terser-webpack-plugin": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.1.tgz",
|
||||
"integrity": "sha512-mUAWsS2RDNL3rEr0ZTr7hm/R1DDxNwrED7Kf59F2rgFTfy+LrnciwA51MNWhGGQcqHnqvbPHgkW9LYr5HGBhfw==",
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.3.tgz",
|
||||
"integrity": "sha512-eDbuaDlXhVaaoKuLD3DTNTozKqln6xOG6Us0SzlKG5tNlazG+/cdl8pm9qiF1Di89iWScTI0HcO+CDcf2dkXiw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jest-worker": "^27.0.6",
|
||||
@ -8028,9 +8028,9 @@
|
||||
"integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w=="
|
||||
},
|
||||
"webpack": {
|
||||
"version": "5.51.2",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.51.2.tgz",
|
||||
"integrity": "sha512-odydxP4WA3XYYzwSQUivPxywdzMlY42bbfxMwCaEtHb+i/N9uzKSHcLgWkXo/Gsa+4Zlzf3Jg0hEHn1FnZpk2Q==",
|
||||
"version": "5.52.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.52.0.tgz",
|
||||
"integrity": "sha512-yRZOat8jWGwBwHpco3uKQhVU7HYaNunZiJ4AkAVQkPCUGoZk/tiIXiwG+8HIy/F+qsiZvSOa+GLQOj3q5RKRYg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/eslint-scope": "^3.7.0",
|
||||
|
@ -26,8 +26,8 @@
|
||||
"dependencies": {
|
||||
"archiver": "5.3.0",
|
||||
"async-mutex": "0.3.2",
|
||||
"axios": "0.21.1",
|
||||
"better-sqlite3": "7.4.3",
|
||||
"axios": "0.21.4",
|
||||
"better-sqlite3": "7.1.4",
|
||||
"body-parser": "1.19.0",
|
||||
"chokidar": "3.5.2",
|
||||
"cls-hooked": "4.2.2",
|
||||
@ -90,7 +90,7 @@
|
||||
"jsdoc": "3.6.7",
|
||||
"lorem-ipsum": "2.0.3",
|
||||
"rcedit": "3.0.1",
|
||||
"webpack": "5.51.2",
|
||||
"webpack": "5.52.0",
|
||||
"webpack-cli": "4.8.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
@ -86,6 +86,10 @@ function getNoteTitle(childNoteId, parentNoteId) {
|
||||
}
|
||||
|
||||
function getNoteTitleArrayForPath(notePathArray) {
|
||||
if (!notePathArray || !Array.isArray(notePathArray)) {
|
||||
throw new Error(`${notePathArray} is not an array.`);
|
||||
}
|
||||
|
||||
if (notePathArray.length === 1 && notePathArray[0] === cls.getHoistedNoteId()) {
|
||||
return [getNoteTitle(cls.getHoistedNoteId())];
|
||||
}
|
||||
@ -131,12 +135,12 @@ function getSomePath(note, path = []) {
|
||||
|| getSomePathInner(note, path, false);
|
||||
}
|
||||
|
||||
function getSomePathInner(note, path, respectHoistng) {
|
||||
function getSomePathInner(note, path, respectHoisting) {
|
||||
if (note.isRoot()) {
|
||||
path.push(note.noteId);
|
||||
path.reverse();
|
||||
|
||||
if (respectHoistng && !path.includes(cls.getHoistedNoteId())) {
|
||||
if (respectHoisting && !path.includes(cls.getHoistedNoteId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -145,11 +149,13 @@ function getSomePathInner(note, path, respectHoistng) {
|
||||
|
||||
const parents = note.parents;
|
||||
if (parents.length === 0) {
|
||||
console.log(`Note ${note.noteId} - "${note.title}" has no parents.`);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const parentNote of parents) {
|
||||
const retPath = getSomePathInner(parentNote, path.concat([note.noteId]), respectHoistng);
|
||||
const retPath = getSomePathInner(parentNote, path.concat([note.noteId]), respectHoisting);
|
||||
|
||||
if (retPath) {
|
||||
return retPath;
|
||||
|
@ -7,15 +7,18 @@ const becca = require("../becca/becca");
|
||||
|
||||
let maxEntityChangeId = 0;
|
||||
|
||||
function addEntityChange(entityChange) {
|
||||
entityChange.sourceId = entityChange.sourceId || cls.getSourceId() || sourceIdService.getCurrentSourceId();
|
||||
entityChange.isSynced = entityChange.isSynced ? 1 : 0;
|
||||
entityChange.isErased = entityChange.isErased ? 1 : 0;
|
||||
entityChange.id = sql.replace("entity_changes", entityChange);
|
||||
function addEntityChange(origEntityChange) {
|
||||
const ec = {...origEntityChange};
|
||||
|
||||
maxEntityChangeId = Math.max(maxEntityChangeId, entityChange.id);
|
||||
delete ec.id;
|
||||
ec.sourceId = ec.sourceId || cls.getSourceId() || sourceIdService.getCurrentSourceId();
|
||||
ec.isSynced = ec.isSynced ? 1 : 0;
|
||||
ec.isErased = ec.isErased ? 1 : 0;
|
||||
ec.id = sql.replace("entity_changes", ec);
|
||||
|
||||
cls.addEntityChange(entityChange);
|
||||
maxEntityChangeId = Math.max(maxEntityChangeId, ec.id);
|
||||
|
||||
cls.addEntityChange(ec);
|
||||
}
|
||||
|
||||
function addNoteReorderingEntityChange(parentNoteId, sourceId) {
|
||||
|
@ -83,9 +83,15 @@ function findResultsWithExpression(expression, searchContext) {
|
||||
const noteSet = expression.execute(allNoteSet, executionContext);
|
||||
|
||||
const searchResults = noteSet.notes
|
||||
.map(note => new SearchResult(
|
||||
executionContext.noteIdToNotePath[note.noteId] || beccaService.getSomePath(note)
|
||||
));
|
||||
.map(note => {
|
||||
const notePathArray = executionContext.noteIdToNotePath[note.noteId] || beccaService.getSomePath(note);
|
||||
|
||||
if (!notePathArray) {
|
||||
throw new Error(`Can't find note path for note ${JSON.stringify(note.getPojo())}`);
|
||||
}
|
||||
|
||||
return new SearchResult(notePathArray);
|
||||
});
|
||||
|
||||
for (const res of searchResults) {
|
||||
res.computeScore(searchContext.highlightedTokens);
|
||||
|
Loading…
x
Reference in New Issue
Block a user