mirror of
https://github.com/zadam/trilium.git
synced 2024-09-23 00:56:00 +08:00
Merge remote-tracking branch 'origin/stable'
This commit is contained in:
commit
99f35b2588
BIN
db/demo.zip
BIN
db/demo.zip
Binary file not shown.
|
@ -3,13 +3,15 @@ const repository = require('../../src/services/repository');
|
|||
module.exports = () => {
|
||||
for (const note of repository.getEntities("SELECT * FROM notes WHERE type = 'text' AND isProtected = 0")) {
|
||||
try {
|
||||
let content = note.getContent();
|
||||
let origContent = note.getContent();
|
||||
|
||||
content = content
|
||||
const newContent = origContent
|
||||
.replace(/<h1/ig, "<h2")
|
||||
.replace(/<\/h1/ig, "</h2");
|
||||
|
||||
note.setContent(content);
|
||||
if (newContent !== origContent) {
|
||||
note.setContent(newContent);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.log(`Changing note content for note ${note.noteId} failed with: ${e.message} ${e.stack}`);
|
||||
|
|
2
libraries/ckeditor/ckeditor.js
vendored
2
libraries/ckeditor/ckeditor.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "trilium",
|
||||
"version": "0.44.4",
|
||||
"version": "0.44.5",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -3165,9 +3165,9 @@
|
|||
}
|
||||
},
|
||||
"electron": {
|
||||
"version": "9.3.1",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-9.3.1.tgz",
|
||||
"integrity": "sha512-DScrhqBT4a54KfdF0EoipALpHmdQTn3m7SSCtbpTcEcG+UDUiXad2cOfW6DHeVH7N+CVDKDG12q2PhVJjXkFAA==",
|
||||
"version": "9.3.2",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-9.3.2.tgz",
|
||||
"integrity": "sha512-0lleEf9msAXGDi2GukAuiGdw3VDgSTlONOnJgqDEz1fuSEVsXz5RX+hNPKDsVDerLTFg/C34RuJf4LwHvkKcBA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@electron/get": "^1.0.1",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "trilium",
|
||||
"productName": "Trilium Notes",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.44.4",
|
||||
"version": "0.44.5",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"bin": {
|
||||
|
@ -76,7 +76,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "7.0.2",
|
||||
"electron": "9.3.1",
|
||||
"electron": "9.3.2",
|
||||
"electron-builder": "22.8.1",
|
||||
"electron-packager": "15.1.0",
|
||||
"electron-rebuild": "2.0.3",
|
||||
|
|
|
@ -21,12 +21,7 @@ app.set('view engine', 'ejs');
|
|||
|
||||
app.use(helmet({
|
||||
hidePoweredBy: false, // deactivated because electron 4.0 crashes on this right after startup
|
||||
contentSecurityPolicy: {
|
||||
directives: {
|
||||
defaultSrc: ["*", "'unsafe-inline'", "'unsafe-eval'"],
|
||||
imgSrc: ["'self' data:"]
|
||||
}
|
||||
}
|
||||
contentSecurityPolicy: false
|
||||
}));
|
||||
|
||||
app.use(bodyParser.json({limit: '500mb'}));
|
||||
|
|
|
@ -67,6 +67,9 @@ function showRecentNotes($el) {
|
|||
|
||||
function initNoteAutocomplete($el, options) {
|
||||
if ($el.hasClass("note-autocomplete-input") || utils.isMobile()) {
|
||||
// clear any event listener added in previous invocation of this function
|
||||
$el.off('autocomplete:noteselected');
|
||||
|
||||
return $el;
|
||||
}
|
||||
|
||||
|
@ -157,6 +160,9 @@ function initNoteAutocomplete($el, options) {
|
|||
}
|
||||
});
|
||||
|
||||
// clear any event listener added in previous invocation of this function
|
||||
$el.off('autocomplete:noteselected');
|
||||
|
||||
return $el;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,10 @@ const TPL = `
|
|||
cursor: text !important;
|
||||
}
|
||||
|
||||
.note-detail-editable-text *:first-child {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
.note-detail-editable-text h1 { font-size: 2.0em; }
|
||||
.note-detail-editable-text h2 { font-size: 1.8em; }
|
||||
.note-detail-editable-text h3 { font-size: 1.6em; }
|
||||
|
@ -59,10 +63,6 @@ const TPL = `
|
|||
/* This is because with empty content height of editor is 0 and it's impossible to click into it */
|
||||
min-height: 500px;
|
||||
}
|
||||
|
||||
.note-detail-editable-text p:first-child, .note-detail-editable-text::before {
|
||||
margin-top: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="note-detail-editable-text-editor" tabindex="300"></div>
|
||||
|
|
|
@ -768,7 +768,7 @@ body {
|
|||
|
||||
#context-menu-container, #context-menu-container .dropdown-menu {
|
||||
padding: 3px 0 0;
|
||||
z-index: 1000;
|
||||
z-index: 2000;
|
||||
}
|
||||
|
||||
#context-menu-container .dropdown-item {
|
||||
|
|
|
@ -71,8 +71,17 @@ function getTree(req) {
|
|||
JOIN treeWithDescendantsAndAscendants ON branches.noteId = treeWithDescendantsAndAscendants.noteId
|
||||
WHERE branches.isDeleted = 0
|
||||
AND branches.parentNoteId != ?
|
||||
),
|
||||
treeWithDescendantsAscendantsAndTemplates AS (
|
||||
SELECT noteId FROM treeWithDescendantsAndAscendants
|
||||
UNION
|
||||
SELECT attributes.value FROM attributes
|
||||
JOIN treeWithDescendantsAscendantsAndTemplates ON attributes.noteId = treeWithDescendantsAscendantsAndTemplates.noteId
|
||||
WHERE attributes.isDeleted = 0
|
||||
AND attributes.type = 'relation'
|
||||
AND attributes.name = 'template'
|
||||
)
|
||||
SELECT noteId FROM treeWithDescendantsAndAscendants`, [subTreeNoteId, subTreeNoteId]);
|
||||
SELECT noteId FROM treeWithDescendantsAscendantsAndTemplates`, [subTreeNoteId, subTreeNoteId]);
|
||||
|
||||
noteIds.push(subTreeNoteId);
|
||||
|
||||
|
|
|
@ -109,7 +109,16 @@ function getAttributeNames(type, nameLike) {
|
|||
}
|
||||
}
|
||||
|
||||
names.sort();
|
||||
names.sort((a, b) => {
|
||||
const aPrefix = a.toLowerCase().startsWith(nameLike);
|
||||
const bPrefix = b.toLowerCase().startsWith(nameLike);
|
||||
|
||||
if (aPrefix !== bPrefix) {
|
||||
return aPrefix ? -1 : 1;
|
||||
}
|
||||
|
||||
return a < b ? -1 : 1;
|
||||
});
|
||||
|
||||
return names;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
module.exports = { buildDate:"2020-09-24T23:33:36+02:00", buildRevision: "748979eafd44704af42df54f4195d118dec891ae" };
|
||||
module.exports = { buildDate:"2020-10-01T23:45:09+02:00", buildRevision: "8f018cc7c69257bbd11590e41e267872e19d7bb6" };
|
||||
|
|
|
@ -12,9 +12,11 @@ const RecentNote = require('../entities/recent_note');
|
|||
const Option = require('../entities/option');
|
||||
|
||||
function getSectorHashes(tableName, primaryKeyName, whereBranch) {
|
||||
const hashes = sql.getRows(`SELECT ${primaryKeyName} AS id, hash FROM ${tableName} `
|
||||
+ (whereBranch ? `WHERE ${whereBranch} ` : '')
|
||||
+ ` ORDER BY ${primaryKeyName}`);
|
||||
const hashes = sql.getRows(`SELECT ${primaryKeyName} AS id, hash FROM ${tableName}`
|
||||
+ (whereBranch ? ` WHERE ${whereBranch} ` : ''));
|
||||
|
||||
// sorting is faster in memory
|
||||
hashes.sort((a, b) => a.id < b.id ? -1 : 1);
|
||||
|
||||
const map = {};
|
||||
|
||||
|
|
|
@ -229,6 +229,7 @@ function exportToZip(taskContext, branch, format, res) {
|
|||
content = `<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="${cssUrl}">
|
||||
</head>
|
||||
<body>
|
||||
|
@ -356,6 +357,7 @@ ${content}
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<frameset cols="25%,75%">
|
||||
<frame name="navigation" src="navigation.html">
|
||||
|
|
|
@ -402,7 +402,13 @@ for (const action of DEFAULT_KEYBOARD_ACTIONS) {
|
|||
}
|
||||
}
|
||||
|
||||
let cachedActions = null;
|
||||
|
||||
function getKeyboardActions() {
|
||||
if (cachedActions) {
|
||||
return cachedActions;
|
||||
}
|
||||
|
||||
const actions = JSON.parse(JSON.stringify(DEFAULT_KEYBOARD_ACTIONS));
|
||||
|
||||
for (const action of actions) {
|
||||
|
@ -430,6 +436,8 @@ function getKeyboardActions() {
|
|||
}
|
||||
}
|
||||
|
||||
cachedActions = actions;
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,10 @@ function isInAncestor(noteId, ancestorNoteId) {
|
|||
|
||||
const note = noteCache.notes[noteId];
|
||||
|
||||
if (!note) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const parentNote of note.parents) {
|
||||
if (isInAncestor(parentNote.noteId, ancestorNoteId)) {
|
||||
return true;
|
||||
|
|
|
@ -23,17 +23,17 @@ function protectNoteRevisions(note) {
|
|||
|
||||
/**
|
||||
* @param {Note} note
|
||||
* @return {NoteRevision}
|
||||
* @return {NoteRevision|null}
|
||||
*/
|
||||
function createNoteRevision(note) {
|
||||
if (note.hasLabel("disableVersioning")) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
const content = note.getContent();
|
||||
|
||||
if (!content) {
|
||||
return;
|
||||
if (!content || (Buffer.isBuffer(content) && content.byteLength === 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const contentMetadata = note.getContentMetadata();
|
||||
|
|
Loading…
Reference in a new issue