Compare commits

...

9 Commits

Author SHA1 Message Date
zadam
23e9bcfdc5 release 0.52.2 2022-06-09 23:39:48 +02:00
zadam
96c4934c00 new default keyboard shortcuts alt+up/down/left/right for moving notes on Mac 2022-06-09 23:38:07 +02:00
zadam
31fb02f810 titleTemplate should be sanitized on import 2022-06-09 21:01:02 +02:00
zadam
e206d9cc68 fix selected note text color 2022-06-08 22:27:36 +02:00
zadam
2d33f570f4 fix bulk/search action delete 2022-06-08 22:25:00 +02:00
zadam
15f8173add fix ugly hover close button 2022-06-07 20:11:43 +02:00
zadam
7609bc78ec allow ignoring DB version for skipping uncritical migrations in case of a downgrade 2022-06-06 22:27:06 +02:00
zadam
b4ac41eff8 fix handlers import, closes #2900 2022-06-06 21:59:44 +02:00
zadam
de1c76ee3c typo 2022-06-05 21:24:52 +02:00
13 changed files with 62 additions and 46 deletions

46
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "trilium",
"version": "0.51.2",
"version": "0.52.1-beta",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "trilium",
"version": "0.51.2",
"version": "0.52.1-beta",
"hasInstallScript": true,
"license": "AGPL-3.0-only",
"dependencies": {
@@ -21,7 +21,7 @@
"commonmark": "0.30.0",
"cookie-parser": "1.4.6",
"csurf": "1.11.0",
"dayjs": "1.11.2",
"dayjs": "1.11.3",
"ejs": "3.1.8",
"electron-debug": "3.2.0",
"electron-dl": "3.3.1",
@@ -65,7 +65,7 @@
"tmp": "0.2.1",
"turndown": "7.1.1",
"unescape": "1.0.1",
"ws": "8.6.0",
"ws": "8.7.0",
"yauzl": "2.10.0"
},
"bin": {
@@ -82,7 +82,7 @@
"jsdoc": "3.6.10",
"lorem-ipsum": "2.0.4",
"rcedit": "3.0.1",
"webpack": "5.72.1",
"webpack": "5.73.0",
"webpack-cli": "4.9.2"
},
"optionalDependencies": {
@@ -3115,9 +3115,9 @@
}
},
"node_modules/dayjs": {
"version": "1.11.2",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz",
"integrity": "sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw=="
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.3.tgz",
"integrity": "sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A=="
},
"node_modules/debug": {
"version": "4.3.4",
@@ -10252,9 +10252,9 @@
}
},
"node_modules/webpack": {
"version": "5.72.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.72.1.tgz",
"integrity": "sha512-dXG5zXCLspQR4krZVR6QgajnZOjW2K/djHvdcRaDQvsjV9z9vaW6+ja5dZOYbqBBjF6kGXka/2ZyxNdc+8Jung==",
"version": "5.73.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.73.0.tgz",
"integrity": "sha512-svjudQRPPa0YiOYa2lM/Gacw0r6PvxptHj4FuEKQ2kX05ZLkjbVc5MnPs6its5j7IZljnIqSVo/OsY2X0IpHGA==",
"dev": true,
"dependencies": {
"@types/eslint-scope": "^3.7.3",
@@ -10594,9 +10594,9 @@
}
},
"node_modules/ws": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.6.0.tgz",
"integrity": "sha512-AzmM3aH3gk0aX7/rZLYvjdvZooofDu3fFOzGqcSnQ1tOcTWwhM/o+q++E8mAyVVIyUdajrkzWUGftaVSDLn1bw==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.7.0.tgz",
"integrity": "sha512-c2gsP0PRwcLFzUiA8Mkr37/MI7ilIlHQxaEAtd0uNMbVMoy8puJyafRlm0bV9MbGSabUPeLrRRaqIBcFcA2Pqg==",
"engines": {
"node": ">=10.0.0"
},
@@ -13271,9 +13271,9 @@
}
},
"dayjs": {
"version": "1.11.2",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz",
"integrity": "sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw=="
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.3.tgz",
"integrity": "sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A=="
},
"debug": {
"version": "4.3.4",
@@ -18776,9 +18776,9 @@
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="
},
"webpack": {
"version": "5.72.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.72.1.tgz",
"integrity": "sha512-dXG5zXCLspQR4krZVR6QgajnZOjW2K/djHvdcRaDQvsjV9z9vaW6+ja5dZOYbqBBjF6kGXka/2ZyxNdc+8Jung==",
"version": "5.73.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.73.0.tgz",
"integrity": "sha512-svjudQRPPa0YiOYa2lM/Gacw0r6PvxptHj4FuEKQ2kX05ZLkjbVc5MnPs6its5j7IZljnIqSVo/OsY2X0IpHGA==",
"dev": true,
"requires": {
"@types/eslint-scope": "^3.7.3",
@@ -19028,9 +19028,9 @@
}
},
"ws": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.6.0.tgz",
"integrity": "sha512-AzmM3aH3gk0aX7/rZLYvjdvZooofDu3fFOzGqcSnQ1tOcTWwhM/o+q++E8mAyVVIyUdajrkzWUGftaVSDLn1bw==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.7.0.tgz",
"integrity": "sha512-c2gsP0PRwcLFzUiA8Mkr37/MI7ilIlHQxaEAtd0uNMbVMoy8puJyafRlm0bV9MbGSabUPeLrRRaqIBcFcA2Pqg==",
"requires": {}
},
"xdg-basedir": {

View File

@@ -2,7 +2,7 @@
"name": "trilium",
"productName": "Trilium Notes",
"description": "Trilium Notes",
"version": "0.52.1-beta",
"version": "0.52.2",
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {
@@ -36,7 +36,7 @@
"commonmark": "0.30.0",
"cookie-parser": "1.4.6",
"csurf": "1.11.0",
"dayjs": "1.11.2",
"dayjs": "1.11.3",
"ejs": "3.1.8",
"electron-debug": "3.2.0",
"electron-dl": "3.3.1",
@@ -80,7 +80,7 @@
"tmp": "0.2.1",
"turndown": "7.1.1",
"unescape": "1.0.1",
"ws": "8.6.0",
"ws": "8.7.0",
"yauzl": "2.10.0"
},
"devDependencies": {
@@ -94,7 +94,7 @@
"jsdoc": "3.6.10",
"lorem-ipsum": "2.0.4",
"rcedit": "3.0.1",
"webpack": "5.72.1",
"webpack": "5.73.0",
"webpack-cli": "4.9.2"
},
"optionalDependencies": {

View File

@@ -9,7 +9,6 @@ const entityChangesService = require('../../services/entity_changes');
const AbstractEntity = require("./abstract_entity");
const NoteRevision = require("./note_revision");
const TaskContext = require("../../services/task_context");
const handlers = require("../../services/handlers");
const LABEL = 'label';
const RELATION = 'relation';
@@ -1134,6 +1133,10 @@ class Note extends AbstractEntity {
* @param {TaskContext} [taskContext]
*/
deleteNote(deleteId, taskContext) {
if (this.isDeleted) {
return;
}
if (!deleteId) {
deleteId = utils.randomString(10);
}
@@ -1143,6 +1146,7 @@ class Note extends AbstractEntity {
}
// needs to be run before branches and attributes are deleted and thus attached relations disappear
const handlers = require("../../services/handlers");
handlers.runAttachedRelations(this, 'runOnNoteDeletion', this);
taskContext.noteDeletionHandlerTriggered = true;

View File

@@ -235,7 +235,7 @@ const ATTR_HELP = {
"runOnNoteChange": "executes when note is changed (includes note creation as well)",
"runOnNoteDeletion": "executes when note is being deleted",
"runOnBranchCreation": "executes when a branch is created. Branch is a link between parent note and child note and is created e.g. when cloning or moving note.",
"runOnBranchDeletion": "executes when a branch is delete. Branch is a link between parent note and child note and is deleted e.g. when moving note (old branch/link is deleted).",
"runOnBranchDeletion": "executes when a branch is deleted. Branch is a link between parent note and child note and is deleted e.g. when moving note (old branch/link is deleted).",
"runOnChildNoteCreation": "executes when new note is created under this note",
"runOnAttributeCreation": "executes when new attribute is created under this note",
"runOnAttributeChange": "executes when attribute is changed under this note",

View File

@@ -968,3 +968,8 @@ input {
.note-split.full-content-width {
max-width: 999999px;
}
button.close:hover {
text-shadow: none;
color: currentColor;
}

View File

@@ -170,7 +170,6 @@ span.fancytree-active .fancytree-title {
}
span.fancytree-selected {
color: var(--hover-item-text-color) !important;
border-color: var(--main-border-color) !important;
border-radius: 5px;
}

View File

@@ -9,15 +9,16 @@ const noteRevisionService = require("../../services/note_revisions");
const branchService = require("../../services/branches");
const cloningService = require("../../services/cloning");
const {formatAttrForSearch} = require("../../services/attribute_formatter");
const utils = require("../../services/utils.js");
async function searchFromNoteInt(note) {
function searchFromNoteInt(note) {
let searchResultNoteIds;
const searchScript = note.getRelationValue('searchScript');
const searchString = note.getLabelValue('searchString');
if (searchScript) {
searchResultNoteIds = await searchFromRelation(note, 'searchScript');
searchResultNoteIds = searchFromRelation(note, 'searchScript');
} else {
const searchContext = new SearchContext({
fastSearch: note.hasLabel('fastSearch'),
@@ -61,7 +62,9 @@ async function searchFromNote(req) {
const ACTION_HANDLERS = {
deleteNote: (action, note) => {
note.markAsDeleted();
const deleteId = 'searchbulkaction-' + utils.randomString(10);
note.deleteNote(deleteId);
},
deleteNoteRevisions: (action, note) => {
noteRevisionService.eraseNoteRevisions(note.getNoteRevisions().map(rev => rev.noteRevisionId));
@@ -149,7 +152,7 @@ function getActions(note) {
.filter(a => !!a);
}
async function searchAndExecute(req) {
function searchAndExecute(req) {
const note = becca.getNote(req.params.noteId);
if (!note) {
@@ -165,7 +168,7 @@ async function searchAndExecute(req) {
return [400, `Note ${req.params.noteId} is not a search note.`]
}
const searchResultNoteIds = await searchFromNoteInt(note);
const searchResultNoteIds = searchFromNoteInt(note);
const actions = getActions(note);

View File

@@ -1 +1 @@
module.exports = { buildDate:"2022-06-05T15:00:25+02:00", buildRevision: "f587e0dfd9177462faef8ad7c39a855c25d03c91" };
module.exports = { buildDate:"2022-06-09T23:39:48+02:00", buildRevision: "96c4934c00703a93e4887af1bab20d953823c8ed" };

View File

@@ -50,7 +50,7 @@ module.exports = [
{ type: 'label', name: 'shareDisallowRobotIndexing' },
{ type: 'label', name: 'displayRelations' },
{ type: 'label', name: 'hideRelations' },
{ type: 'label', name: 'titleTemplate' },
{ type: 'label', name: 'titleTemplate', isDangerous: true },
// relation names
{ type: 'relation', name: 'internalLink' },

View File

@@ -98,25 +98,25 @@ const DEFAULT_KEYBOARD_ACTIONS = [
},
{
actionName: "moveNoteUp",
defaultShortcuts: ["CommandOrControl+Up"],
defaultShortcuts: isMac ? ["Alt+Up"] : ["CommandOrControl+Up"],
description: "Move note up",
scope: "note-tree"
},
{
actionName: "moveNoteDown",
defaultShortcuts: ["CommandOrControl+Down"],
defaultShortcuts: isMac ? ["Alt+Down"] : ["CommandOrControl+Down"],
description: "Move note down",
scope: "note-tree"
},
{
actionName: "moveNoteUpInHierarchy",
defaultShortcuts: ["CommandOrControl+Left"],
defaultShortcuts: isMac ? ["Alt+Left"] : ["CommandOrControl+Left"],
description: "Move note up in hierarchy",
scope: "note-tree"
},
{
actionName: "moveNoteDownInHierarchy",
defaultShortcuts: ["CommandOrControl+Right"],
defaultShortcuts: isMac ? ["Alt+Right"] : ["CommandOrControl+Right"],
description: "Move note down in hierarchy",
scope: "note-tree"
},

View File

@@ -102,7 +102,7 @@ function isDbUpToDate() {
async function migrateIfNecessary() {
const currentDbVersion = getDbVersion();
if (currentDbVersion > appInfo.dbVersion) {
if (currentDbVersion > appInfo.dbVersion && process.env.TRILIUM_IGNORE_DB_VERSION !== 'true') {
log.error(`Current DB version ${currentDbVersion} is newer than app db version ${appInfo.dbVersion} which means that it was created by newer and incompatible version of Trilium. Upgrade to latest version of Trilium to resolve this issue.`);
utils.crash();

View File

@@ -78,6 +78,10 @@ function findResultsWithExpression(expression, searchContext) {
const searchResults = noteSet.notes
.map(note => {
if (note.isDeleted) {
return null;
}
const notePathArray = executionContext.noteIdToNotePath[note.noteId] || beccaService.getSomePath(note);
if (!notePathArray) {
@@ -85,7 +89,8 @@ function findResultsWithExpression(expression, searchContext) {
}
return new SearchResult(notePathArray);
});
})
.filter(note => !!note);
for (const res of searchResults) {
res.computeScore(searchContext.highlightedTokens);
@@ -129,7 +134,7 @@ function parseQueryToExpression(query, searchContext) {
structuredExpressionTokens,
expression
};
log.info("Search debug: " + JSON.stringify(searchContext.debugInfo, null, 4));
}

View File

@@ -242,9 +242,9 @@ function transactional(func) {
return ret;
}
catch (e) {
const entityChanges = cls.getAndClearEntityChangeIds();
const entityChangeIds = cls.getAndClearEntityChangeIds();
if (entityChanges.length > 0) {
if (entityChangeIds.length > 0) {
log.info("Transaction rollback dirtied the becca, forcing reload.");
require('../becca/becca_loader').load();