Compare commits

...

128 Commits

Author SHA1 Message Date
zadam
6afc299efb release 0.45.8 2021-01-11 22:29:31 +01:00
zadam
369274ead7 new env variable to specify start note, #1532 2021-01-11 22:29:02 +01:00
zadam
04e6431c09 use correct class in exported HTMLs so that content style is applied, #1504 2020-12-30 23:20:12 +01:00
zadam
e89057a771 search note content only if not excluded by other expressions 2020-12-25 20:46:04 +01:00
zadam
4f27254e64 fix top margin of images and tables which can obscure their handles 2020-12-25 13:01:35 +01:00
zadam
577dc95ab8 convert   into whitespace also for large notes 2020-12-25 12:55:16 +01:00
zadam
a266d6a3d5 don't strip tags for very large text notes, #1500 2020-12-24 23:37:21 +01:00
zadam
749b6cb57e don't strip tags for very large text notes, #1500 2020-12-24 23:33:42 +01:00
zadam
b0b2951ff6 cleanup 2020-12-22 22:30:04 +01:00
zadam
1f3d73b9fd release 0.45.7 2020-12-22 20:21:15 +01:00
zadam
bdfd760b9d fixed some encryption issues 2020-12-21 23:19:03 +01:00
zadam
7133e60267 make encryption more robust in face of null values, #1483 2020-12-21 22:08:55 +01:00
zadam
fc4edf4aa7 better comment for instanceName 2020-12-21 21:05:34 +01:00
zadam
eaf93a70cd fix inverse relation creation, closes #1498 2020-12-21 20:55:01 +01:00
zadam
b093569ec5 increase toast size limit 2020-12-18 21:23:51 +01:00
zadam
4633c68a0c avoid resorting children on every child add, fixes #1480 2020-12-10 16:10:10 +01:00
zadam
33571e0ef3 better logging for un/protect errors 2020-12-09 22:49:55 +01:00
zadam
31876d2cf9 fix automatically scheduled note deletion 2020-12-09 22:45:34 +01:00
zadam
81c6043cb6 fix printing notes with math, closes #1484 2020-12-09 21:59:30 +01:00
zadam
1982d054ef inherit also note type and mime from template note, closes #1475 2020-12-07 09:35:39 +01:00
zadam
e56979c482 add button to erase deleted notes now into the options 2020-12-06 22:11:49 +01:00
zadam
58555b3660 release 0.45.6 2020-12-04 22:08:24 +01:00
zadam
b7b1324dd0 fixed disabled prefix in case of unsafe import to conform to new attribute name pattern constraints 2020-12-04 22:05:29 +01:00
zadam
e318acc977 fix incorrectly set isInheritable on inherited attrs 2020-11-27 22:33:33 +01:00
zadam
8ae82f5b69 fix "open in new tab" in tree context menu 2020-11-24 23:18:53 +01:00
zadam
26442f418a fix "open in new window" link context menu 2020-11-24 23:06:37 +01:00
zadam
23a432e7d8 don't show imageLinks in link map when they are connecting parent (text note) and child (image), closes #1461 2020-11-24 20:12:49 +01:00
zadam
984ecaf99c show again the table handle and type around 2020-11-23 20:56:14 +01:00
zadam
21b73a86b2 show also keyboard shortcut for duplicateSubtree in context menu 2020-11-23 20:17:53 +01:00
zadam
7d8277699c add keyboard shortcut for duplicate subtree, #1451 2020-11-23 19:44:49 +01:00
zadam
928ed7a034 add keyboard shortcut for include note, closes #1410 2020-11-22 22:44:06 +01:00
zadam
882b6be580 release 0.45.5 2020-11-20 22:50:10 +01:00
zadam
e5fa1e0ed5 hide table's selection handle, fixes #1448 2020-11-20 21:01:44 +01:00
zadam
1047aecfbd template subtree is now deep-duplicated on template assignment 2020-11-19 14:29:26 +01:00
zadam
314e0a453f "duplicate note" now duplicates whole note subtree instead of just individual note 2020-11-19 14:06:32 +01:00
zadam
8ec476ba96 fix ENEX import note saving 2020-11-19 13:30:39 +01:00
zadam
a346ba7038 removed outstandingPushes counting which is not needed 2020-11-18 22:30:00 +01:00
zadam
fd6b2f1e7f enex import cleanup 2020-11-18 21:30:56 +01:00
zadam
6662b9dbf9 rate limiting to improve responsiveness during / after import 2020-11-17 23:05:05 +01:00
zadam
c0a29ede05 small fixes to ENEX import 2020-11-17 22:35:20 +01:00
zadam
845907b8d2 fix recent changes to show all deleted notes (also without note revisions) 2020-11-17 21:06:38 +01:00
zadam
b12008e313 more robust search in face of inconsistent cache 2020-11-17 20:44:38 +01:00
zadam
a108ef91a0 fixed .createNoteLink API documentation 2020-11-17 20:11:10 +01:00
zadam
b5480b4137 fix sync check - it was always reporting success even in failure cases 2020-11-15 20:50:24 +01:00
zadam
47d61c416d release 0.45.4 2020-11-12 22:15:23 +01:00
zadam
6c57b2220f fix export download, fixes #1411 2020-11-12 22:13:59 +01:00
zadam
99f01b9ccf fix overwriting / deleting auto links, closes #1406 2020-11-11 23:15:48 +01:00
zadam
d5a9abd911 fix duplicating relations after change, closes #1405 2020-11-11 23:02:14 +01:00
zadam
a3a2bc0a74 fix "reviving" deleted attributes, closes #1404 2020-11-11 22:44:13 +01:00
zadam
402e5c4d81 release 0.45.3 2020-11-10 22:54:40 +01:00
zadam
5157fc15e9 electron update 2020-11-10 22:54:03 +01:00
zadam
4bd87b1796 update ckeditor5-math which fixes focus and placeholder issues 2020-11-07 21:28:12 +01:00
zadam
ce33eb3abd fix wrong behavior when customResourceProvider has empty value, fixes #1393 2020-11-06 21:52:57 +01:00
zadam
f988935a33 fixed & refactored opening/downloading file notes 2020-11-05 21:26:24 +01:00
zadam
9b05d30b47 update boxicons to 2.0.7 2020-11-03 22:44:50 +01:00
zadam
9e97fdcc49 convert H1 to H2 also during import 2020-11-01 20:38:39 +01:00
zadam
8e8148ce42 fix math rendering in note revisions, fixes #1359 2020-10-30 15:06:11 +01:00
zadam
af41e5d115 release 0.45.2 2020-10-29 22:57:25 +01:00
zadam
4f75b6aaaf fix removing stale branches from saved search after refresh, fixes #1354 2020-10-29 22:41:33 +01:00
zadam
82f410f695 fix math rendering in included note and note tooltip, fixes #1340 2020-10-29 21:06:30 +01:00
zadam
2bc06959c3 add a warning to change password dialog, fixes #1344 2020-10-29 20:57:26 +01:00
zadam
b898973ee6 fixed update ckeditor to 23.1.0 2020-10-29 20:09:25 +01:00
zadam
a2b0d8a379 update ckeditor to 23.1.0 2020-10-29 20:02:38 +01:00
zadam
06a4eab7d5 improved detection of image notes in ENEX import, fixes #1348 2020-10-28 23:36:45 +01:00
zadam
25df1a054c fix triggering change event when item is chosen from autocomplete, fixes #1345 2020-10-28 21:48:34 +01:00
zadam
8c4ff7ed2a fix using smart values with .dateCreated, closes #1338 2020-10-27 22:45:22 +01:00
zadam
609829653e fix docker build 2020-10-27 19:39:54 +01:00
zadam
5f20d033a8 release 0.45.1 2020-10-26 22:51:10 +01:00
zadam
93d0324177 fix case where parents of templates are not loaded
(cherry picked from commit a3f4fc7762)
2020-10-26 20:13:11 +01:00
zadam
0afd3c65aa fix setting note title on back/forward button click, closes #1334 2020-10-26 20:11:43 +01:00
zadam
8901c3ec91 fix recent changes showing deleted search note, closes #1331 2020-10-26 19:58:56 +01:00
zadam
c671b0a345 fix OPML import, closes #1333 2020-10-26 19:02:33 +01:00
zadam
9f424836e2 fix adding relation noteId as value, closes #1329 2020-10-26 16:05:34 +01:00
zadam
7f5af4b959 fix broken addTextToActiveEditor API method, closes #1332 2020-10-26 15:57:37 +01:00
zadam
dc64d333b6 release 0.45.0-beta 2020-10-21 22:57:54 +02:00
zadam
283808d691 library updates 2020-10-21 22:57:47 +02:00
zadam
a4bf69fe6a Merge remote-tracking branch 'origin/stable' into math2 2020-10-21 22:46:00 +02:00
zadam
6c7853319c reload note paths on note rename 2020-10-21 22:45:49 +02:00
zadam
2b1aa0d386 fix build revision link 2020-10-21 22:41:32 +02:00
zadam
24ae24a1ac release 0.44.9 2020-10-20 22:43:25 +02:00
zadam
00d860bfae properly handle saved search virtual branches during reloads, fixes #1301 2020-10-20 22:33:38 +02:00
zadam
a9f49e7f25 Merge remote-tracking branch 'origin/stable' into math2 2020-10-20 20:31:27 +02:00
zadam
fcf80f1e57 fix 2020-10-19 23:58:13 +02:00
zadam
dc94e1a1bf added list style, closes #1311 2020-10-19 23:54:37 +02:00
zadam
313b9dba61 support math in read only text notes 2020-10-19 23:36:57 +02:00
zadam
32e3560dce Merge remote-tracking branch 'origin/stable' into math2 2020-10-19 23:04:12 +02:00
zadam
7bd7323097 limit max width of zen mode to improve readability, closes #1320 2020-10-19 22:25:35 +02:00
zadam
0cb46f8f9b don't strip evernote links during import, #1319 2020-10-19 22:14:29 +02:00
zadam
c2b64bad80 hoisting bugfixes 2020-10-19 22:10:25 +02:00
zadam
991b335c3e allow exporting code notes from note actions, closes #1315 2020-10-19 20:29:56 +02:00
zadam
fd2d49de4f fix display of checkboxes in promoted attributes, closes #1313 2020-10-19 20:22:30 +02:00
zadam
b990239219 allow sender to save labels 2020-10-16 19:43:20 +02:00
zadam
f23454ffa3 math support WIP 2020-10-15 23:57:29 +02:00
zadam
631a11509a experimental math support 2020-10-15 20:49:42 +02:00
zadam
bf9bfe920a use icons instead of text links for header actions 2020-10-15 20:37:55 +02:00
zadam
ad878c078e release 0.44.8 2020-10-15 00:01:13 +02:00
zadam
8a019d617f small visual tweaks to link map, including displaying the note icon 2020-10-14 23:14:04 +02:00
zadam
4a76b7a9a5 use correct path separator, closes #1308 2020-10-14 20:42:55 +02:00
zadam
1ac1bf12a2 upgrading webpack fixes the issue with broken mobile frontend (and hacky fix which breaks desktop in turn) 2020-10-14 14:20:06 +02:00
zadam
b50638e85c release 0.44.7 2020-10-13 23:45:39 +02:00
zadam
893b6053d2 provide also explicit unhoist keyboard shortcut, #1305 2020-10-13 23:41:55 +02:00
zadam
a1ec6fe0aa fix file preview in note revisions dialog 2020-10-13 23:09:57 +02:00
zadam
18cc9f2475 "open" action will save note to temp directory to try it then open with native application, #1304 2020-10-13 22:50:45 +02:00
zadam
04ea8dd4b3 fix scroll to top for read only / editable text note after switching note 2020-10-13 22:03:16 +02:00
zadam
28cb3976e5 add explicit button to show/hide right pane widgets, #1299 2020-10-12 23:15:53 +02:00
zadam
a665d193eb same event handling note execute only once, closes #1278 2020-10-12 22:30:30 +02:00
zadam
cabb78b3e4 double click on an external link opens it 2020-10-12 22:11:49 +02:00
zadam
d953d96fa6 improvements to error logging in frontend 2020-10-12 21:05:34 +02:00
zadam
c71ac0302a use var instead of const to avoid webpack issue in mobile frontend build, closes #1300 2020-10-10 23:45:38 +02:00
zadam
4eb9ca7b46 fix demo document word count widget with contain: none 2020-10-10 21:08:28 +02:00
zadam
42daf181d3 round zoom factor 2020-10-10 20:12:39 +02:00
zadam
140f0a5dbd return null for not found attribute, closes #1294 2020-10-08 22:08:58 +02:00
zadam
10ce26799d release 0.44.6 2020-10-07 00:07:23 +02:00
zadam
91a2bb9b26 fixed demo document - restored more up to date version + largest notes stats 2020-10-06 22:25:28 +02:00
zadam
287ef9b522 added base element to handle external links in exports, #1289 2020-10-06 21:30:41 +02:00
zadam
32d609e796 fix largest notes script, #1291 2020-10-06 20:58:14 +02:00
zadam
8a435a2149 don't save zero byte buffers as note revisions 2020-10-05 23:56:59 +02:00
zadam
8855f29a49 detect TAB in table - then don't indent/outdent but switch table cells, closes #1290 2020-10-05 22:51:28 +02:00
zadam
384a9474c0 added meta viewport to exported HTMLs, #1289 2020-10-05 22:23:03 +02:00
zadam
a7f510783d reduce top margin of first paragraph in text, closes #1286 2020-10-05 21:31:57 +02:00
zadam
1a262fe680 attribute autocomplete should show prefix matches first and only after matches anywhere, #1284 2020-10-03 22:00:34 +02:00
zadam
0c4deda091 don't insert space after mentined label/relation, #1284 2020-10-03 21:51:10 +02:00
zadam
71894c34aa fix migration so that only really changed notes are updated, #1254 2020-10-03 20:51:14 +02:00
zadam
8313116b7f disable CSP completely, fixes #1282 (and other similar issues) 2020-10-02 23:33:28 +02:00
zadam
90622d71f8 caching parsed keyboard actions 2020-10-02 22:29:16 +02:00
zadam
620e896a89 faster content hash computation via in memory sorting 2020-10-02 21:53:25 +02:00
zadam
a9a9edf658 clear any event listener added in previous invocation of this function 2020-10-02 21:44:21 +02:00
FliegendeWurst
5e2077e6ae Jump to note dialog: fix duplicate event triggers (#1283)
This fixes an issue where the current path (above the note tree) displays parts multiple times, e.g. A / A / B / B instead of A / B.

The same issue could also affect other event handlers, but I didn't look around the codebase further.

(cherry picked from commit 51eb9f18f7)
2020-10-02 21:12:40 +02:00
193 changed files with 43355 additions and 8878 deletions

View File

@@ -1,4 +1,4 @@
FROM node:12.16.3-alpine
FROM node:12.19.0-alpine
# Create app directory
WORKDIR /usr/src/app

View File

@@ -5,7 +5,7 @@ SERIES=${VERSION:0:4}-latest
cat package.json | grep -v electron > server-package.json
sudo docker build -t zadam/trilium:$VERSION -t zadam/trilium:$SERIES .
sudo docker build -t zadam/trilium:$VERSION --network host -t zadam/trilium:$SERIES .
if [[ $VERSION != *"beta"* ]]; then
sudo docker tag zadam/trilium:$VERSION zadam/trilium:latest

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
PKG_DIR=dist/trilium-linux-x64-server
NODE_VERSION=12.18.3
NODE_VERSION=12.19.0
if [ "$1" != "DONTCOPY" ]
then

View File

@@ -1,5 +1,5 @@
[General]
# Instance name can be used to distinguish between different instances
# Instance name can be used to distinguish between different instances using backend api.getInstanceName()
instanceName=
# set to true to allow using Trilium without authentication (makes sense for server build only, desktop build doesn't need password)

Binary file not shown.

View File

@@ -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}`);

View File

@@ -335,7 +335,7 @@ class NoteShort {
getAttribute(type, name) {
const attributes = this.getAttributes(type, name);
return attributes.length > 0 ? attributes[0] : 0;
return attributes.length > 0 ? attributes[0] : null;
}
/**

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 912 KiB

After

Width:  |  Height:  |  Size: 952 KiB

View File

@@ -1,12 +1,12 @@
/* !!!!!! TRILIUM CUSTOM CHANGES !!!!!! */
.ck-widget__type-around { /* gets rid of triangles: https://github.com/zadam/trilium/issues/1129 */
.printed-content .ck-widget__selection-handle, .printed-content .ck-widget__type-around { /* gets rid of triangles: https://github.com/zadam/trilium/issues/1129 */
display: none;
}
/*
* CKEditor 5 (v22.0.0) content styles.
* Generated on Thu, 27 Aug 2020 12:13:06 GMT.
* CKEditor 5 (v23.1.0) content styles.
* Generated on Thu, 29 Oct 2020 12:17:48 GMT.
* For more information, check out https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/content-styles.html
*/
@@ -23,32 +23,6 @@
--ck-todo-list-checkmark-size: 16px;
}
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .marker-yellow {
background-color: var(--ck-highlight-marker-yellow);
}
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .marker-green {
background-color: var(--ck-highlight-marker-green);
}
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .marker-pink {
background-color: var(--ck-highlight-marker-pink);
}
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .marker-blue {
background-color: var(--ck-highlight-marker-blue);
}
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .pen-red {
color: var(--ck-highlight-pen-red);
background-color: transparent;
}
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .pen-green {
color: var(--ck-highlight-pen-green);
background-color: transparent;
}
/* ckeditor5-image/theme/imagestyle.css */
.ck-content .image-style-side {
float: right;
@@ -84,6 +58,17 @@
max-width: 100%;
min-width: 50px;
}
/* ckeditor5-image/theme/imagecaption.css */
.ck-content .image > figcaption {
display: table-caption;
caption-side: bottom;
word-break: break-word;
color: hsl(0, 0%, 20%);
background-color: hsl(0, 0%, 97%);
padding: .6em;
font-size: .75em;
outline-offset: -1px;
}
/* ckeditor5-image/theme/imageresize.css */
.ck-content .image.image_resized {
max-width: 100%;
@@ -98,22 +83,31 @@
.ck-content .image.image_resized > figcaption {
display: block;
}
/* ckeditor5-image/theme/imagecaption.css */
.ck-content .image > figcaption {
display: table-caption;
caption-side: bottom;
word-break: break-word;
color: hsl(0, 0%, 20%);
background-color: hsl(0, 0%, 97%);
padding: .6em;
font-size: .75em;
outline-offset: -1px;
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .marker-yellow {
background-color: var(--ck-highlight-marker-yellow);
}
/* ckeditor5-basic-styles/theme/code.css */
.ck-content code {
background-color: hsla(0, 0%, 78%, 0.3);
padding: .15em;
border-radius: 2px;
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .marker-green {
background-color: var(--ck-highlight-marker-green);
}
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .marker-pink {
background-color: var(--ck-highlight-marker-pink);
}
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .marker-blue {
background-color: var(--ck-highlight-marker-blue);
}
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .pen-red {
color: var(--ck-highlight-pen-red);
background-color: transparent;
}
/* ckeditor5-highlight/theme/highlight.css */
.ck-content .pen-green {
color: var(--ck-highlight-pen-green);
background-color: transparent;
}
/* ckeditor5-font/theme/fontsize.css */
.ck-content .text-tiny {
@@ -146,6 +140,12 @@
border-left: 0;
border-right: solid 5px hsl(0, 0%, 80%);
}
/* ckeditor5-basic-styles/theme/code.css */
.ck-content code {
background-color: hsla(0, 0%, 78%, 0.3);
padding: .15em;
border-radius: 2px;
}
/* ckeditor5-table/theme/table.css */
.ck-content .table {
margin: 1em auto;
@@ -215,13 +215,6 @@
-ms-user-select: none;
user-select: none;
}
/* ckeditor5-media-embed/theme/mediaembed.css */
.ck-content .media {
clear: both;
margin: 1em 0;
display: block;
min-width: 15em;
}
/* ckeditor5-list/theme/todolist.css */
.ck-content .todo-list {
list-style: none;
@@ -289,6 +282,18 @@
.ck-content .todo-list .todo-list__label .todo-list__label__description {
vertical-align: middle;
}
/* ckeditor5-media-embed/theme/mediaembed.css */
.ck-content .media {
clear: both;
margin: 1em 0;
display: block;
min-width: 15em;
}
/* ckeditor5-html-embed/theme/htmlembed.css */
.ck-content .raw-html-embed {
margin: 1em auto;
min-width: 15em;
}
/* ckeditor5-horizontal-line/theme/horizontalline.css */
.ck-content hr {
margin: 15px 0;
@@ -330,4 +335,4 @@
.ck-content .page-break::after {
display: none;
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

91
libraries/katex/README.md Normal file
View File

@@ -0,0 +1,91 @@
# [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/)
[![npm](https://img.shields.io/npm/v/katex.svg)](https://www.npmjs.com/package/katex)
[![CircleCI](https://circleci.com/gh/KaTeX/KaTeX.svg?style=shield)](https://circleci.com/gh/KaTeX/KaTeX)
[![codecov](https://codecov.io/gh/KaTeX/KaTeX/branch/master/graph/badge.svg)](https://codecov.io/gh/KaTeX/KaTeX)
[![Join the chat at https://gitter.im/KaTeX/KaTeX](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/KaTeX/KaTeX?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=KaTeX/KaTeX)](https://dependabot.com)
[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/katex/badge?style=rounded)](https://www.jsdelivr.com/package/npm/katex)
![](https://img.badgesize.io/KaTeX/KaTeX/v0.12.0/dist/katex.min.js?compression=gzip)
KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.
* **Fast:** KaTeX renders its math synchronously and doesn't need to reflow the page. See how it compares to a competitor in [this speed test](http://www.intmath.com/cg5/katex-mathjax-comparison.php).
* **Print quality:** KaTeX's layout is based on Donald Knuth's TeX, the gold standard for math typesetting.
* **Self contained:** KaTeX has no dependencies and can easily be bundled with your website resources.
* **Server side rendering:** KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML.
KaTeX is compatible with all major browsers, including Chrome, Safari, Firefox, Opera, Edge, and IE 11.
KaTeX supports much (but not all) of LaTeX and many LaTeX packages. See the [list of supported functions](https://katex.org/docs/supported.html).
Try out KaTeX [on the demo page](https://katex.org/#demo)!
## Getting started
### Starter template
```html
<!DOCTYPE html>
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
</head>
...
</html>
```
You can also [download KaTeX](https://github.com/KaTeX/KaTeX/releases) and host it yourself.
For details on how to configure auto-render extension, refer to [the documentation](https://katex.org/docs/autorender.html).
### API
Call `katex.render` to render a TeX expression directly into a DOM element.
For example:
```js
katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, {
throwOnError: false
});
```
Call `katex.renderToString` to generate an HTML string of the rendered math,
e.g., for server-side rendering. For example:
```js
var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}", {
throwOnError: false
});
// '<span class="katex">...</span>'
```
Make sure to include the CSS and font files in both cases.
If you are doing all rendering on the server, there is no need to include the
JavaScript on the client.
The examples above use the `throwOnError: false` option, which renders invalid
inputs as the TeX source code in red (by default), with the error message as
hover text. For other available options, see the
[API documentation](https://katex.org/docs/api.html),
[options documentation](https://katex.org/docs/options.html), and
[handling errors documentation](https://katex.org/docs/error.html).
## Demo and Documentation
Learn more about using KaTeX [on the website](https://katex.org)!
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
## License
KaTeX is licensed under the [MIT License](http://opensource.org/licenses/MIT).

1
libraries/katex/auto-render.min.js vendored Normal file
View File

@@ -0,0 +1 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),a=function(e,t,r){for(var n=r,o=0,a=e.length;n<t.length;){var i=t[n];if(o<=0&&t.slice(n,n+a)===e)return n;"\\"===i?n++:"{"===i?o++:"}"===i&&o--,n++}return-1},i=function(e,t,r,n){for(var o=[],i=0;i<e.length;i++)if("text"===e[i].type){var l=e[i].data,d=!0,s=0,f=void 0;for(-1!==(f=l.indexOf(t))&&(s=f,o.push({type:"text",data:l.slice(0,s)}),d=!1);;){if(d){if(-1===(f=l.indexOf(t,s)))break;o.push({type:"text",data:l.slice(s,f)}),s=f}else{if(-1===(f=a(r,l,s+t.length)))break;o.push({type:"math",data:l.slice(s+t.length,f),rawData:l.slice(s,f+r.length),display:n}),s=f+r.length}d=!d}o.push({type:"text",data:l.slice(s)})}else o.push(e[i]);return o},l=function(e,t){var r=function(e,t){for(var r=[{type:"text",data:e}],n=0;n<t.length;n++){var o=t[n];r=i(r,o.left,o.right,o.display||!1)}return r}(e,t.delimiters);if(1===r.length&&"text"===r[0].type)return null;for(var n=document.createDocumentFragment(),a=0;a<r.length;a++)if("text"===r[a].type)n.appendChild(document.createTextNode(r[a].data));else{var l=document.createElement("span"),d=r[a].data;t.displayMode=r[a].display;try{t.preProcess&&(d=t.preProcess(d)),o.a.render(d,l,t)}catch(e){if(!(e instanceof o.a.ParseError))throw e;t.errorCallback("KaTeX auto-render: Failed to parse `"+r[a].data+"` with ",e),n.appendChild(document.createTextNode(r[a].rawData));continue}n.appendChild(l)}return n};t.default=function(e,t){if(!e)throw new Error("No element provided to render");var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);r.delimiters=r.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\[",right:"\\]",display:!0}],r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},function e(t,r){for(var n=0;n<t.childNodes.length;n++){var o=t.childNodes[n];if(3===o.nodeType){var a=l(o.textContent,r);a&&(n+=a.childNodes.length-1,t.replaceChild(a,o))}else 1===o.nodeType&&function(){var t=" "+o.className+" ";-1===r.ignoredTags.indexOf(o.nodeName.toLowerCase())&&r.ignoredClasses.every(function(e){return-1===t.indexOf(" "+e+" ")})&&e(o,r)}()}}(e,r)}}]).default});

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1035
libraries/katex/katex.css Normal file

File diff suppressed because it is too large Load Diff

17308
libraries/katex/katex.js Normal file

File diff suppressed because it is too large Load Diff

1
libraries/katex/katex.min.css vendored Normal file

File diff suppressed because one or more lines are too long

1
libraries/katex/katex.min.js vendored Normal file

File diff suppressed because one or more lines are too long

16911
libraries/katex/katex.mjs Normal file

File diff suppressed because it is too large Load Diff

3298
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"name": "trilium",
"productName": "Trilium Notes",
"description": "Trilium Notes",
"version": "0.44.5",
"version": "0.45.8",
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {
@@ -32,7 +32,7 @@
"commonmark": "0.29.2",
"cookie-parser": "1.4.5",
"csurf": "1.11.0",
"dayjs": "1.8.36",
"dayjs": "1.9.3",
"ejs": "3.1.5",
"electron-debug": "3.1.0",
"electron-dl": "3.0.2",
@@ -40,7 +40,6 @@
"electron-window-state": "5.0.3",
"express": "4.17.1",
"express-session": "1.17.1",
"file-type": "15.0.1",
"fs-extra": "9.0.1",
"helmet": "4.1.1",
"html": "1.0.0",
@@ -55,19 +54,21 @@
"mime-types": "2.1.27",
"multer": "1.4.2",
"node-abi": "2.19.1",
"open": "7.2.1",
"open": "7.3.0",
"portscanner": "2.2.0",
"rand-token": "1.0.1",
"request": "^2.88.2",
"rimraf": "3.0.2",
"sanitize-filename": "1.6.3",
"sanitize-html": "1.27.4",
"sanitize-html": "2.1.1",
"sax": "1.2.4",
"semver": "7.3.2",
"serve-favicon": "2.5.0",
"session-file-store": "1.4.0",
"session-file-store": "1.5.0",
"stream-throttle": "^0.1.3",
"striptags": "3.1.1",
"turndown": "6.0.0",
"tmp": "^0.2.1",
"turndown": "7.0.0",
"turndown-plugin-gfm": "1.0.2",
"unescape": "1.0.1",
"ws": "7.3.1",
@@ -76,17 +77,17 @@
},
"devDependencies": {
"cross-env": "7.0.2",
"electron": "9.3.1",
"electron-builder": "22.8.1",
"electron": "9.3.5",
"electron-builder": "22.9.1",
"electron-packager": "15.1.0",
"electron-rebuild": "2.0.3",
"electron-rebuild": "2.3.2",
"esm": "3.2.25",
"jasmine": "3.6.1",
"jasmine": "3.6.2",
"jsdoc": "3.6.6",
"lorem-ipsum": "2.0.3",
"rcedit": "2.2.0",
"webpack": "5.0.0-beta.32",
"webpack-cli": "4.0.0-beta.8"
"webpack": "5.1.3",
"webpack-cli": "4.1.0"
},
"optionalDependencies": {
"electron-installer-debian": "2.0.1"

View File

@@ -57,8 +57,15 @@ function id() {
return randtoken.generate(10);
}
function note(title, type = 'text', mime = 'text/html') {
const note = new Note(noteCache, {noteId: id(), title, type, mime});
function note(title, extraParams = {}) {
const row = Object.assign({
noteId: id(),
title: title,
type: 'text',
mime: 'text/html'
}, extraParams);
const note = new Note(noteCache, row);
return new NoteBuilder(note);
}

View File

@@ -247,6 +247,6 @@ describe("Invalid expressions", () => {
searchContext
});
expect(searchContext.error).toEqual('Misplaced or incomplete expression "="')
expect(searchContext.error).toEqual('Relation can be compared only with property, e.g. ~relation.title=hello in ""')
});
});

View File

@@ -53,8 +53,8 @@ describe("Search", () => {
it("normal search looks also at type and mime", () => {
rootNote
.child(note("Effective Java", 'book', ''))
.child(note("Hello World.java", 'code', 'text/x-java'));
.child(note("Effective Java", {type: 'book', mime:''}))
.child(note("Hello World.java", {type: 'code', mime: 'text/x-java'}));
const searchContext = new SearchContext();
let searchResults = searchService.findNotesWithQuery('book', searchContext);
@@ -178,7 +178,7 @@ describe("Search", () => {
// dates should not be coerced into numbers which would then give wrong numbers
rootNote
.child(note("My note")
.child(note("My note", {dateCreated: dateUtils.localNowDateTime()})
.label('year', new Date().getFullYear().toString())
.label('month', dateUtils.localNowDate().substr(0, 7))
.label('date', dateUtils.localNowDate())
@@ -209,6 +209,8 @@ describe("Search", () => {
test("#month = month", 1);
test("#month = 'MONTH'", 0);
test("note.dateCreated =* month", 1);
test("#date = TODAY", 1);
test("#date = today", 1);
test("#date = 'today'", 0);
@@ -586,7 +588,7 @@ describe("Search", () => {
const searchContext = new SearchContext();
let searchResults = searchService.findNotesWithQuery('# note.text *=* rati and note.noteId != root', searchContext);
let searchResults = searchService.findNotesWithQuery('# note.text *=* vaki and note.noteId != root', searchContext);
expect(searchResults.length).toEqual(1);
expect(noteCache.notes[searchResults[0].noteId].title).toEqual("Slovakia");
});

View File

@@ -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'}));

View File

@@ -34,6 +34,10 @@ class Attribute extends Entity {
this.isInheritable = !!this.isInheritable;
}
isAutoLink() {
return this.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(this.name);
}
/**
* @returns {Note|null}
*/

View File

@@ -38,7 +38,7 @@ class Branch extends Entity {
}
beforeSaving() {
if (this.notePosition === undefined) {
if (this.notePosition === undefined || this.notePosition === null) {
const maxNotePos = sql.getValue('SELECT MAX(notePosition) FROM branches WHERE parentNoteId = ? AND isDeleted = 0', [this.parentNoteId]);
this.notePosition = maxNotePos === null ? 0 : maxNotePos + 10;
}

View File

@@ -86,7 +86,7 @@ $form.on('submit', () => {
textTypeWidget.addLink(notePath, linkTitle);
}
else {
console.error("No path to add link.");
logError("No path to add link.");
}
return false;

View File

@@ -61,7 +61,7 @@ $form.on('submit', () => {
cloneNotesTo(notePath);
}
else {
console.error("No path to clone to.");
logError("No path to clone to.");
}
return false;

View File

@@ -3,6 +3,7 @@ import utils from "../services/utils.js";
import ws from "../services/ws.js";
import toastService from "../services/toast.js";
import treeCache from "../services/tree_cache.js";
import openService from "../services/open.js";
const $dialog = $("#export-dialog");
const $form = $("#export-form");
@@ -73,9 +74,9 @@ $form.on('submit', () => {
function exportBranch(branchId, type, format, version) {
taskId = utils.randomString(10);
const url = utils.getUrlForDownload(`api/notes/${branchId}/export/${type}/${format}/${version}/${taskId}`);
const url = openService.getUrlForDownload(`api/notes/${branchId}/export/${type}/${format}/${version}/${taskId}`);
utils.download(url);
openService.download(url);
}
$('input[name=export-type]').on('change', function () {
@@ -133,4 +134,4 @@ ws.subscribeToMessages(async message => {
toastService.showPersistent(toast);
}
});
});

View File

@@ -46,7 +46,7 @@ $form.on('submit', () => {
includeNote(notePath);
}
else {
console.error("No noteId to include.");
logError("No noteId to include.");
}
return false;

View File

@@ -51,7 +51,7 @@ $form.on('submit', () => {
treeCache.getBranchId(parentNoteId, noteId).then(branchId => moveNotesTo(branchId));
}
else {
console.error("No path to move to.");
logError("No path to move to.");
}
return false;

View File

@@ -2,6 +2,8 @@ import utils from '../services/utils.js';
import server from '../services/server.js';
import toastService from "../services/toast.js";
import appContext from "../services/app_context.js";
import libraryLoader from "../services/library_loader.js";
import openService from "../services/open.js";
const $dialog = $("#note-revisions-dialog");
const $list = $("#note-revision-list");
@@ -120,11 +122,7 @@ async function setContentPane() {
const $downloadButton = $('<button class="btn btn-sm btn-primary" type="button">Download</button>');
$downloadButton.on('click', () => {
const url = utils.getUrlForDownload(`api/notes/${revisionItem.noteId}/revisions/${revisionItem.noteRevisionId}/download`);
utils.download(url);
});
$downloadButton.on('click', () => openService.downloadNoteRevision(revisionItem.noteId, revisionItem.noteRevisionId));
$titleButtons.append($downloadButton);
@@ -132,6 +130,12 @@ async function setContentPane() {
if (revisionItem.type === 'text') {
$content.html(fullNoteRevision.content);
if ($content.find('span.math-tex').length > 0) {
await libraryLoader.requireLibrary(libraryLoader.KATEX);
renderMathInElement($content[0], {});
}
}
else if (revisionItem.type === 'code') {
$content.html($("<pre>").text(fullNoteRevision.content));
@@ -157,8 +161,8 @@ async function setContentPane() {
if (fullNoteRevision.content) {
$table.append($("<tr>").append(
$("<th>").text("Preview:"),
$("<td>").append(
$('<td colspan="2">').append(
$('<div style="font-weight: bold;">').text("Preview:"),
$('<pre class="file-preview-content"></pre>')
.text(fullNoteRevision.content)
)
@@ -196,4 +200,4 @@ $list.on('focus', '.dropdown-item', e => {
});
setContentPane();
});
});

View File

@@ -8,6 +8,11 @@ const TPL = `
<p>Your username is <strong id="credentials-username"></strong>.</p>
<h3>Change password</h3>
<div class="alert alert-warning" role="alert" style="font-weight: bold; color: red !important;">
Please take care to remember your new password. Password is used to encrypt protected notes. If you forget your password, then all your protected notes are forever lost with no recovery options.
</div>
<form id="change-password-form">
<div class="form-group">
<label for="old-password">Old password</label>

View File

@@ -81,7 +81,7 @@ export default class KeyboardShortcutsOptions {
.filter(shortcut => !!shortcut);
const opts = {};
opts['keyboardShortcuts' + actionName] = JSON.stringify(shortcuts);
opts['keyboardShortcuts' + actionName.substr(0, 1).toUpperCase() + actionName.substr(1)] = JSON.stringify(shortcuts);
server.put('options', opts);
});
@@ -138,4 +138,4 @@ export default class KeyboardShortcutsOptions {
});
});
}
}
}

Some files were not shown because too many files have changed in this diff Show More