Compare commits

...

951 Commits

Author SHA1 Message Date
zadam
942132c01d release 0.46.6 2021-03-23 23:57:48 +01:00
zadam
1862acd1ff avoid getting refreshes on note title 2021-03-23 22:46:18 +01:00
zadam
ce7e18d0b0 fix syncing protected notes in case there wasn't any other change, closes #1778 2021-03-23 22:18:23 +01:00
zadam
65280d5ba3 avoid ugly error in the logs, #1778 2021-03-22 23:27:41 +01:00
zadam
7e3d424e23 fix deleting all revisions, closes #1774 2021-03-22 23:07:43 +01:00
zadam
bff04c121a fix scrolling in mobile frontend, closes #1768 2021-03-20 12:47:47 +01:00
zadam
e8903e82a1 add option to disable note tree auto collapse, fixes #1751 2021-03-18 20:11:58 +01:00
zadam
0cfd95d9b8 not finding node for a note path does not have to be always an error 2021-03-17 23:17:54 +01:00
zadam
1aa5349628 make edit button visible for empty readonly notes, fixes #1760 2021-03-17 22:41:37 +01:00
zadam
4e21d12202 fix nodejs 10 compatibility, closes #1746 2021-03-15 20:31:12 +01:00
zadam
fdce218e88 release 0.46.5 2021-03-14 22:56:27 +01:00
zadam
6c8d20288d fix 0.46 regression to set up sync from client, fixes #1742 2021-03-13 22:54:00 +01:00
zadam
88d04772c4 make sure the CLS entity changes are cleared after roll backed transaction, #1736 2021-03-12 23:48:14 +01:00
zadam
9fd26a9b9f when creating new note into inbox use current hoisted note in new tab as well 2021-03-12 21:47:26 +01:00
zadam
98f02c3c9a added "hoistedInbox" label 2021-03-12 21:29:50 +01:00
zadam
584fea1992 Revert "delete notes skeleton dialog"
This reverts commit 03a11e6f
2021-03-12 20:44:19 +01:00
zadam
af50a1ec52 Merge remote-tracking branch 'origin/stable' into stable 2021-03-12 20:39:51 +01:00
zadam
4e76d1fa85 hide some "boring" attributes from book listing view 2021-03-12 20:39:42 +01:00
zadam
03a11e6f77 delete notes skeleton dialog 2021-03-11 22:35:53 +01:00
zadam
e1a16b4a9f defensive check, #1736 2021-03-11 20:28:07 +01:00
zadam
12b468d3dc release 0.46.4-beta 2021-03-10 23:35:12 +01:00
zadam
6f901e6852 use icons instead of plain text to differentiate between different paths in note paths widget 2021-03-10 23:11:48 +01:00
zadam
09e9ac4d00 prevent cycles in resolving the notepath, fixes #1730 2021-03-10 22:54:55 +01:00
zadam
a33ac65fdf fix focus on moving notes with keyboard 2021-03-09 22:24:59 +01:00
zadam
f8fb071a6f added option to bring back plain (non-markdown) headings, closes #1678 2021-03-09 22:06:40 +01:00
zadam
a654078e56 fix broken template copy, closes #1724 2021-03-09 20:51:57 +01:00
zadam
fba68681aa when resolving note path check if there's a hoisted note in it, if not, try again to find some path with hoisted note, closes #1718 2021-03-09 20:37:56 +01:00
zadam
50c84e0f5f release 0.46.3-beta 2021-03-08 23:11:11 +01:00
zadam
f27370d44f fix putting focus back to the note tree after note deletion 2021-03-08 23:10:34 +01:00
zadam
c6c9202c00 fix note icon color in dark mode 2021-03-08 22:06:26 +01:00
zadam
2cafda5f66 note paths visually distinguishes between different note paths, closes #1669 2021-03-08 22:04:52 +01:00
zadam
873953cbaf fix bug 2021-03-08 00:09:48 +01:00
zadam
d51744ce19 make note paths current path underlined 2021-03-08 00:07:00 +01:00
zadam
7df8c940b6 have paths in "note paths" widget also sorted by priority 2021-03-08 00:04:43 +01:00
zadam
9bac2a4819 refresh inherited attribute list after attr change, closes #1717 2021-03-07 23:31:56 +01:00
zadam
88147f7a0a fixed "create note after" position issue 2021-03-06 23:53:10 +01:00
zadam
ca77211b38 improved template code with better heuristics on when to copy things from the template 2021-03-06 21:34:03 +01:00
zadam
4606e8d118 non-search notes should have no children limit, #1673 2021-03-06 20:31:12 +01:00
zadam
9f002fa802 change the heuristics to choose the best note path when ambiguous/incomplete/just noteId is provided, #1711 2021-03-06 20:23:29 +01:00
zadam
060d4fc27b fix duplication of hoisted note tree when hoisted note has clones 2021-03-04 23:19:27 +01:00
zadam
bf0fbe201e hack when hoisted note is cloned then it could be filtered multiple times while we want only 1 2021-03-03 23:00:16 +01:00
zadam
721e5da672 use notePath instead of noteId for note creation to correctly work with cloned ancestors 2021-03-03 22:48:06 +01:00
zadam
8192b51b8a cleanup of createTopLevelNote 2021-03-03 22:27:57 +01:00
zadam
73514a63d8 when resolving note path attempt to find one going through hoisted note 2021-03-03 21:49:57 +01:00
zadam
f8c310eb8f added license mention into the README noting AGPL v3+, #1708 2021-03-03 21:41:44 +01:00
zadam
b9422b0efd cssClass is now added also to link map and relation map, closes #1702 2021-03-02 23:20:53 +01:00
zadam
14ced949a9 fix modifying index in note cache when deleting attribute, closes #1706 2021-03-02 23:10:42 +01:00
zadam
5b5c2a2dbb fix null utcDateChanged in entity_changes, closes #1705 2021-03-02 22:08:29 +01:00
zadam
2c958eaacb Merge branch 'sort-by' 2021-02-28 23:40:37 +01:00
zadam
4aa27b6033 added "sort by" dialog 2021-02-28 23:40:15 +01:00
zadam
89a0c5a1c9 fix "no data" when switching between tabs with different hoisted notes, closes #1699 2021-02-28 19:46:04 +01:00
zadam
78e48095e6 prompt user when there are unsaved changes, #1692 2021-02-27 23:39:02 +01:00
zadam
02016ed031 fix create full search note 2021-02-27 21:19:54 +01:00
zadam
cb91dadeca add possibility to define search home for hoisted notes, #1694 2021-02-27 21:18:10 +01:00
zadam
2c755bcc38 don't fail (immediatelly) when sql insert doesn't return lastInsertRowid, #1665 2021-02-27 21:09:13 +01:00
zadam
3c7a6bc1e4 use longer update interval for web 2021-02-27 21:08:27 +01:00
zadam
3fe87259e2 if search note would end up outside of current hoisting, save it under the hoisted note, closes #1694 2021-02-26 23:33:22 +01:00
zadam
d476dfc53b fix searching the second time in quick search, #1694 2021-02-26 23:20:49 +01:00
zadam
19821b634f release 0.46.2-beta 2021-02-25 22:41:35 +01:00
zadam
cde41b268e allow copying type, mime, content from template only for text and code note types, fixes #1689 2021-02-25 22:33:26 +01:00
zadam
1c59bc4d3c sort child notes by ... WIP 2021-02-25 22:26:46 +01:00
zadam
cb6d35236c update correctly "multi-parent" node status, fixes #1688 2021-02-25 21:16:21 +01:00
zadam
7572ee284b set search note title correctly during creation 2021-02-25 20:02:49 +01:00
zadam
d0eaf623a8 activate node after calling "scroll to active note", fixes #1685 2021-02-24 22:41:24 +01:00
zadam
25c2db6c3a sort parent relationships so that clones in search notes appear last, fixes #1686 2021-02-24 22:38:26 +01:00
zadam
5a173ff14e quick search now allows clicking anywhere 2021-02-24 22:19:09 +01:00
zadam
7fab75b085 Merge remote-tracking branch 'origin/master' 2021-02-23 22:01:10 +01:00
zadam
0f065536d0 use 100 children limit on only search notes (as was initially intended), fixes #1673 2021-02-23 22:01:02 +01:00
sigaloid
d0747abded no h1 headings (#1679)
#1552
2021-02-23 21:23:23 +01:00
Mirwaisse Djanbaz
f62b4a581e Typo in export.js (#1682) 2021-02-23 21:20:19 +01:00
Mirwaisse Djanbaz
dcf1c62ec1 Typo in appearance settings (#1683) 2021-02-23 21:19:57 +01:00
zadam
93d55b3e7b put back waiting for sync after frontend API backend request 2021-02-22 22:43:54 +01:00
zadam
90c6852423 hide auto links by default in relation map, allow configuring displayed relations, fixes #1674 2021-02-22 22:34:33 +01:00
zadam
208baa56e9 error handling 2021-02-22 21:59:37 +01:00
zadam
ddf8438b22 fix edited notes widget note transitions, fixes #1672 2021-02-21 22:45:32 +01:00
zadam
6008dc891f fix note activation right after creation from calendar 2021-02-21 21:54:16 +01:00
zadam
cc887a00f2 runOnBackend now does not automatically wait for the maxSyncId since it can easily result in infinite cycle 2021-02-21 21:28:00 +01:00
zadam
fbbd51d0b1 small changes for better debugging infos 2021-02-20 23:17:29 +01:00
zadam
081b8b126a fix note_reordering not updating note cache 2021-02-20 21:28:22 +01:00
zadam
7a6bb81345 display note path in search results 2021-02-20 20:10:45 +01:00
zadam
1d5714c411 release 0.46.1-beta 2021-02-19 23:15:18 +01:00
zadam
56506d33a7 small fixes 2021-02-19 22:58:53 +01:00
zadam
c94fb7a62d created a specific widget for search result to add "no results" message 2021-02-19 22:15:56 +01:00
zadam
4160da70be implemented "targetRelationCount" and exposed more of them in order by widget, fixes #1658 2021-02-19 20:42:34 +01:00
zadam
2cfd093cae allow search result to be moved from tree to relation map, fixes #1650 2021-02-18 22:30:55 +01:00
zadam
859465841d add possibility to debug search queries by logging expression tree, #1655 2021-02-18 22:10:49 +01:00
zadam
0c9a11db6f bring back "create and link note" into more places, fixes #1653 2021-02-18 20:10:44 +01:00
zadam
4cbf9c2e86 show "reset to default icon" button only when there is an explicit icon 2021-02-18 20:06:14 +01:00
zadam
1f7997eeed added "reset to default icon" button to icon picker 2021-02-18 19:33:12 +01:00
zadam
8e730c6ecf add frontend API method openTabWithNote, #1645 2021-02-17 23:55:51 +01:00
zadam
600a312b2a fix parsing of "!=" operator, #1651 2021-02-17 23:41:15 +01:00
zadam
ec2e973165 allow only valid attr name characters for relation map relations, closes #1649 2021-02-17 23:22:14 +01:00
zadam
faeb55bc90 don't allow to bring up delete dialog on saved search results (consistency with context menu) 2021-02-17 23:03:34 +01:00
zadam
23ebe360a6 small fixes 2021-02-17 20:59:44 +01:00
zadam
d905335935 correct placement of imported root note (at the end) 2021-02-16 23:38:05 +01:00
zadam
f49f510459 fixes in "other notes with relation..." 2021-02-16 23:07:40 +01:00
zadam
e78b495bd3 reduce flickering of import by disabling entityChanges notification of frontend 2021-02-16 22:51:00 +01:00
zadam
5542c9dc57 fixed saved note migration - need to be migrated as last, #1647 2021-02-16 21:40:17 +01:00
zadam
2388da7cfb fixed "show in full search" click and keyboard shortcuts for collapse tree and scroll to active note actions, #1647 2021-02-16 21:19:07 +01:00
zadam
3b4fa0c5fc update section container on attribute change, closes #1646 2021-02-16 20:58:17 +01:00
zadam
1af98056bb release 0.46.0-beta 2021-02-15 22:29:35 +01:00
zadam
c0edcc1bfe split icon list data into separate file 2021-02-15 22:18:37 +01:00
zadam
597e595c32 filtering for the icon picker 2021-02-15 22:11:38 +01:00
zadam
e212a37c84 fixes for SQL console 2021-02-15 20:44:55 +01:00
zadam
c41448f5da consistency check for wrong lastSyncedPush 2021-02-15 20:44:31 +01:00
zadam
aab49946f8 prototype of note icon picker 2021-02-14 23:27:28 +01:00
zadam
cc4d04416b added "delete note revisions" search action 2021-02-14 21:35:13 +01:00
zadam
66c5606d46 implemented "rawContent", #1637 2021-02-14 19:27:31 +01:00
zadam
50bcf45113 fixed "duplicate subtree" creating extra entities in case subtrees contains multiple clones 2021-02-14 12:14:33 +01:00
zadam
08cba1e1ce fixed "duplicate subtree" 2021-02-14 11:43:31 +01:00
zadam
f528799fed added "limit" search modifier to search definition 2021-02-13 23:52:52 +01:00
zadam
a78c8ddad7 small search help improvements 2021-02-13 23:38:31 +01:00
zadam
3cc93157bf basic support for audio/video preview in file notes (no seeking) 2021-02-13 23:20:22 +01:00
zadam
3dbd80d5a6 relocated note paths widget into note title row 2021-02-13 22:47:06 +01:00
zadam
076b4a6651 small tweaks 2021-02-13 21:52:31 +01:00
zadam
378987e61c added icon to note title row 2021-02-13 20:07:08 +01:00
zadam
5eb850bf59 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	src/services/search/services/search.js
2021-02-13 12:27:10 +01:00
zadam
4914160590 fix correct application of <small> tag, closes #1635 2021-02-13 12:23:50 +01:00
zadam
00c106aba6 fix update of value from autocomplete, #1557 2021-02-13 12:11:58 +01:00
zadam
5e6d2c8336 db migration fix 2021-02-12 23:52:16 +01:00
zadam
d45a59aa4e sync fixes 2021-02-12 23:30:11 +01:00
zadam
9f19cf8046 don't sync recent_notes 2021-02-12 22:39:38 +01:00
zadam
c0dfd23191 fix merge conflict 2021-02-11 23:08:37 +01:00
zadam
b9539117d8 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	src/services/auth.js
#	src/services/setup.js
2021-02-11 23:07:20 +01:00
zadam
d616a77d6b release 0.45.10 2021-02-11 23:05:48 +01:00
zadam
5b679930de revert accidentally committed auth changes, #1629 2021-02-11 23:04:42 +01:00
zadam
3d7beefad0 sync fixes 2021-02-11 22:50:32 +01:00
zadam
8850de51f5 sync fixes 2021-02-10 22:56:23 +01:00
zadam
18b13657fd don't compare hashes of note_reordering entity_changes 2021-02-09 23:27:09 +01:00
zadam
43ac712fca fix searchForNotes API method to look for archived notes as well 2021-02-09 22:32:25 +01:00
zadam
bf231d31a2 fancytree 2.38.0 2021-02-09 21:33:55 +01:00
zadam
7dd19c0366 correct reloading of note subtree when relevant labels change 2021-02-09 20:26:10 +01:00
zadam
0040334e89 fix infinite cycle when template is descendant of an instance 2021-02-09 20:15:14 +01:00
zadam
96a5cb23f3 Merge remote-tracking branch 'origin/stable' 2021-02-08 21:16:14 +01:00
zadam
067ca9ab16 fallback for incorrectly parsed pane widths, #1621 2021-02-08 20:51:38 +01:00
zadam
be65e2e62f fixed custom header authentication 2021-02-07 21:50:34 +01:00
zadam
bed7bdfd00 "move to new window" respects note hoisting of original tab 2021-02-07 21:27:09 +01:00
zadam
cd5be59413 tab row is detecting workspace changes 2021-02-07 20:55:49 +01:00
zadam
2a67d9eae2 added unhoist button to the tree node + onclick fixes 2021-02-06 19:58:12 +01:00
zadam
0f05d6258e small fixes 2021-02-05 23:19:43 +01:00
zadam
45516fa7b4 Merge remote-tracking branch 'origin/stable' 2021-02-05 22:54:50 +01:00
zadam
70708b36ef using custom header for sync authorization to avoid tripping security proxies 2021-02-05 21:59:56 +01:00
zadam
fb3d5f25ac release 0.45.9 2021-02-05 21:38:32 +01:00
zadam
397f0d1326 fix collapse tree 2021-02-04 23:08:16 +01:00
zadam
6469937393 fix note tree flickering (note cache was not updated when expanded status changed) 2021-02-04 22:05:32 +01:00
zadam
48cb4d2ab9 one line overflow for note properties 2021-02-02 23:36:27 +01:00
zadam
3a94b04ef4 quick search impl finished 2021-02-01 23:51:04 +01:00
zadam
d406df48a8 edited notes doesn't wrap long note titles 2021-02-01 20:55:35 +01:00
zadam
9447d3f9b5 quick search widget WIP 2021-01-31 22:45:45 +01:00
zadam
2ac78c2e03 global menu does not need "menu" title 2021-01-31 20:36:30 +01:00
zadam
17073096cf disable property widgets if not applicable 2021-01-31 20:07:56 +01:00
zadam
6068bd7c44 added note properties widget 2021-01-31 12:15:36 +01:00
zadam
56a35b85a6 Merge remote-tracking branch 'origin/stable' 2021-01-30 22:49:19 +01:00
zadam
9d7d79ef94 avoid errors from missing note cache during startup 2021-01-30 22:25:40 +01:00
zadam
eb1a6b78ff updated schema 2021-01-30 22:17:29 +01:00
zadam
60d000b9cb VACUUM for migration 2021-01-30 22:12:38 +01:00
zadam
61ddd8afc6 small fixes to migration scripts 2021-01-30 22:00:09 +01:00
zadam
69bdcdd74a changed sidebar widget expanders to be consistent with tree expanders 2021-01-30 21:28:10 +01:00
zadam
17c6f53397 fix "twitching" tree nodes on hover 2021-01-30 21:03:39 +01:00
zadam
1c51419db5 image properties converted to collapsible section container 2021-01-30 20:21:44 +01:00
zadam
1ba1f28006 let's try "display: flex" fix for the include note positioning bug, #1590 2021-01-30 20:07:56 +01:00
zadam
6b306ac426 alert for missing file preview 2021-01-30 15:59:59 +01:00
zadam
ae26f22114 class moving 2021-01-30 15:50:46 +01:00
zadam
552d213817 file properties converted to collapsible section container 2021-01-30 15:47:24 +01:00
zadam
8fb7dd451e small fixes 2021-01-30 11:50:45 +01:00
zadam
01a82bed09 extra window layout updated to be consistent with main window 2021-01-29 23:36:33 +01:00
zadam
77bc5f9944 disabling tree expand animation to avoid "recursion" errors 2021-01-29 23:33:41 +01:00
zadam
6081c3540e refactoring 2021-01-29 22:44:59 +01:00
zadam
0a10764ed4 Merge remote-tracking branch 'origin/stable' 2021-01-29 21:19:48 +01:00
zadam
ba33a0d330 fix conflict between CKEditor build content style and externally provided content style (which are not needed when build CSS is available), #1590 2021-01-29 20:27:16 +01:00
zadam
aea81c9872 fix include note rendering over floating elements, #1590 2021-01-29 20:09:03 +01:00
zadam
8019e23ee4 note list displays correct paging 2021-01-28 23:29:10 +01:00
zadam
5eb9b8fe42 included notes are not displayed in children overview 2021-01-28 23:15:58 +01:00
zadam
d19a929237 removed auto book as it is no longer needed 2021-01-28 22:34:35 +01:00
zadam
67e0e0888e Merge remote-tracking branch 'origin/stable' 2021-01-28 22:17:46 +01:00
zadam
810fd9e819 fix glitches on drag & drop, fixes #1587 2021-01-28 21:19:01 +01:00
zadam
2dc742f5b8 don't recompress animated images, #1585 2021-01-28 20:17:57 +01:00
zadam
48b7108da0 add meta theme-color tag to mobile version, #1576 2021-01-27 20:58:20 +01:00
zadam
806ab22fa8 hide note paths dropdown on changed note, #1572 2021-01-27 20:44:58 +01:00
zadam
fbabdef272 added ancestor depth search criteria 2021-01-26 23:25:18 +01:00
zadam
a1f67e830d search script UI 2021-01-26 22:22:17 +01:00
zadam
ee78413ecb improvements to the search spec 2021-01-26 15:54:41 +01:00
zadam
b936a63db3 improvements to the search spec help button 2021-01-26 14:44:53 +01:00
zadam
80354d09fb search definition more fixed layout 2021-01-26 14:10:34 +01:00
zadam
87925f72a3 search definition action refactoring 2021-01-26 10:48:28 +01:00
zadam
898c941333 search definition refactoring 2021-01-26 10:42:55 +01:00
zadam
8b0a1e546d search fixes 2021-01-25 23:43:36 +01:00
zadam
ec351137d4 search definition refactoring 2021-01-25 21:24:02 +01:00
zadam
cf5127dcec split up search definition options to more classes 2021-01-24 22:30:53 +01:00
zadam
345de752d1 Merge remote-tracking branch 'origin/stable' 2021-01-23 21:53:21 +01:00
zadam
9c2b98915e fix glitch in switching between different types of notes 2021-01-23 21:52:39 +01:00
zadam
7b0fd639f6 improved heuristic of displaing attributes in note list and tooltips #1558 2021-01-23 21:41:02 +01:00
zadam
6408a47a8a Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	src/services/note_cache/entities/note.js
2021-01-23 21:09:47 +01:00
zadam
f2ca9276d6 fix/improve behavior of "sorted" attribute 2021-01-23 21:00:59 +01:00
zadam
872e81fe1f search now supports searching / ordering by note size 2021-01-22 22:20:17 +01:00
zadam
480aec1667 size calculation is always on demand 2021-01-22 15:16:08 +01:00
zadam
35ea877c7d Merge remote-tracking branch 'origin/stable' 2021-01-21 22:06:17 +01:00
zadam
41ca4b8d2e fix relation map view 2021-01-21 22:05:56 +01:00
zadam
8375a1b5ab optimize usage of note path and attributes in the note tooltip, #1558 2021-01-21 21:48:06 +01:00
zadam
48b697f408 select attr name in attr detail dialog did not trigger update, closes #1557 2021-01-21 20:18:33 +01:00
zadam
c33d496cf3 note info widget provides basic info on note (and subtree) size 2021-01-21 20:02:40 +01:00
zadam
200982655f WIP for counting note and subtree size 2021-01-20 22:17:40 +01:00
zadam
d67e1552ee more impl for search actions 2021-01-20 21:45:30 +01:00
zadam
ce09e4a1eb basic backend implementation of search actions 2021-01-20 20:31:24 +01:00
zadam
7bf6ec3ff2 bootstrap 4.6.0 2021-01-19 22:28:43 +01:00
zadam
1f923403de UI for search actions (WIP) 2021-01-19 22:10:24 +01:00
zadam
cb2361e9c4 Merge remote-tracking branch 'origin/master' 2021-01-19 19:45:57 +01:00
zadam
d7e46263be UI fixes to search definition + backend support 2021-01-18 22:52:07 +01:00
王登辉
138903cf28 fix config.ini Network host not work (#1546) 2021-01-18 17:46:48 +01:00
zadam
3fa2535862 basic interactivity of search definition actions 2021-01-17 23:01:01 +01:00
zadam
5bb490e1ff basic interactivity of search definition 2021-01-17 21:11:01 +01:00
zadam
f2e44e5617 fix tree's enhanced item buttons 2021-01-15 23:05:19 +01:00
zadam
58a93f748b Merge remote-tracking branch 'origin/stable' 2021-01-15 22:23:56 +01:00
zadam
e1e185e5db added "safe mode" environment variable switch which disables startup scripts and resets tabs 2021-01-15 20:12:14 +01:00
zadam
199b49c1f7 fix partial syncs 2021-01-14 23:22:13 +01:00
zadam
cbc1f63732 Merge remote-tracking branch 'origin/stable' 2021-01-14 21:53:05 +01:00
zadam
3f2e8717b3 sanitize also clipper content, #1532 2021-01-14 21:52:44 +01:00
zadam
e06c5703ee config value to disable backups, closes #1533 2021-01-12 21:50:05 +01:00
zadam
cd858a73c1 Merge remote-tracking branch 'origin/stable' 2021-01-11 22:49:08 +01:00
zadam
69353f12b5 partial sync requests WIP 2021-01-11 22:48:51 +01:00
zadam
fe3bb2c5f6 release 0.45.8 2021-01-11 22:47:11 +01:00
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
7f8b19aee4 WIP partial sync requests 2021-01-10 21:56:40 +01:00
zadam
cd653b9f0c add link dialog should recognize external links, closes #1521 2021-01-08 21:44:43 +01:00
zadam
9fcd659df4 mock up of search definition changes 2021-01-08 19:57:49 +01:00
zadam
c08c4531db fix empty range items handling 2021-01-05 14:24:25 +01:00
zadam
f8bec35893 use selected text to apply filtering for add link dialog, closes #1515 2021-01-05 14:22:11 +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
7aadd57d2f search help dropdown button 2020-12-30 23:09:29 +01:00
zadam
02d9752abf refactoring of sql console into separate widgets 2020-12-29 22:27:31 +01:00
zadam
1d64129572 lazy loading of note list 2020-12-27 22:19:27 +01:00
zadam
e89057a771 search note content only if not excluded by other expressions 2020-12-25 20:46:04 +01:00
zadam
95760f1d28 don't display similar notes under search 2020-12-25 13:06:58 +01:00
zadam
75c3bd8ae3 Merge remote-tracking branch 'origin/stable' 2020-12-25 13:02:05 +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
479d6ba964 Merge remote-tracking branch 'origin/stable' 2020-12-25 12:56:34 +01:00
zadam
577dc95ab8 convert &nbsp; 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
9f472b353a simplified table stats 2020-12-23 21:22:41 +01:00
zadam
4c614aee90 note paths CSS tweaks 2020-12-23 21:03:01 +01:00
zadam
f17be0ef9b Merge remote-tracking branch 'origin/stable' 2020-12-22 22:38:37 +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
7dde78e98a Merge remote-tracking branch 'origin/stable' 2020-12-21 23:19:25 +01:00
zadam
bdfd760b9d fixed some encryption issues 2020-12-21 23:19:03 +01:00
zadam
8c0662ab82 fix displaying protected notes outside of protected session 2020-12-21 23:10:08 +01:00
zadam
cc3addebd4 date notes respect their parent's isProtected status, #1483 2020-12-21 23:00:39 +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
a1b2e22ba5 add possibility to add whole iso date as date pattern, #1496 2020-12-20 22:49:42 +01:00
zadam
f8936f3bc8 use trilium.sid as a session ID to avoid session ID conflicts 2020-12-20 22:20:21 +01:00
Steven Tang
015c9d2ccd rename session cookie from connect.sid to trilium (#1495)
to prevent collisions with other express-session apps
2020-12-20 22:18:57 +01:00
zadam
95ccfd2521 use bootstrap default monospace fonts for code notes, fixes #1489 2020-12-18 22:37:29 +01:00
zadam
6c15d299e0 isErased fixes 2020-12-18 22:35:40 +01:00
zadam
b093569ec5 increase toast size limit 2020-12-18 21:23:51 +01:00
zadam
f8089ba370 fixed saved search refresh 2020-12-17 21:19:52 +01:00
zadam
053162fef2 bootstrap 4.5.3 2020-12-17 15:20:20 +01:00
zadam
71bbf2eb16 close note type dropdown after click 2020-12-17 15:19:22 +01:00
zadam
f723433970 fix deleting notes 2020-12-17 15:04:04 +01:00
zadam
1cc7917b6e renamed remnants of "sync" to "entity_change" 2020-12-16 22:17:42 +01:00
zadam
cdc2721ac1 DB migration fixes 2020-12-16 20:58:43 +01:00
zadam
4a15127e58 removal of isErased from old entities 2020-12-16 15:05:36 +01:00
zadam
c5ec57e08e cleanup of isErased obsolete usage 2020-12-16 15:01:20 +01:00
zadam
d0578971f7 fix manual erasing note revisions 2020-12-16 14:36:24 +01:00
zadam
1b0bb22273 drop isDeleted index 2020-12-15 15:30:46 +01:00
zadam
bf653a9a5c ckeditor 24 content styles 2020-12-15 15:18:45 +01:00
zadam
5467dc62cd extra case sensitivity tests 2020-12-15 15:15:41 +01:00
zadam
96eff4c410 fixed search tests 2020-12-15 15:09:00 +01:00
zadam
3a12181a57 search fixes WIP 2020-12-14 23:59:05 +01:00
zadam
fccce2ff1e small fixes 2020-12-14 23:04:56 +01:00
zadam
c949dcb449 fixes and optimizations 2020-12-14 22:12:26 +01:00
zadam
8b99f065d5 fixes of recent entity changes 2020-12-14 14:17:51 +01:00
zadam
6d7b9e0db3 erasing rows of deleted entities 2020-12-14 13:58:02 +01:00
zadam
248fa780e8 erasing rows of deleted entities 2020-12-14 13:47:33 +01:00
zadam
20c7c657da moving isErased into entity_changes 2020-12-14 13:15:32 +01:00
zadam
0a896cc19c tree fixes 2020-12-13 23:27:42 +01:00
zadam
0bb548d0d1 ckeditor 24 2020-12-13 20:27:57 +01:00
zadam
de1584eab8 note list improvements 2020-12-13 20:13:57 +01:00
zadam
60e2026850 improved note list pager for many pages 2020-12-12 12:07:15 +01:00
zadam
5098dda376 load initial tree from note cache 2020-12-11 22:06:12 +01:00
zadam
35e47f866a fix root branch 2020-12-11 15:27:57 +01:00
zadam
199d89c1a6 optimizations and fixes 2020-12-11 15:24:44 +01:00
zadam
be543737a9 sorting search results occurences in the note title 2020-12-11 13:54:41 +01:00
zadam
0b6fa4ab06 Merge remote-tracking branch 'origin/optimize-tree' 2020-12-10 22:54:16 +01:00
zadam
8f1b2fa226 move entity hash to entity_changes table 2020-12-10 22:53:52 +01:00
zadam
5010175b84 adding few missing isErased = 0 conditions 2020-12-10 21:56:48 +01:00
zadam
0ac42608f7 faster tree loading of many notes at once #1480 2020-12-10 21:27:21 +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
7f3ef2cb8b move entity hash to entity_changes table WIP 2020-12-07 23:04:17 +01:00
zadam
1982d054ef inherit also note type and mime from template note, closes #1475 2020-12-07 09:35:39 +01:00
zadam
16c4b8aa43 added also "sqlConsoleHome" 2020-12-07 09:19:27 +01:00
zadam
e56979c482 add button to erase deleted notes now into the options 2020-12-06 22:11:49 +01:00
zadam
4078b32e9d fix "show in full text search" in jump to note dialog 2020-12-05 23:19:02 +01:00
zadam
90d33f56c3 implemented "search in subtree" 2020-12-05 23:00:28 +01:00
zadam
b0e5ab7533 smaller search improvements 2020-12-04 22:57:54 +01:00
zadam
526bd81b50 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	src/public/app/widgets/attribute_list.js
2020-12-04 22:09:27 +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
a1fb84f14d unification of tooltip and note list renderers 2020-12-03 22:54:24 +01:00
zadam
bc520edd19 fix usage of async .getHeaders() 2020-12-03 21:50:41 +01:00
zadam
5f4f0d3086 experimental markdown-like headings 2020-12-01 22:01:58 +01:00
zadam
a68c61b2f0 improvements to saved search 2020-11-30 23:20:12 +01:00
zadam
2a6978c349 added button for entering workspace 2020-11-29 22:32:31 +01:00
zadam
1c5425c9eb workaround for filter + create child problems 2020-11-29 20:55:24 +01:00
zadam
2338a13749 added "add child note" button to note tree 2020-11-27 23:13:48 +01:00
zadam
6df6fe03fa fix display of attr detail 2020-11-27 22:38:15 +01:00
zadam
e318acc977 fix incorrectly set isInheritable on inherited attrs 2020-11-27 22:33:33 +01:00
zadam
b0217ee04c added new "create note" button 2020-11-27 22:21:13 +01:00
zadam
2a54ce803e layout tweaks 2020-11-27 22:02:55 +01:00
zadam
642bf9d113 layout tweaks 2020-11-27 21:57:41 +01:00
zadam
31746e7baf Merge remote-tracking branch 'origin/master' 2020-11-27 20:40:40 +01:00
zadam
48b1703725 moved "global buttons" on the tree 2020-11-27 20:40:32 +01:00
baddate
72d6440de7 add chinese version README. (#1465) 2020-11-27 08:37:08 +01:00
zadam
eaed7ec86f improvements in search UI 2020-11-26 23:00:27 +01:00
zadam
02043d9109 note list is now separate widget which allows more flexibility in its usage 2020-11-25 23:18:30 +01:00
zadam
b9c0823abf added workspace icon and background color 2020-11-25 20:25:55 +01:00
zadam
61f30373d4 hoisting improvements 2020-11-24 23:24:05 +01:00
zadam
9889166afc Merge remote-tracking branch 'origin/stable' 2020-11-24 23:19:16 +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
35d5036aaa hoisting fixes 2020-11-24 22:32:22 +01:00
zadam
14f5b46ece Merge remote-tracking branch 'origin/stable' 2020-11-24 20:31:16 +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
ac636b6649 WIP per-tab hoisting 2020-11-23 23:11:21 +01:00
zadam
52b8162d01 WIP per-tab hoisting 2020-11-23 22:52:48 +01:00
zadam
167b6974fe Merge remote-tracking branch 'origin/stable' 2020-11-23 21:20:06 +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
4bd86a6dfa WIP per-tab hoisting 2020-11-22 23:05:02 +01:00
zadam
5bbec118e4 Merge remote-tracking branch 'origin/stable' 2020-11-22 22:48:26 +01:00
zadam
928ed7a034 add keyboard shortcut for include note, closes #1410 2020-11-22 22:44:06 +01:00
zadam
473229f03a Merge remote-tracking branch 'origin/stable' 2020-11-21 20:44:37 +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
af1fd5bd06 improvements to collapsible section container 2020-11-19 23:02:25 +01:00
zadam
c737a3adc9 Merge remote-tracking branch 'origin/stable' 2020-11-19 21:42:49 +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
8e2bf7795c Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	src/routes/api/attributes.js
#	src/routes/api/sender.js
2020-11-18 22:42:37 +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
ohdearaugustin
4fd9e7f14f Drop privileges (#1422) 2020-11-15 20:51:47 +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
7859aca006 Merge remote-tracking branch 'origin/stable' 2020-11-11 21:28:11 +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
1403acd808 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	src/public/app/services/note_content_renderer.js
2020-11-08 21:06:48 +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
Praxis | Darian
e258de329c Use user theme on mobile (#1374) 2020-11-02 20:53:43 +01:00
zadam
044bcf6f05 Merge remote-tracking branch 'origin/stable' 2020-11-01 21:25:38 +01:00
zadam
9e97fdcc49 convert H1 to H2 also during import 2020-11-01 20:38:39 +01:00
zadam
2c028f7c45 new CollapsibleSectionContainer WIP 2020-10-31 22:47:15 +01:00
zadam
435200ec5a new CollapsibleSectionContainer WIP 2020-10-30 22:57:26 +01:00
zadam
3d808d638a Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	package-lock.json
#	package.json
#	src/public/app/services/note_content_renderer.js
2020-10-30 15:40:57 +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
bb0ee0b36c expand all / collapse all will re-render list instead of doing that manually 2020-10-26 22:52:12 +01:00
zadam
5f20d033a8 release 0.45.1 2020-10-26 22:51:10 +01:00
zadam
b70ee742e8 Merge remote-tracking branch 'origin/math2'
# Conflicts:
#	package-lock.json
2020-10-26 21:44:18 +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
4281111344 initial integration of note list renderer into search results 2020-10-25 23:02:12 +01:00
zadam
37e111d8a9 trim content for grid view 2020-10-25 11:00:27 +01:00
zadam
4202af96c8 image scaling improvements 2020-10-25 00:12:07 +02:00
zadam
d0efd67d5e grid view improvements, remembering grid/list status 2020-10-24 23:50:32 +02:00
zadam
aeb6c34d27 note list rendering WIP 2020-10-24 00:02:38 +02:00
zadam
a3f4fc7762 fix case where parents of templates are not loaded 2020-10-24 00:02:10 +02:00
zadam
6517188b39 fix tree loading (partial revert of previous commit) 2020-10-24 00:00:24 +02:00
zadam
c4acecd510 fix loading unnecessary notes into the cache 2020-10-23 23:19:29 +02:00
zadam
c7d8bddf24 conversion of note list renderer to class 2020-10-23 22:11:39 +02:00
zadam
29c1d05540 frontend dayjs update 2020-10-23 21:24:16 +02:00
zadam
55f04436c0 saving expanded status as label 2020-10-23 00:11:44 +02:00
zadam
4ce2eaa919 note list paging 2020-10-22 23:50:52 +02:00
zadam
489e064932 expand/collapse all 2020-10-22 23:07:35 +02:00
zadam
1369603ed9 note list renderer WIP 2020-10-22 22:49:22 +02:00
zadam
79431d8b4b Merge remote-tracking branch 'origin/master'
# Conflicts:
#	package-lock.json
#	package.json
#	src/routes/api/sender.js
2020-10-21 23:23:55 +02:00
zadam
4591899df0 Merge branch 'math2'
# Conflicts:
#	package-lock.json
#	package.json
2020-10-21 23:23:19 +02: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
dfa7d3f186 Update README.md 2020-10-21 22:40:34 +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
Casey Doran
a7c13ceacc if the sender request contains a label and/or a labelValue, apply it (#1310) 2020-10-16 19:40:30 +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
b2b3c80192 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	package-lock.json
#	package.json
2020-10-15 20:47:10 +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
badb678b69 note list renderer improvements, still WIP 2020-10-08 23:46:48 +02:00
zadam
140f0a5dbd return null for not found attribute, closes #1294 2020-10-08 22:08:58 +02:00
zadam
5933b17b47 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	libraries/ckeditor/ckeditor.js.map
2020-10-07 23:29:10 +02:00
zadam
761912c3bd basic separation of note list renderer from book type 2020-10-07 23:08:17 +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
99f35b2588 Merge remote-tracking branch 'origin/stable' 2020-10-06 21:03:28 +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
FliegendeWurst
51eb9f18f7 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.
2020-10-02 21:12:13 +02:00
zadam
a0e4a416cd release 0.44.5 2020-10-01 23:45:09 +02:00
zadam
8f018cc7c6 as part of tree/note load make sure also relation targets are loaded, closes #1273 2020-10-01 23:42:09 +02:00
zadam
4a470ff9e5 right click on electron in editor will show both context menu and balloon toolbar, make z-index of context menu higher, #1281 2020-10-01 22:57:07 +02:00
zadam
4b8ca31091 Merge remote-tracking branch 'origin/stable' 2020-09-30 22:50:33 +02:00
zadam
03e4c49f89 updated API docs 2020-09-30 22:48:52 +02:00
zadam
4f92fbf8a5 updated API docs 2020-09-30 22:48:30 +02:00
zadam
dd020baee5 fix backend API's createNote(), closes #1275 2020-09-30 22:45:15 +02:00
zadam
cba9b92202 make sure the attribute is not duplicated in TreeCache and NoteCache, #1278 2020-09-30 22:34:18 +02:00
zadam
d163289003 fixed messed up highlighting when searching e.g. "a" 2020-09-27 23:11:56 +02:00
zadam
c45f590e9f put edit link balloon below z-index of dialogs, closes #1272 2020-09-27 23:03:05 +02:00
zadam
fbb36d652f external links are not opened on click 2020-09-27 23:02:21 +02:00
zadam
2706f1b02f Merge remote-tracking branch 'origin/stable' 2020-09-26 23:28:50 +02:00
zadam
8f68b4f298 make migration more robust, fixes #1271 2020-09-26 23:25:35 +02:00
zadam
6710476768 new saved search UI wip 2020-09-25 23:52:24 +02:00
zadam
de30095737 change salts on password change + more robust handling of decryption failures 2020-09-25 20:55:45 +02:00
zadam
9de51c8b9e release 0.44.4 2020-09-24 23:33:36 +02:00
zadam
748979eafd fix note.text #1263 2020-09-24 23:13:27 +02:00
zadam
8ad7318bd8 use correct search expression for "search in subtree", #1263 2020-09-24 22:42:32 +02:00
zadam
e2fcc6711a style tweak of sidebar headers 2020-09-24 21:58:00 +02:00
zadam
5f6dd18489 added migration to fix notePosition to always step in 10 increments 2020-09-23 23:08:58 +02:00
zadam
a577485e42 allow duplicating multiple notes at once, closes #1259 2020-09-23 22:45:51 +02:00
zadam
1fcb99fa60 fix duplication of search results when conforming to multiple expressions in OR relation, closes #1262 2020-09-23 22:27:19 +02:00
zadam
bdebb35f62 better error reporting on failed search 2020-09-23 22:18:26 +02:00
zadam
2b1383205b test fixes 2020-09-23 21:05:26 +02:00
zadam
995f4f2582 similarity takes into account also headings in the base note plus additional fixes 2020-09-22 23:10:01 +02:00
zadam
15796b6870 fix attr detail positioning 2020-09-21 23:27:22 +02:00
zadam
12943ca151 fix removing attrs from UI 2020-09-21 23:08:39 +02:00
zadam
0e795b2978 create note inline, #1237 2020-09-21 22:08:54 +02:00
zadam
0eef18a799 create note inline 2020-09-21 00:07:46 +02:00
zadam
6518d113c6 fix highlighting in some mime types 2020-09-20 23:33:11 +02:00
zadam
ea524403f7 fix position of Edit button in read only code 2020-09-20 22:19:32 +02:00
zadam
1d5a53fee6 load simple mode by default, fixes #1256 2020-09-20 21:42:51 +02:00
zadam
395eb92d93 cleanup of unnecessary codemirror mode files 2020-09-20 21:42:15 +02:00
zadam
71323500b7 updated codemirror to 5.57.0 2020-09-20 21:41:40 +02:00
zadam
7f9bcc162e release 0.44.3-beta 2020-09-19 23:45:46 +02:00
zadam
27052143ab fix placement of "Edit" button on read only notes 2020-09-19 23:44:30 +02:00
zadam
50d3ddbed5 added remove formatting plugin, closes #1239 2020-09-19 23:43:50 +02:00
zadam
7ee50113d7 fix export root note 2020-09-19 22:47:14 +02:00
zadam
07bd5129ca similarity tweaks 2020-09-19 21:59:01 +02:00
zadam
ec7021b436 added debugModeEnabled option 2020-09-18 23:22:28 +02:00
zadam
c75439a4b5 similarity tweaks 2020-09-18 21:47:59 +02:00
zadam
d21cb78baa fix wrong dateLastEdited timestamp, closes #1254 2020-09-18 21:47:15 +02:00
zadam
c371873b7e support unicode in button names, closes #1250 2020-09-17 14:41:00 +02:00
zadam
6220b02ef0 similarity tweaks 2020-09-17 14:34:10 +02:00
zadam
4e15bc0bb1 similarity tweaks 2020-09-17 09:33:43 +02:00
zadam
2f720df9d2 migration to convert H1 to H2, #1240 2020-09-16 20:51:57 +02:00
zadam
d57a303251 fix in ENEX import 2020-09-16 20:32:20 +02:00
zadam
13b9f5231c similar note tweaks 2020-09-16 17:34:48 +02:00
zadam
71ed24344c performance optimizations in similar notes 2020-09-16 14:23:59 +02:00
zadam
0c8a2a23a7 refactor similarity logic 2020-09-16 11:50:47 +02:00
zadam
5738f2a5b3 similar notes tweaks 2020-09-16 11:24:29 +02:00
zadam
d345c4850f custom implementation of similar notes algorithm 2020-09-15 22:46:51 +02:00
zadam
eeacd8118f similar notes changes 2020-09-15 16:46:03 +02:00
zadam
f5216e4799 close note type dropdown after click 2020-09-15 00:13:25 +02:00
zadam
85d13b1d62 resort relationships in tree cache after note reordering 2020-09-14 22:48:20 +02:00
zadam
f5f48ef6c4 copy child: attrs also when defined on a template/parent note 2020-09-14 21:08:11 +02:00
zadam
f1ed114167 small blink on attr save as a visual hint 2020-09-14 21:07:00 +02:00
zadam
70995a7691 fix broken saved search, closes #1234 2020-09-14 20:00:36 +02:00
zadam
a82b8cdb37 release 0.44.2-beta 2020-09-13 23:03:28 +02:00
zadam
33511c0c10 fix hiding similar notes widget by label 2020-09-13 22:47:23 +02:00
zadam
04c93d6736 fix attr detail related notes 2020-09-13 22:23:03 +02:00
zadam
5e11806110 sidebar widgets can be now disabled with labels 2020-09-13 21:59:31 +02:00
zadam
1e1709ca6a mobile layout fixes + fix mobile delete note 2020-09-13 21:12:22 +02:00
zadam
37602cfcae small tweaks 2020-09-13 00:19:50 +02:00
zadam
0ca0996751 no difference in styling when active tree node is in focus or not because focused class is unreliable 2020-09-12 23:06:03 +02:00
zadam
63ebb46049 fix inverse relation detection in relation maps 2020-09-12 22:21:44 +02:00
zadam
847766b434 fancytree 2.37.0 2020-09-12 21:25:47 +02:00
zadam
056c40c0d0 similar notes algorithm tweaks (WIP) 2020-09-10 21:01:46 +02:00
zadam
bff5b015ea wrap note autocomplete for very long note path titles, closes #1221 2020-09-09 20:49:44 +02:00
zadam
ee4ce3ffd8 display unhoist button on the left of the note title so that it's always visible, #1223 2020-09-08 23:25:21 +02:00
zadam
a73733d0fc renamed ParsingContext to SearchContext 2020-09-08 21:47:37 +02:00
zadam
0c5f842626 improvements to note tooltip - include (some) notePath and attributes 2020-09-08 21:45:07 +02:00
zadam
8b4cf474bd cleanup/fixes of label/relation definition usages in the old style 2020-09-08 20:42:50 +02:00
zadam
80f269d844 moved similar notes from sidebar to the center pane 2020-09-07 23:35:41 +02:00
zadam
75c9db6432 fixed search API and its default settings to include archived notes 2020-09-07 22:11:16 +02:00
zadam
69e36d2677 refactoring for archived notes handling in note cache 2020-09-07 00:05:01 +02:00
zadam
eb4d86f41d changed presentation of similar notes to "tag cloud" style 2020-09-06 22:48:52 +02:00
zadam
b0bf88c487 fix storing dateLastEdited timestamp in note revisions 2020-09-06 22:04:11 +02:00
zadam
032ffa8367 fix printing port to console #1219 2020-09-06 20:58:26 +02:00
zadam
7400c91a4f missing space in inherited attribute list, fixes #1217 2020-09-06 20:53:59 +02:00
zadam
fbdf089d5d release 0.44.1-beta 2020-09-05 23:43:06 +02:00
zadam
a7505682ed more compact note revisions widget 2020-09-05 23:35:24 +02:00
zadam
b148f3d032 more compact note info widget 2020-09-05 22:49:30 +02:00
zadam
874972a3d3 fix broken what links here widget 2020-09-05 22:45:26 +02:00
zadam
6d095b7250 fix popups/tooltips not disappearing after loading new note, closes #1214 2020-09-05 21:51:00 +02:00
zadam
ceb762e56b fix zen mode with attributes, closes #1213 2020-09-04 23:35:10 +02:00
zadam
0c72d29684 fix zen mode with attributes, closes #1213 2020-09-04 22:54:50 +02:00
zadam
29efe3a492 fix showing a search box, closes #1212 2020-09-04 21:10:54 +02:00
zadam
5bdfb6e11f release 0.44.0-beta 2020-09-03 23:26:51 +02:00
zadam
11c63b7778 remove test as build step 2020-09-03 23:26:36 +02:00
zadam
befec48506 release 0.44.0-bet 2020-09-03 23:25:23 +02:00
zadam
15d94e91db fix note autocomplete for non-recent notes 2020-09-03 22:37:51 +02:00
zadam
7787fa1758 small promoted attrs style tweaks 2020-09-03 22:22:21 +02:00
zadam
0bd9b849b2 fix problems with updating note in note cache when entities are coming out of order (e.g. sync) 2020-09-03 21:37:06 +02:00
zadam
918e827d91 fix potential null in mime or type in note cache 2020-09-03 17:51:37 +02:00
zadam
42ecc0e15b use just note title in note autocomplete input field 2020-09-03 17:38:11 +02:00
zadam
a37fa0cb3f don't use &nbsp; for attributes since it (duh) prevents line breaking in case of inherited attributes 2020-09-02 23:16:56 +02:00
zadam
647863b489 escape will close the attribute dialog and cancel changes 2020-09-02 16:40:19 +02:00
zadam
e8114fcc4f fixes in attr detail positioning 2020-09-02 16:06:35 +02:00
zadam
0745d9ec0b fix attr help tooltip appearing only the second time 2020-09-01 23:47:56 +02:00
zadam
5e75d2380a fix error after confirming mention relation name 2020-09-01 23:43:09 +02:00
zadam
32c88c7481 keyboard shortcuts for focusing the attributes, adding a new label and relation 2020-09-01 23:18:28 +02:00
zadam
0aef99b98e attr detail automatically focuses the name input and allows saving with ctrl+enter. 2020-09-01 22:47:36 +02:00
zadam
bf548f9d38 fix Jump To search input restoration 2020-09-01 00:05:19 +02:00
zadam
a15f8d7e11 small fixes 2020-08-31 23:13:39 +02:00
zadam
574b71de63 remember last search in Jump To dialog when searching soon after the previous search 2020-08-31 21:00:23 +02:00
zadam
408ed8dbf0 fix "search in fulltext" button on "jump to note" dialog. 2020-08-31 20:46:55 +02:00
zadam
98f1bc51a5 Merge remote-tracking branch 'origin/stable' 2020-08-30 23:53:24 +02:00
zadam
f3efb22a50 extra search tests 2020-08-30 23:42:24 +02:00
zadam
5fd58def11 small refactorings 2020-08-30 23:19:55 +02:00
zadam
b793f8cb88 search will also look for type and mime by default 2020-08-30 23:12:49 +02:00
zadam
058edcfe15 fixed promoted attribute display 2020-08-30 22:39:15 +02:00
zadam
5d500de527 performance monitoring on frontend in dev environment 2020-08-30 22:29:38 +02:00
zadam
81207f3d27 updated demo document with scripts adjusted to syncified DB access 2020-08-29 23:33:15 +02:00
zadam
21575d862b attempt to fix consistency issue bug which caused synced note_contents to have NULL content when original is empty string 2020-08-29 23:08:53 +02:00
zadam
9359f05335 fix "edited notes on a day" for deleted notes 2020-08-29 22:22:24 +02:00
zadam
7fb22d41a0 allow disabling authentication for server version, closes #1132 2020-08-29 00:11:50 +02:00
zadam
2823bf3488 disable toggling navigation buttons because of rare performance issues 2020-08-28 23:49:24 +02:00
zadam
172f3689fa optimization of search 2020-08-28 23:20:22 +02:00
zadam
5a8c3f6a2b removed forgotten console.logs 2020-08-28 22:52:57 +02:00
zadam
416b7088c5 fix update/delete queries in SQL console 2020-08-28 22:04:35 +02:00
zadam
3f69a3c572 fix parsing attributes with non-breakable space 2020-08-28 16:00:30 +02:00
zadam
268910ed3b fix positioning of attr detail popup for smaller windows 2020-08-28 15:38:04 +02:00
zadam
8259b4a32c close down dropdown menus on click + smaller tweaks 2020-08-28 14:52:38 +02:00
zadam
9873dd1242 fix creating new note 2020-08-28 14:29:20 +02:00
zadam
f4266754d8 release 0.43.4 2020-08-27 23:58:58 +02:00
zadam
30e84321f9 fixes to build 2020-08-27 23:54:02 +02:00
zadam
020a8766c8 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	src/public/app/widgets/note_tree.js
2020-08-27 23:25:10 +02:00
zadam
dc288fb18c Merge remote-tracking branch 'origin/stable' into stable 2020-08-27 23:22:58 +02:00
zadam
26dfa1ffdb activate PDF preview also in server build, fixes #1208 2020-08-27 23:22:36 +02:00
zadam
d4e1900f89 cleanup of useless files when building release artifacts 2020-08-27 23:04:00 +02:00
zadam
4cd1a0ee7d fix note cache for out of order synced entities 2020-08-27 22:37:57 +02:00
zadam
355780c595 sync fixes 2020-08-27 22:11:17 +02:00
zadam
ef996f3919 bug fixes 2020-08-27 22:03:56 +02:00
zadam
445902d081 ckeditor 22 2020-08-27 15:24:23 +02:00
zadam
31d85ed8cc fixes and tweaks - readonly bar is smaller and on the right 2020-08-27 14:54:56 +02:00
zadam
c8af250caa Merge remote-tracking branch 'origin/master' 2020-08-27 12:47:29 +02:00
zadam
b7b13c1d8b make migration more robust for cases where attribute definitions don't contain valid values, closes #1207 2020-08-27 12:44:49 +02:00
zadam
b05b9196a0 fix build with better-sqlite3 binaries 2020-08-26 23:51:30 +02:00
zadam
fbe3995398 fixed tree hotkeys 2020-08-26 22:12:01 +02:00
zadam
6aa61ca306 initializing note tree synchronously 2020-08-26 16:50:16 +02:00
zadam
87161cfe0d fix issues with note tree 2020-08-25 23:25:15 +02:00
zadam
6a3e27eb62 smaller refactorings in note_tree 2020-08-24 23:33:27 +02:00
zadam
b7947a40ea binaries for better-sqlite3, downgrage to electron 9 since build on windows doesn't for 2020-08-24 20:26:52 +02:00
zadam
1d813c82e4 display attribute help on the attr detail during editing 2020-08-23 23:38:05 +02:00
zadam
46e373e822 "smart" date values can now freely contain whitespaces 2020-08-23 21:53:50 +02:00
zadam
a6c79c934c fix global menu button and extra window 2020-08-22 23:07:52 +02:00
zadam
08c612c876 fixed builds for linux desktop 2020-08-22 23:07:31 +02:00
zadam
ed6181a85e added in-editor help for editing attributes 2020-08-21 23:08:53 +02:00
zadam
0533b95562 Merge remote-tracking branch 'origin/master' 2020-08-20 23:15:45 +02:00
zadam
5b4826fd08 extra tests for escaping 2020-08-20 23:15:38 +02:00
zadam
60e213433b Merge remote-tracking branch 'origin/stable' 2020-08-20 15:45:57 +02:00
zadam
153de63f4d update note title in link map when note is renamed 2020-08-20 15:45:33 +02:00
zadam
4d4d9f2000 small fixes to saved search 2020-08-20 15:28:28 +02:00
zadam
0b38e24185 fixes to saved search 2020-08-20 15:23:24 +02:00
zadam
d037420acb note. prefix also separates fulltext tokens from expression tokens 2020-08-20 13:53:15 +02:00
zadam
20b4b059e3 fix jsdoc 2020-08-20 12:00:57 +02:00
zadam
28ebca1268 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	package-lock.json
#	package.json
#	src/services/image.js
2020-08-20 11:56:03 +02:00
zadam
a89629b3de add fallback when resizing image fails, closes #1190 2020-08-20 11:34:14 +02:00
zadam
eec850c11f fix toggle sidebar issues, closes #1196 2020-08-20 11:14:27 +02:00
zadam
52e0f838a9 fulltext now ignores archived notes like it used to in the old implementation 2020-08-20 00:15:08 +02:00
zadam
d1f70efdb4 Merge remote-tracking branch 'origin/master' 2020-08-19 23:01:00 +02:00
zadam
5b1e229d7d added note.text + tests 2020-08-19 23:00:51 +02:00
zadam
5c55278c59 attr detail small visual tweaks 2020-08-19 18:05:07 +02:00
zadam
3c224e80ee fix opening links in attr detail 2020-08-19 17:59:55 +02:00
zadam
5741b380f0 fixed script support 2020-08-18 23:32:50 +02:00
zadam
7335844ae3 updated DB schmea 2020-08-18 22:37:23 +02:00
zadam
53c361945b fix setting mime after import + cleanup of old search code 2020-08-18 22:20:47 +02:00
zadam
03d7ee9abb compatibility with existing scripts 2020-08-18 21:32:45 +02:00
zadam
3670fbff49 frontend validation of attribute name + other changes and fixes 2020-08-17 23:54:18 +02:00
zadam
f24e27dadd autocollapse notes after period of inactivity + some other changes, #1192 2020-08-17 20:58:34 +02:00
zadam
53b39e2e82 many changes related to #1192:
- use CSS contain wherever possible to reduce subtrees of forced reflows
- reduced dependency between note and note_contents updates which will reduce number of updates to components
- optimization of "many rows" querying
2020-08-16 22:57:48 +02:00
zadam
c20577909c simplified and more consistent link handling, also fixes #1191 2020-08-15 22:30:40 +02:00
zadam
a87b710626 attribute fixes 2020-08-15 21:24:17 +02:00
zadam
625483a8f2 fixes 2020-08-15 00:06:26 +02:00
zadam
121c819b79 fix sizing of toast since bootstrap 4.5.1 2020-08-14 23:53:37 +02:00
zadam
77a3bdce1f related notes get updated as user types in the attr detail dialog 2020-08-14 23:00:15 +02:00
zadam
827f8b42a0 Merge remote-tracking branch 'origin/stable' 2020-08-14 22:34:17 +02:00
zadam
b815e10ff3 add running tests into the build process 2020-08-14 22:30:01 +02:00
zadam
c2789bf355 use relative paths for fonts in steel blue in demo document, closes #1187 2020-08-14 21:04:18 +02:00
zadam
e8d63b5647 add "search in note" to "note actions" menu, #1184 2020-08-14 20:58:19 +02:00
zadam
53c6542af6 Merge remote-tracking branch 'origin/master' 2020-08-14 00:11:35 +02:00
zadam
d9c246f8a7 fixes for promoted attribute multiplicity 2020-08-14 00:11:26 +02:00
dependabot[bot]
803694d113 Bump lodash from 4.17.15 to 4.17.20 (#1189)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.20.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.20)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-08-13 23:29:27 +02:00
zadam
f6f9f0d2c0 ability to remove attribute with mouse + other tweaks 2020-08-13 23:23:57 +02:00
zadam
47a9516ada Merge remote-tracking branch 'origin/stable' 2020-08-13 00:00:05 +02:00
zadam
bd8b83898f Merge remote-tracking branch 'origin/stable' into stable 2020-08-12 23:59:42 +02:00
zadam
97109efb6c fix attribute cache invalidation 2020-08-12 23:59:33 +02:00
zadam
b4d9fdaeda fix attribute cache invalidation 2020-08-12 23:58:32 +02:00
zadam
1810116a34 attribute fixes 2020-08-12 23:39:05 +02:00
Jody
3e89855aa3 Add web app manifest (#1174)
* Add web app manifest, link to new manifest on mobile template.

* Remove duplicate manifest entry.
2020-08-12 21:39:12 +02:00
zadam
eaac65142f tweaks in attr list sizing 2020-08-12 21:36:43 +02:00
zadam
ae909d1079 fix saving & refreshing attributes across compoments 2020-08-12 00:02:19 +02:00
zadam
935e5de493 small fixes related to inherited attributes 2020-08-11 22:52:17 +02:00
zadam
8d0df6ddb9 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	db/demo.zip
#	src/services/notes.js
#	src/services/request.js
2020-08-10 23:45:17 +02:00
zadam
3b148eb6f8 fixed demo document to correctly show included notes 2020-08-10 23:42:06 +02:00
zadam
4e8d1dac67 fixes for rendering PDF previews e.g. in include note 2020-08-10 23:39:17 +02:00
zadam
7779fd1dfe synchronize the removal of the selection in cuttonote to make it more predictable 2020-08-10 22:42:57 +02:00
zadam
960d7dede3 add scrolling margins, #1181 2020-08-09 23:20:57 +02:00
zadam
e663d7da1b updated schema for entity_changes table 2020-08-09 22:44:53 +02:00
zadam
02cc52af66 small improvements and fixes 2020-08-06 23:55:17 +02:00
zadam
f60af1f05e small improvements and fixes 2020-08-06 00:06:42 +02:00
zadam
224fbdc8cd small improvements to text preview in file notes 2020-08-04 22:06:25 +02:00
zadam
8561201abc invalidate note complement cache quickly after load 2020-08-04 21:57:08 +02:00
zadam
3c1a809276 external links should open only in new window, not in the original window, closes #1171 2020-08-04 20:42:32 +02:00
zadam
ddf0a89e1f bootstrap 4.5.1 2020-08-04 20:39:16 +02:00
zadam
4b101baf00 CKEditor 21 content styles 2020-08-03 23:36:33 +02:00
zadam
782127dd91 fix noproxy handling for image downloading 2020-08-03 23:33:44 +02:00
zadam
7900622f38 refactored "sync" table to "entity_changes" - more changes 2020-08-02 23:43:39 +02:00
zadam
864271d5ef refactored "sync" table to "entity_changes" 2020-08-02 23:27:48 +02:00
zadam
5a5ea4f474 fix filling sync table after demo document import 2020-08-02 22:53:57 +02:00
zadam
749791f6d1 fixed CSP after upgrade to helmet 4 2020-08-02 22:26:02 +02:00
zadam
5ca3e9a0bc fixed db migrations after merge from stable 2020-08-02 20:44:46 +02:00
zadam
f4a4e746bf Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	libraries/ckeditor/ckeditor.js.map
#	package.json
#	src/routes/api/login.js
#	src/routes/api/sync.js
#	src/routes/index.js
#	src/services/app_info.js
#	src/services/sync.js
2020-08-02 20:41:22 +02:00
zadam
4fc8bace94 support horizontal line, closes #1164 2020-08-01 23:41:30 +02:00
zadam
47a22f6e8d release 0.43.3 2020-07-31 23:34:05 +02:00
zadam
17d7ff3ff1 small improvements to sync table handling 2020-07-31 00:08:01 +02:00
zadam
3582013a33 import of initial demo document sets sync.isSynced incorrectly to always 0, #1163 2020-07-31 00:07:38 +02:00
zadam
95bbdb3b6b CKEditor 21 2020-07-29 23:34:49 +02:00
zadam
e1dd933ec0 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	src/services/options_init.js
2020-07-28 23:50:54 +02:00
zadam
8a57960c6e tweaks in sync timeout handling 2020-07-28 23:29:12 +02:00
zadam
a7b62b30cb fix image resizing after save/update/import 2020-07-28 00:26:47 +02:00
zadam
c9cbc2db02 import fixes 2020-07-27 23:40:14 +02:00
zadam
c92526372c Merge remote-tracking branch 'origin/stable' 2020-07-26 23:47:31 +02:00
zadam
5f4a84d967 fix extracting base64 inline images from HTML, fixes #1159 2020-07-26 23:47:06 +02:00
zadam
ef59810f89 Merge remote-tracking branch 'origin/stable' 2020-07-26 22:58:54 +02:00
zadam
099e90ed64 fix extracting base64 inline images from HTML, fixes #1159 2020-07-26 22:58:22 +02:00
zadam
9b15437ff6 attr detail sizing 2020-07-26 00:09:53 +02:00
zadam
a3a2f1a2b4 autocompletes for attribute detail 2020-07-26 00:04:34 +02:00
zadam
3261fea67f added promotedAttributesExpanded option 2020-07-25 23:32:46 +02:00
zadam
b19589033d individual panes of attribute list are now opened correctly 2020-07-25 23:24:48 +02:00
zadam
2217c5a3e0 promoted attributes are now part of attr list and also responsive 2020-07-25 00:06:49 +02:00
zadam
b60efbbf5a Merge remote-tracking branch 'origin/master' 2020-07-24 23:14:38 +02:00
zadam
e9bfe4521e bug fixes 2020-07-24 23:14:31 +02:00
MeIchthys
79d9d79055 Minor gramatical changes (#1162)
* Minor gramatical change

change "delete also" to "also delete"

* Minor gramatical change

change "once more" to "confirmation"

* Minor gramatical changes

add "a" before some nouns.

* Minor gramatical/spelling fixes

* Minor gramatical changes

* Convert to singular action descriptions

change "changes" to "change" 
change "switches" to "switch"
change "copies" to "copy" 
etc.

* Minor gramatical changes
2020-07-24 22:03:39 +02:00
zadam
a36022d8c1 fixes 2020-07-24 00:02:15 +02:00
zadam
0eb77e43e2 full text search uses in-memory search even for unprotected notes and preprocesses content with tag stripping 2020-07-23 23:38:38 +02:00
zadam
e1d4be814f toggle to expand/collapse attr list is saved and propagated across tabs 2020-07-23 22:31:06 +02:00
zadam
aa4a645670 adding a button to the detail to explicitly save changes. 2020-07-23 00:19:50 +02:00
zadam
2c9565b4b3 fixes to update from detail to editor 2020-07-22 23:58:01 +02:00
zadam
c5cc6b91c1 label and relation definition are now displayed without prefixes in the attr detail view 2020-07-22 23:42:58 +02:00
zadam
3109233d4f better reporting for search parsing errors 2020-07-22 22:52:15 +02:00
zadam
60e8bd98b9 improvements to lexer and its tests 2020-07-21 23:42:59 +02:00
zadam
32ecb43b5c search refactoring 2020-07-21 00:01:07 +02:00
zadam
f03e4bc7d7 detect attempts to compare between labels (only with constants is possible) 2020-07-20 23:27:30 +02:00
zadam
4e5ddaf7d1 fix inQuotes + tests 2020-07-19 23:23:48 +02:00
zadam
35469f6f2d lexer now marks "in quotes" tokens 2020-07-19 23:19:45 +02:00
zadam
4c7b1d6543 shortcut negation syntax 2020-07-19 15:25:24 +02:00
zadam
df69b1d8dd attr detail handles label/relation definition updates 2020-07-18 23:45:28 +02:00
zadam
9d46c7253b fixes in saving 2020-07-18 00:20:24 +02:00
zadam
a94ae81c30 split out attribute_editor widget, WIP 2020-07-17 23:55:59 +02:00
zadam
9f527f0330 split out attribute_editor widget, WIP 2020-07-17 00:08:28 +02:00
zadam
68d8b1c8a9 rename note_attributes widget to attribute_list 2020-07-16 23:12:10 +02:00
zadam
0ab9d02434 fancytree 2.36.0 2020-07-15 22:40:58 +02:00
zadam
3d324b954d fix checking affected notes when modified attribute's owning note is not loaded into cache, #803 2020-07-15 22:36:27 +02:00
zadam
f028b88cce Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	package.json
#	src/routes/api/clipper.js
2020-07-15 00:11:26 +02:00
zadam
64dc522b27 infrastructure for editing attribute definitions 2020-07-15 00:09:37 +02:00
zadam
3d02f82c77 add label/relation from menu 2020-07-14 23:29:37 +02:00
zadam
528418aecb parsing and setting isInheritable flag 2020-07-13 23:27:23 +02:00
zadam
5dd73562da add new attr wip 2020-07-13 00:27:21 +02:00
zadam
62cacf85ed setting the relation target note 2020-07-13 00:15:00 +02:00
zadam
443f389d73 release 0.43.2 2020-07-11 23:58:59 +02:00
zadam
08edc521e4 fix visibility of hyper-link in repeatedly opened dialog 2020-07-11 23:50:38 +02:00
zadam
f54f6d09b0 fix declaring global variables on the setup page, closes #1071 2020-07-11 23:19:24 +02:00
zadam
3219441fdf fallback for missing parsed title, closes trilium-web-clipper/issues/16 2020-07-11 23:05:28 +02:00
zadam
1c97310e92 correctly parsing the click position 2020-07-10 22:39:16 +02:00
zadam
0ecb2f3662 WIP 2020-07-09 23:59:27 +02:00
zadam
055db32510 removed tar import 2020-07-09 21:46:33 +02:00
zadam
054420225f added experimental "save" button 2020-07-09 00:07:14 +02:00
zadam
448a3254a3 small tweaks 2020-07-08 23:51:47 +02:00
zadam
b2c0eaeaf8 Merge remote-tracking branch 'origin/stable' 2020-07-08 23:14:26 +02:00
zadam
1b0a2b41da added tab and shift-tab shortcuts for indent/outdent, closes #978 2020-07-08 21:57:09 +02:00
zadam
50b976990c click on inherited attr will also bring up the attribute detail widget 2020-07-05 23:53:55 +02:00
zadam
9f2545395d better value matching regex 2020-07-04 11:14:11 +02:00
zadam
67bffbf30b consistency checks will now fix incorrectly named attributes 2020-07-04 11:02:05 +02:00
zadam
51dae378a3 more cleanup 2020-07-04 10:29:17 +02:00
zadam
a0b3bc858d removed attributes dialog 2020-07-04 10:18:01 +02:00
zadam
2e24111c2b wip 2020-07-04 00:40:41 +02:00
zadam
69d529ada1 wip 2020-07-04 00:20:23 +02:00
zadam
bfa69a3dc3 closing of attr detail 2020-07-03 22:27:45 +02:00
zadam
5b862c3d29 Merge remote-tracking branch 'origin/stable' 2020-07-02 23:21:17 +02:00
zadam
dee4083bf3 improve request logging 2020-07-02 23:15:37 +02:00
zadam
18749092ff sql_init/migration fixes 2020-07-02 22:57:17 +02:00
zadam
c4cc48dfc9 fixed initial demo import 2020-07-02 21:08:18 +02:00
zadam
ef847b9904 fix search results 2020-07-02 20:19:09 +02:00
zadam
3e189d5c10 fixes 2020-07-01 23:50:33 +02:00
zadam
46d3160da4 removed detail.css, added to individual type widgets 2020-07-01 23:35:00 +02:00
zadam
78a2c1753e consistency checks fixes 2020-07-01 22:42:59 +02:00
zadam
f0b608ddec non-intrusive logging of sync errors 2020-07-01 21:33:52 +02:00
zadam
582429e762 updated content styles 2020-07-01 21:03:51 +02:00
zadam
bf073690e0 fixing promoted attributes 2020-07-01 00:02:13 +02:00
zadam
c012620338 removed now unused image minifying binaries 2020-06-30 23:41:13 +02:00
zadam
5e18e7dc67 html sanitize imported notes, #1137 2020-06-30 23:37:06 +02:00
zadam
51f094f87f image handling consistency fixes 2020-06-28 23:10:45 +02:00
zadam
262a4fa3c7 removed image minification using imagemin because of constant platform related issues 2020-06-28 22:36:42 +02:00
zadam
c778e87683 wip 2020-06-27 00:40:35 +02:00
zadam
dd62b306fd refactored attr detail into separate widget 2020-06-26 22:17:39 +02:00
zadam
1f05638609 attribute progress 2020-06-25 23:56:06 +02:00
zadam
92e49214c7 more attribute mockups (inherited attributes) 2020-06-24 23:56:39 +02:00
zadam
9615e25a67 fix merge problems 2020-06-24 22:29:53 +02:00
zadam
a574fce13f Merge remote-tracking branch 'origin/stable' into syncification
# Conflicts:
#	package-lock.json
#	package.json
#	src/routes/custom.js
#	src/services/import/single.js
2020-06-24 22:08:31 +02:00
zadam
238df0fb40 fix SVG single file import as image and not as file, closes #1114 2020-06-24 21:47:50 +02:00
zadam
89356918f1 fix unescaped HTML in the tree node title, closes #1127 2020-06-24 21:07:55 +02:00
zadam
263b65997c hide "type around" controls in printed PDF, closes #1129 2020-06-24 20:44:00 +02:00
zadam
2b757bfccd upgrade ckeditor to 20.0.0 2020-06-24 16:17:39 +02:00
zadam
99d66ea89f mockup of hidable attributes 2020-06-24 00:02:54 +02:00
zadam
c78ca4c9db fixed triggers to sort children of notes with "sorted" label, closes #1126 2020-06-23 22:03:01 +02:00
zadam
b245b249d3 got rid of simple-node-logger in favor of simple custom logger 2020-06-23 13:38:27 +02:00
zadam
a0395e9866 release 0.43.1 2020-06-23 10:11:17 +02:00
zadam
89aa4fbc73 electron 9.0.5 2020-06-23 10:10:59 +02:00
zadam
74a7802088 fix custom resource handler, closes #1125 2020-06-22 23:13:53 +02:00
zadam
a89b6711d1 refactored code to not depend on external elements, #1120 2020-06-22 22:28:45 +02:00
zadam
b2549b2834 Merge remote-tracking branch 'origin/stable' into stable 2020-06-22 22:00:22 +02:00
zadam
959c4cbe64 removed icon tooltip again 2020-06-22 22:00:08 +02:00
Shon Ramamurthy
d03d3603d2 Add optional support for note title tooltips under note tree widget (#1120)
* Add support for note title tooltips under note tree widget

This change adds an option to set the 'tooltip' configuration of the
Fancytree component. This allows tooltips containing the note title to
be displayed when a hover is performed over a note title in the tree
widget.

* Revert DB Upgrade

The db upgrade is reverted as this is not required for options.

* Simplify boolean option comparison

With this change, the existing 'is(key)' method is used to perform
tooltip enable option boolean comparison.

* Display tooltip only on center-pane overlap - Experimental

With this change, a straight-forward method to detect HTML element
overlap has been identified (source:
https://gist.github.com/jtsternberg/c272d7de5b967cec2d3d). It is now
possible to detect whether the center-pane element overlaps with the
Fancytree node title-bar. Using this approach we now have a rough
implementation which only displays a note-title tooltip when there is a
center-pane overlap.

At this stage, this change is experimental and the following needs to be
further addressed,
 - Register the 'mouseenter' event handler in an appropriate place. The
   current placement of this event handler is only for testing.
 - This change is now enabled by default. It needs to be seen whether it
   would still make sense to disable it via an option.

* Remove option to set tooltip

With this change, the tooltip options menu item has been removed as it
becomes relevant to have this feature enabled by default.

* Revert further changes related to the options menu

Further changes are rolled back which was earlier related to the tooltip
options setting. Some of these were missed in the previous commit.

* Remove debug logging

Remove debug logging and unnecessary line breaks.

* Move note-title tooltip handler under note_tree.js

With this change, we move the definition for the note-title tooltip
handler inside 'note_tree.js'. Registration is done inside
'side_pane_toggles.js' as we would need the handler to detect the
'center-pane' element first before detecting collisions.
2020-06-22 21:58:58 +02:00
zadam
22302e8200 attrs WIP 2020-06-21 23:41:51 +02:00
zadam
f117ae4915 fix sending sync rows via WebSocket after transaction is committed 2020-06-21 13:44:47 +02:00
zadam
c34a9b96e4 further simplification - now using better-sqlite3 native transaction API 2020-06-21 13:33:56 +02:00
zadam
f0acfaf147 simplification of transaction handling 2020-06-21 13:15:36 +02:00
zadam
e1c2573778 add tooltip to fancytree node icon, #1120 2020-06-21 12:47:24 +02:00
zadam
56d6384ae1 added protected note full text search 2020-06-20 23:46:49 +02:00
zadam
5f699cc28c converted most dynamic SQL queries into prepared statement to avoid excessive statement caching 2020-06-20 23:24:34 +02:00
zadam
969f31dde2 fixed backup and anonymization with better-sqlite3 2020-06-20 23:09:34 +02:00
zadam
027afab6b1 fix DB setup 2020-06-20 21:42:41 +02:00
zadam
6207203b35 wip 2020-06-20 13:18:03 +02:00
zadam
88348c560c syncification 2020-06-20 12:31:38 +02:00
zadam
30062d687f Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	libraries/ckeditor/ckeditor.js
#	libraries/ckeditor/ckeditor.js.map
2020-06-20 09:40:11 +02:00
zadam
ffc96ad6b2 parser status indication 2020-06-20 09:39:44 +02:00
zadam
2af2b45062 fix keyboard shortcut for print this note, #1118 2020-06-20 00:04:31 +02:00
zadam
eabe4775bd fix click handler of links inside included note 2020-06-19 23:20:52 +02:00
zadam
da9b321aa0 allow mouse interactions in ckeditor widgets, fixes #1117 2020-06-19 22:24:57 +02:00
zadam
7b0aa7ab0b parser status indication 2020-06-18 23:53:57 +02:00
zadam
f700e6e12b use standard search to find notes with same attrs 2020-06-18 22:28:18 +02:00
zadam
a87e59cecb WIP of attribute view on click 2020-06-18 12:52:16 +02:00
zadam
a04aa6fd36 version updates 2020-06-18 09:12:30 +02:00
zadam
a7d9870846 Merge remote-tracking branch 'origin/better-sqlite3'
# Conflicts:
#	libraries/ckeditor/ckeditor.js
#	libraries/ckeditor/ckeditor.js.map
#	package-lock.json
#	package.json
#	src/public/app/services/utils.js
#	src/public/app/widgets/type_widgets/editable_text.js
#	src/services/utils.js
2020-06-18 09:03:09 +02:00
zadam
c18d8d2d1b add back lost edited notes widget, closes #1115 2020-06-18 08:56:23 +02:00
zadam
f745e21e0d use better-sqlite3 2020-06-17 23:03:46 +02:00
zadam
5f2361ebd5 release 0.43.0-beta 2020-06-15 23:26:12 +02:00
zadam
9791dab97d recent changes sorting fixes, closes #1099 2020-06-15 23:22:11 +02:00
zadam
85d986534d fix enforcing node's http requests for sync 2020-06-15 18:24:43 +02:00
zadam
00faf758e8 fixes and polish 2020-06-15 17:56:53 +02:00
zadam
6ba2e5cf73 add word count widget to the demo document (plus cleanup of external links) 2020-06-14 16:29:29 +02:00
zadam
fb3876d28b promoted attr selection using autocomplete will trigger change event to save it, closes #699 2020-06-14 16:04:00 +02:00
zadam
fb975849b9 small API additions 2020-06-14 14:30:57 +02:00
zadam
16fef78344 add API method to force refresh of included notes, closes #1106 2020-06-14 10:50:08 +02:00
zadam
e0b4b369dc transaction handling fixes 2020-06-14 00:35:53 +02:00
zadam
0df7851214 fix sync 2020-06-13 22:34:15 +02:00
zadam
5d47c2b23e opening transactions only on write operations which enforces exclusive lock only there to improve concurrency, custom handling of sync request timeouts, #1093, #1018 2020-06-13 10:23:36 +02:00
zadam
d09b021487 add time limit to frontend update 2020-06-11 00:13:56 +02:00
zadam
910bda860c fix delete note function just work one time, closes #1101 2020-06-10 23:43:59 +02:00
zadam
2d92b4931a fix ctrl+click opening the link twice/thrice, closes #1094 2020-06-10 00:10:27 +02:00
zadam
212b719ee9 better detection of changes in attributes and how they affect notes 2020-06-09 22:59:22 +02:00
zadam
1db892d22f return the ability to hide archived notes, closes #1095 2020-06-08 23:15:49 +02:00
zadam
535dcb6d12 release 0.42.7 2020-06-08 10:43:12 +02:00
zadam
4426362799 cleanup sqlite to make the distributed archives smaller 2020-06-08 10:42:40 +02:00
zadam
2c609e8136 promoted attributes widget is now auto-updating, fixes #700 2020-06-08 00:29:52 +02:00
zadam
11b73b79ed refresh promoted attributes when change detected 2020-06-07 23:57:10 +02:00
zadam
28dc6b93ca lock CPU info for perf context 2020-06-07 23:56:51 +02:00
zadam
e70c862e72 fix import 2020-06-07 23:55:55 +02:00
zadam
b3e66d5a83 fixed command line anonymization 2020-06-07 10:45:41 +02:00
zadam
e8cd821e57 futrther improvements to anonymization 2020-06-07 10:20:48 +02:00
zadam
401a3f0ecb add info on read only notes, #1088 2020-06-06 18:46:45 +02:00
zadam
e73dffad0b parse incomplete attrs 2020-06-06 12:56:24 +02:00
zadam
ef1d062745 attribute parser preserves indexes from original string 2020-06-06 10:39:27 +02:00
zadam
f245d51746 basic saving of attributes in the widget 2020-06-05 17:25:14 +02:00
zadam
be7ac74235 better fallback for resolving filenames of binary attachments 2020-06-05 10:40:35 +02:00
zadam
ad48b59893 no need to reload whole subtree while moving notes 2020-06-05 00:07:45 +02:00
zadam
e817acba4e fix template attribute cycle in note cache 2020-06-04 23:58:31 +02:00
zadam
4ae965c5cb Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	src/public/app/widgets/collapsible_widgets/note_info.js
2020-06-04 22:37:04 +02:00
zadam
58fa0832f6 fix focusing title after creating a note 2020-06-04 21:44:34 +02:00
zadam
1502b9ce66 prevent attribute inheritance cycle via template, closes #1077 2020-06-04 12:27:41 +02:00
zadam
ed9fbae65d attribute parser and tests WIP 2020-06-04 00:04:57 +02:00
zadam
01a7af965c refactoring of es6 test skeleton 2020-06-03 17:28:57 +02:00
zadam
99120be46d skeleton of first tests 2020-06-03 17:11:03 +02:00
zadam
915b1d1a45 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	libraries/ckeditor/ckeditor.js
#	libraries/ckeditor/ckeditor.js.map
#	package-lock.json
#	package.json
#	src/public/app/widgets/type_widgets/editable_text.js
2020-06-03 16:25:45 +02:00
zadam
e68aed2057 Merge remote-tracking branch 'origin/master' 2020-06-03 16:24:52 +02:00
zadam
eedeaca37d wip 2020-06-03 16:24:41 +02:00
zadam
7307ca385f release 0.42.6 2020-06-03 14:30:07 +02:00
zadam
c1fd9825aa fix backup 2020-06-03 12:16:16 +02:00
zadam
9de7d3fc53 fix unloading protected session after clicking on a button, closes #1078 2020-06-03 11:47:30 +02:00
zadam
3c5db844ba fix tree focusing issues 2020-06-03 11:06:45 +02:00
zadam
e7330c1104 more anonymization 2020-06-03 09:55:05 +02:00
zadam
ec4586b164 fix reference link implementation, closes #1069 2020-06-02 23:54:33 +02:00
zadam
91e5f24798 fix db anonymization 2020-06-02 23:13:55 +02:00
zadam
38723e0189 release 0.42.5 2020-05-31 23:33:30 +02:00
zadam
8c88ce6f65 fix moving/cloning notes broken in 0.42.4, closes #1066 2020-05-31 22:33:02 +02:00
Adam Coyne
0def5f9a63 Add a VSCode debug configuration matching the start-server npm script (#1061) 2020-05-31 12:40:53 +02:00
zadam
4d22959e28 release 0.42.4 2020-05-31 10:33:12 +02:00
zadam
50a28d8c51 the node you start dragging should be included even if not selected 2020-05-31 10:32:35 +02:00
zadam
e25b633ec4 better error logging in backup 2020-05-31 10:24:59 +02:00
Adam Coyne
ac10701b55 Add import option to replace underscores with spaces in note names (#1064) 2020-05-30 23:15:00 +02:00
zadam
75bd395669 fix extra refresh because of duplicated sync event, closes #1063 2020-05-30 22:35:18 +02:00
zadam
5e353a5612 improved drag & drop 2020-05-30 10:30:21 +02:00
Adam Coyne
c0cd321118 Fix import error (#1060)
* Fix access to attributes on undefined noteMeta

* Remove .markdown extension from imported page titles
2020-05-30 10:09:10 +02:00
zadam
d65624d8d2 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	libraries/ckeditor/ckeditor.js
#	libraries/ckeditor/ckeditor.js.map
2020-05-29 22:29:28 +02:00
zadam
6b359b7796 return 401 when auth request is out of sync, closes #1056 2020-05-29 22:06:36 +02:00
zadam
13f9d037dc safer backup to file using VACUUM INTO + possibility to explicitly ask for backup now 2020-05-29 21:55:08 +02:00
zadam
1911d64c1c fix long filename overflowing, closes #1052 2020-05-29 20:36:48 +02:00
Ionuț Staicu
1c388c9805 cross platform compatibility (#1051) 2020-05-29 12:01:20 +02:00
zadam
6a957eff17 added autocompletes for labels, relations 2020-05-28 23:59:08 +02:00
zadam
5aaa429203 WIP of new attribute widget 2020-05-28 00:17:13 +02:00
zadam
d4c3f1b3f2 upgrade to ckeditor 19.1.0 2020-05-27 22:08:06 +02:00
zadam
ae934720bc Merge branch 'm43' 2020-05-27 00:09:51 +02:00
zadam
753c181979 Merge remote-tracking branch 'origin/stable' 2020-05-27 00:09:40 +02:00
zadam
55b210d7c5 added not() expression 2020-05-27 00:09:19 +02:00
zadam
dc2d5a0a79 fix fulltext content search 2020-05-26 23:25:13 +02:00
zadam
c753f228ac more tests & fixes 2020-05-25 23:39:34 +02:00
zadam
a1a744bb00 order & limit implementation WIP 2020-05-25 00:25:47 +02:00
zadam
077d19b44b Create SECURITY.md 2020-05-24 19:34:52 +02:00
zadam
b5627b138a integrate new search into the main global search 2020-05-24 09:30:08 +02:00
zadam
cb4d0624b5 put session directory into data dir to avoid conflict of multiple instances on a single server, fixes #1033 2020-05-24 00:21:20 +02:00
zadam
e2490f9975 faster implementation of ancestors 2020-05-23 23:57:59 +02:00
zadam
9ede77aead added ancestor 2020-05-23 23:44:55 +02:00
zadam
8ce2afff8a more tests 2020-05-23 22:18:06 +02:00
zadam
a2e1fb35b8 tests for note properties 2020-05-23 20:52:55 +02:00
zadam
bb03a8714a more tests 2020-05-23 18:42:32 +02:00
zadam
ae772288e2 support for long syntax of labels and relations 2020-05-23 18:13:35 +02:00
zadam
355ffd3d02 added querying by relation's properties 2020-05-23 12:27:44 +02:00
zadam
3d12341ff1 added querying by children 2020-05-23 10:36:49 +02:00
zadam
4ea934509e implemented property based access + parent 2020-05-23 10:25:22 +02:00
zadam
3db84daf94 fix hiding autocompletes after closing tab, closes #1034 2020-05-22 19:30:21 +02:00
zadam
714881ad99 more search tests + numeric label comparison 2020-05-22 19:08:06 +02:00
zadam
ee053b9fdf basic search tests 2020-05-22 09:38:30 +02:00
zadam
cd48135394 refactoring to allow unit tests of the whole search subsystem 2020-05-21 14:05:56 +02:00
zadam
a06662f4ce fuzzy search for values as well 2020-05-21 13:45:18 +02:00
zadam
2e6395ad88 prefix match for autocomplete attribute search 2020-05-21 12:05:12 +02:00
zadam
75d8627f1c refactoring to ParserContext 2020-05-21 11:46:01 +02:00
zadam
a8d12f723f fix highlighting 2020-05-21 11:18:15 +02:00
zadam
08dbf90a8c hide body during startup to reduce flicker 2020-05-21 09:42:25 +02:00
zadam
32dde426fd apply new query parsing to note autocomplete 2020-05-21 00:39:17 +02:00
zadam
b26100479d parser tests added 2020-05-20 23:20:39 +02:00
zadam
faf4daa577 shadow on hover for title bar buttons 2020-05-20 19:14:07 +02:00
zadam
2526715aa4 release 0.42.3 2020-05-20 08:54:55 +02:00
zadam
04c573e212 set default executors 2020-05-20 08:54:37 +02:00
zadam
99aa481ace refactoring for testing parser 2020-05-20 00:03:33 +02:00
zadam
ef37bc1a99 Merge remote-tracking branch 'origin/stable' into m43
# Conflicts:
#	.idea/dataSources.xml
2020-05-19 23:20:32 +02:00
zadam
58f4f5d1e6 fix deadlock after "cut to note", closes #1030 2020-05-19 22:58:08 +02:00
zadam
b72dc977e6 parens handler + parser in progress 2020-05-19 00:00:35 +02:00
zadam
81bf84f2de lexer fixes + tests 2020-05-17 23:14:24 +02:00
zadam
fa5d982a55 fix exporting root note, closes #1024 2020-05-17 21:07:54 +02:00
zadam
e77e0ce675 lexer impl WIP + test 2020-05-17 19:43:37 +02:00
zadam
32eaafd024 note cache fixes after refactoring 2020-05-17 10:11:19 +02:00
zadam
60c2049729 note cache refactoring WIP 2020-05-17 09:48:24 +02:00
zadam
dcd371b5b1 note cache breakup into classes, WIP 2020-05-16 23:12:29 +02:00
zadam
e3071e630a note cache refactoring WIP 2020-05-16 22:11:09 +02:00
zadam
78ea0b4ba9 refactoring ... 2020-05-15 23:50:36 +02:00
zadam
f07025f741 start of note cache expression implementation 2020-05-15 11:04:55 +02:00
zadam
5f1f65a3c2 fuction reorganization 2020-05-14 23:21:48 +02:00
zadam
a3e2369599 add also content fulltext 2020-05-14 23:11:59 +02:00
zadam
1ec446137d fulltext also searches for branch prefixes 2020-05-14 21:30:36 +02:00
zadam
108afe8896 fix incorrect processing of sync rows, closes #1019 2020-05-14 13:08:06 +02:00
zadam
a287bb59ea note cache fixes for created notes 2020-05-13 23:06:13 +02:00
zadam
7992f32d34 note cache refactoring 2020-05-13 14:42:16 +02:00
zadam
b07accfd9d note cache refactoring + handling entity changes 2020-05-13 10:47:22 +02:00
zadam
ccb5f3ee18 searching now works correctly in inherited attributes 2020-05-13 00:01:10 +02:00
zadam
29e6b63f82 Merge remote-tracking branch 'origin/master' into m43 2020-05-12 21:15:54 +02:00
zadam
2818854c4b Merge remote-tracking branch 'origin/stable' 2020-05-12 21:15:32 +02:00
zadam
d75b770fb9 update of bootstrap to 4.5.0 2020-05-12 20:17:51 +02:00
zadam
13117d2e68 Merge remote-tracking branch 'origin/stable' 2020-05-12 13:41:06 +02:00
zadam
b51f5ac6fd Merge remote-tracking branch 'origin/stable' 2020-05-12 10:59:02 +02:00
zadam
2e0fb8aaf1 fix creating new promoted attributes, closes #1008 2020-05-11 23:57:39 +02:00
zadam
ac4e6077bd Merge remote-tracking branch 'origin/stable' 2020-05-11 23:23:59 +02:00
zadam
8e8fa48241 ws update 2020-05-11 23:23:18 +02:00
Naveen M V
9a662f76da Fix regex bug (#1005) 2020-05-11 22:06:22 +02:00
zadam
15bc9dce1c search overhaul WIP 2020-05-10 23:27:53 +02:00
zadam
552fc5261a new note cache WIP 2020-05-09 23:42:26 +02:00
zadam
83c9e6e846 Merge branch 'master' into m43 2020-05-09 20:17:26 +02:00
zadam
2e837642e2 create note directly from mention linking 2020-05-09 14:25:27 +02:00
zadam
c70a842bc6 Merge remote-tracking branch 'origin/stable' 2020-05-08 23:44:51 +02:00
zadam
d20415c979 bind global menu item "Open SQL console" to the logic to create such a note 2020-05-08 23:39:46 +02:00
zadam
c3438e0f3f implemented SQL console as a type of code note 2020-05-08 22:22:43 +02:00
zadam
1bb895bb83 Merge remote-tracking branch 'origin/stable' 2020-05-07 23:36:11 +02:00
zadam
f1ce0c7774 Merge branch 'm43-2'
# Conflicts:
#	src/public/app/services/app_context.js
#	src/public/app/widgets/run_script_buttons.js
2020-05-07 20:57:22 +02:00
zadam
a0f8caeccd added SQLite (Trilium) mime type 2020-05-05 23:59:26 +02:00
zadam
edb9bc9229 fix "Render note" and "Execute script" buttons + refactoring around data-trigger-command handling 2020-05-05 23:58:52 +02:00
zadam
768ac83e14 Merge branch 'master' into m43 2020-05-05 19:38:42 +02:00
zadam
7ac2206e9b start of search overhaul 2020-05-03 09:18:57 +02:00
712 changed files with 78048 additions and 45843 deletions

4
.idea/dataSources.xml generated
View File

@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="SQLite - document.db" uuid="d0fd879f-1e1d-4d5c-9c21-0e5cf9ab2976">
<data-source source="LOCAL" name="document.db" uuid="4e69c96a-8a2b-43f5-9b40-d1608f75f7a4">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/../trilium-data/document.db</jdbc-url>
<jdbc-url>jdbc:sqlite:$USER_HOME$/trilium-data/document.db</jdbc-url>
</data-source>
</component>
</project>

18
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "start-server",
"skipFiles": [
"<node_internals>/**"
],
"env": {
"TRILIUM_ENV": "dev"
},
"outputCapture": "std",
"program": "${workspaceFolder}/src/www"
}
]
}

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
@@ -23,5 +23,7 @@ RUN set -x \
# Bundle app source
COPY . .
USER node
EXPOSE 8080
CMD [ "node", "./src/www" ]

58
README-ZH_CN.md Normal file
View File

@@ -0,0 +1,58 @@
# Trilium注意事项
[![Join the chat at https://gitter.im/trilium-notes/Lobby](https://badges.gitter.im/trilium-notes/Lobby.svg)](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Trilium Notes是一个分层的笔记应用程序专注于建立大型个人知识库。请参阅[屏幕截图](https://github.com/zadam/trilium/wiki/Screenshot-tour)以快速了解:
![](https://raw.githubusercontent.com/wiki/zadam/trilium/images/screenshot.png)
## 特性
* 笔记可以排列成任意深的树。单个笔记可以放在树中的多个位置(请参阅[克隆](https://github.com/zadam/trilium/wiki/Cloning-notes)
* 丰富的所见即所得笔记编辑功能包括带有markdown[自动格式化功能的](https://github.com/zadam/trilium/wiki/Text-notes#autoformat)表格,图像和[数学](https://github.com/zadam/trilium/wiki/Text-notes#math-support)
* 支持编辑[使用源代码的笔记](https://github.com/zadam/trilium/wiki/Code-notes),包括语法高亮显示
* 笔记之间快速[导航](https://github.com/zadam/trilium/wiki/Note-navigation),全文搜索和[笔记挂起](https://github.com/zadam/trilium/wiki/Note-hoisting)
* 无缝[笔记版本控制](https://github.com/zadam/trilium/wiki/Note-revisions)
* 笔记[属性](https://github.com/zadam/trilium/wiki/Attributes)可用于笔记组织,查询和高级[脚本编写](https://github.com/zadam/trilium/wiki/Scripts)
* [同步](https://github.com/zadam/trilium/wiki/Synchronization)与自托管同步服务器
* 具有按笔记粒度的强大的[笔记加密](https://github.com/zadam/trilium/wiki/Protected-notes)
* [关系图](https://github.com/zadam/trilium/wiki/Relation-map)和[链接图](https://github.com/zadam/trilium/wiki/Link-map),用于可视化笔记及其关系
* [脚本](https://github.com/zadam/trilium/wiki/Scripts)-请参阅[高级展示](https://github.com/zadam/trilium/wiki/Advanced-showcases)
* 可用性和性能均能很好地扩展至超过10万个笔记
* 针对智能手机和平板电脑进行触摸优化的[移动前端](https://github.com/zadam/trilium/wiki/Mobile-frontend)
* [夜间主题](https://github.com/zadam/trilium/wiki/Themes)
* [Evernote](https://github.com/zadam/trilium/wiki/Evernote-import)和[Markdown导入导出](https://github.com/zadam/trilium/wiki/Markdown)
* [Web Clipper](https://github.com/zadam/trilium/wiki/Web-clipper)可轻松保存Web内容
## 构建
Trilium是作为桌面应用程序Linux和Windows或服务器上托管的Web应用程序Linux提供的。Mac OS桌面版本可用但[不受支持](https://github.com/zadam/trilium/wiki/FAQ#mac-os-support)。
* 如果要在桌面上使用Trilium请从[最新版本](https://github.com/zadam/trilium/releases/latest)下载适用于您平台的二进制[版本](https://github.com/zadam/trilium/releases/latest),解压缩该软件包并运行`trilium`可执行文件。
* 如果要在服务器上安装Trilium请遵循[此页面](https://github.com/zadam/trilium/wiki/Server-installation)。
* 当前仅支持经过测试最新的Chrome和Firefox浏览器。
## 文档
[有关文档页面的完整列表请参见Wiki。](https://github.com/zadam/trilium/wiki/)
您还可以阅读[个人知识库模式](https://github.com/zadam/trilium/wiki/Patterns-of-personal-knowledge-base)以获取有关如何使用Trilium的灵感。
## 贡献
使用基于浏览器的开发环境
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/zadam/trilium)
或在本地克隆并运行
```
npm install
npm run start-server
```
## 致谢
* [CKEditor 5](https://github.com/ckeditor/ckeditor5) - 市场上最好的所见即所得编辑器,互动性强且聆听能力强的团队
* [FancyTree](https://github.com/mar10/fancytree) - 一个非常丰富的关于树的库强大的没有对手。没有它Trilium Notes将不会如此。
* [CodeMirror](https://github.com/codemirror/CodeMirror) - 支持大量语言的代码编辑器
* [jsPlumb](https://github.com/jsplumb/jsplumb)强大的可视化连接库。- 用于[关系图](https://github.com/zadam/trilium/wiki/Relation-map)和[链接图](https://github.com/zadam/trilium/wiki/Link-map)

View File

@@ -8,7 +8,7 @@ Trilium Notes is a hierarchical note taking application with focus on building l
## Features
* Notes can be arranged into arbitrarily deep tree. Single note can be placed into multiple places in the tree (see [cloning](https://github.com/zadam/trilium/wiki/Cloning-notes))
* Rich WYSIWYG note editing including e.g. tables and images with markdown [autoformat](https://github.com/zadam/trilium/wiki/Text-notes#autoformat)
* Rich WYSIWYG note editing including e.g. tables, images and [math](https://github.com/zadam/trilium/wiki/Text-notes#math-support) with markdown [autoformat](https://github.com/zadam/trilium/wiki/Text-notes#autoformat)
* Support for editing [notes with source code](https://github.com/zadam/trilium/wiki/Code-notes), including syntax highlighting
* Fast and easy [navigation between notes](https://github.com/zadam/trilium/wiki/Note-navigation), full text search and [note hoisting](https://github.com/zadam/trilium/wiki/Note-hoisting)
* Seamless [note versioning](https://github.com/zadam/trilium/wiki/Note-revisions)
@@ -54,4 +54,8 @@ npm run start-server
* [CKEditor 5](https://github.com/ckeditor/ckeditor5) - best WYSIWYG editor on the market, very interactive and listening team
* [FancyTree](https://github.com/mar10/fancytree) - very feature rich tree library without real competition. Trilium Notes would not be the same without it.
* [CodeMirror](https://github.com/codemirror/CodeMirror) - code editor with support for huge amount of languages
* [jsPlumb](https://github.com/jsplumb/jsplumb) - visual connectivity library without competition. Used in [relation maps](https://github.com/zadam/trilium/wiki/Relation-map) and [link maps](https://github.com/zadam/trilium/wiki/Link-map)
* [jsPlumb](https://github.com/jsplumb/jsplumb) - visual connectivity library without competition. Used in [relation maps](https://github.com/zadam/trilium/wiki/Relation-map) and [link maps](https://github.com/zadam/trilium/wiki/Link-map)
## License
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

13
SECURITY.md Normal file
View File

@@ -0,0 +1,13 @@
# Security Policy
## Supported Versions
In the (still active) 0.X phase of the project only the latest stable minor release is getting bugfixes (including security ones).
So e.g. if the latest stable version is 0.42.3 and the latest beta version is 0.43.0-beta, then 0.42 line will still get security fixes but older versions (like 0.41.X) won't get any fixes.
Description above is a general rule and may be altered on case by case basis.
## Reporting a Vulnerability
You can report low severity vulnerabilities as GitHub issues, more severe vulnerabilities should be reported to the email zadam.apps@gmail.com

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

@@ -7,15 +7,13 @@ then
./bin/copy-trilium.sh $SRC_DIR
fi
echo "Copying required linux-x64 binaries"
rm -r $SRC_DIR/node_modules/sqlite3/lib/binding/*
rm -r $SRC_DIR/node_modules/pngquant-bin/vendor/*
rm -r $SRC_DIR/src/public/app-dist/*.mobile.*
cp -r bin/deps/linux-x64/sqlite/* $SRC_DIR/node_modules/sqlite3/lib/binding/
cp bin/deps/linux-x64/image/pngquant $SRC_DIR/node_modules/pngquant-bin/vendor/
echo "Copying required linux-x64 binaries"
cp -r bin/better-sqlite3/linux-desktop-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
echo "Packaging linux x64 electron build"
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=linux --arch=x64 --overwrite
@@ -41,4 +39,4 @@ tar cJf trilium-linux-x64-${VERSION}.tar.xz trilium-linux-x64
cd ..
bin/build-debian.sh
bin/build-debian.sh

View File

@@ -9,18 +9,12 @@ fi
echo "Copying required mac binaries"
rm -r $SRC_DIR/node_modules/sqlite3/lib/binding/*
rm -r $SRC_DIR/node_modules/mozjpeg/vendor/*
rm -r $SRC_DIR/node_modules/pngquant-bin/vendor/*
rm -r $SRC_DIR/node_modules/giflossy/vendor/*
cp -r bin/deps/mac-x64/sqlite/* $SRC_DIR/node_modules/sqlite3/lib/binding/
cp bin/deps/mac-x64/image/cjpeg $SRC_DIR/node_modules/mozjpeg/vendor/
cp bin/deps/mac-x64/image/pngquant $SRC_DIR/node_modules/pngquant-bin/vendor/
cp bin/deps/mac-x64/image/gifsicle $SRC_DIR/node_modules/giflossy/vendor/
cp -r bin/better-sqlite3/mac-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
rm -r $SRC_DIR/src/public/app-dist/*.mobile.*
echo "Packaging mac x64 electron build"
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=darwin --arch=x64 --overwrite --icon=images/app-icons/mac/icon.icns
BUILD_DIR=./dist/trilium-mac-x64

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
PKG_DIR=dist/trilium-linux-x64-server
NODE_VERSION=12.16.3
NODE_VERSION=12.19.0
if [ "$1" != "DONTCOPY" ]
then
@@ -16,11 +16,12 @@ cd ..
mv dist/node-v${NODE_VERSION}-linux-x64 $PKG_DIR/node
rm -r $PKG_DIR/node/lib/node_modules/npm
rm -r $PKG_DIR/node/include/node
rm -r $PKG_DIR/node_modules/electron*
rm -r $PKG_DIR/node_modules/sqlite3/lib/binding/*
cp -r ./bin/deps/linux-x64/sqlite/node* $PKG_DIR/node_modules/sqlite3/lib/binding/
cp -r bin/better-sqlite3/linux-server-better_sqlite3.node $PKG_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
printf "#!/bin/sh\n./node/bin/node src/www" > $PKG_DIR/trilium.sh
chmod 755 $PKG_DIR/trilium.sh

View File

@@ -9,18 +9,12 @@ fi
echo "Copying required windows binaries"
rm -r $SRC_DIR/node_modules/sqlite3/lib/binding/*
rm -r $SRC_DIR/node_modules/mozjpeg/vendor/*
rm -r $SRC_DIR/node_modules/pngquant-bin/vendor/*
rm -r $SRC_DIR/node_modules/giflossy/vendor/*
cp -r bin/deps/win-x64/sqlite/* $SRC_DIR/node_modules/sqlite3/lib/binding/
cp bin/deps/win-x64/image/cjpeg.exe $SRC_DIR/node_modules/mozjpeg/vendor/
cp bin/deps/win-x64/image/pngquant.exe $SRC_DIR/node_modules/pngquant-bin/vendor/
cp bin/deps/win-x64/image/gifsicle.exe $SRC_DIR/node_modules/giflossy/vendor/
cp -r bin/better-sqlite3/win-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
rm -r $SRC_DIR/src/public/app-dist/*.mobile.*
echo "Packaging windows x64 electron build"
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=win32 --arch=x64 --overwrite --icon=images/app-icons/win/icon.ico
BUILD_DIR=./dist/trilium-windows-x64

View File

@@ -29,10 +29,23 @@ cp webpack-* $DIR/
# run in subshell (so we return to original dir)
(cd $DIR && npm install --only=prod)
# cleanup of useless files in dependencies
rm -r $DIR/node_modules/image-q/demo
rm -r $DIR/node_modules/better-sqlite3/Release
rm -r $DIR/node_modules/better-sqlite3/deps/sqlite3.tar.gz
rm -r $DIR/node_modules/@jimp/plugin-print/fonts
rm -r $DIR/node_modules/jimp/browser
rm -r $DIR/node_modules/jimp/fonts
# delete all tests (there are often large images as test file for jimp etc.)
find $DIR/node_modules -name test -exec rm -rf {} \;
find $DIR/node_modules -name docs -exec rm -rf {} \;
find $DIR/node_modules -name demo -exec rm -rf {} \;
find $DIR/libraries -name "*.map" -type f -delete
rm -r $DIR/src/public/app
sed -i -e 's/app\/desktop.js/app-dist\/desktop.js/g' $DIR/src/views/desktop.ejs
sed -i -e 's/app\/mobile.js/app-dist\/mobile.js/g' $DIR/src/views/mobile.ejs
sed -i -e 's/app\/setup.js/app-dist\/setup.js/g' $DIR/src/views/setup.ejs
sed -i -e 's/app\/setup.js/app-dist\/setup.js/g' $DIR/src/views/setup.ejs

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.

View File

@@ -1,7 +1,13 @@
[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)
noAuthentication=false
# set to true to disable backups (e.g. because of limited space on server)
noBackup=false
# Disable automatically generating desktop icon
# noDesktopIcon=true

Binary file not shown.

View File

@@ -1,4 +1,4 @@
const syncTableService = require('../../src/services/sync_table');
const syncTableService = require('../../src/services/entity_changes.js');
// options has not been filled so far which caused problems with clean-slate sync.
module.exports = async () => await syncTableService.fillAllSyncRows();
module.exports = async () => await syncTableService.fillAllSyncRows();

View File

@@ -1,5 +1,5 @@
const syncTableService = require('../../src/services/sync_table');
const syncTableService = require('../../src/services/entity_changes.js');
module.exports = async () => {
await syncTableService.fillAllSyncRows();
};
};

View File

@@ -0,0 +1,4 @@
UPDATE sync SET isSynced = 1 WHERE entityName != 'options' OR (
entityName = 'options'
AND 1 = (SELECT isSynced FROM options WHERE name = sync.entityId)
)

View File

@@ -0,0 +1,2 @@
UPDATE attributes SET type = 'label', name = 'label:' || name WHERE type = 'label-definition';
UPDATE attributes SET type = 'label', name = 'relation:' || name WHERE type = 'relation-definition';

View File

@@ -0,0 +1,79 @@
const sql = require('../../src/services/sql');
module.exports = () => {
for (const attr of sql.getRows("SELECT * FROM attributes WHERE name LIKE 'label:%'")) {
let obj;
try {
obj = JSON.parse(attr.value);
}
catch (e) {
console.log(`Parsing attribute definition "${attr.value}" of ${attr.attributeId} failed with error "${e.message}", setting to default value.`);
sql.execute('UPDATE attributes SET value = ? WHERE attributeId = ?',
["multi,text", attr.attributeId]);
continue;
}
const tokens = [];
if (obj.isPromoted) {
tokens.push('promoted');
}
if (obj.multiplicityType === 'singlevalue') {
tokens.push('single');
} else if (obj.multiplicityType === 'multivalue') {
tokens.push('multi');
}
if (obj.labelType) {
tokens.push(obj.labelType);
}
if (obj.numberPrecision) {
tokens.push('precision='+obj.numberPrecision);
}
const newValue = tokens.join(',');
sql.execute('UPDATE attributes SET value = ? WHERE attributeId = ?', [newValue, attr.attributeId]);
}
for (const attr of sql.getRows("SELECT * FROM attributes WHERE name LIKE 'relation:%'")) {
let obj;
try {
obj = JSON.parse(attr.value);
}
catch (e) {
console.log(`Parsing attribute definition "${attr.value}" of ${attr.attributeId} failed with error "${e.message}", setting to default value.`);
sql.execute('UPDATE attributes SET value = ? WHERE attributeId = ?',
["multi", attr.attributeId]);
continue;
}
const tokens = [];
if (obj.isPromoted) {
tokens.push('promoted');
}
if (obj.multiplicityType === 'singlevalue') {
tokens.push('single');
} else if (obj.multiplicityType === 'multivalue') {
tokens.push('multi');
}
if (obj.inverseRelation) {
tokens.push('inverse=' + obj.inverseRelation);
}
const newValue = tokens.join(',');
sql.execute('UPDATE attributes SET value = ? WHERE attributeId = ?', [newValue, attr.attributeId]);
}
};

View File

@@ -0,0 +1 @@
DROP TABLE source_ids;

View File

@@ -0,0 +1 @@
ALTER TABLE sync RENAME TO entity_changes;

View File

@@ -0,0 +1,22 @@
CREATE TABLE IF NOT EXISTS "mig_entity_changes" (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`entityName` TEXT NOT NULL,
`entityId` TEXT NOT NULL,
`sourceId` TEXT NOT NULL,
`isSynced` INTEGER default 0 not null,
`utcChangedDate` TEXT NOT NULL);
INSERT INTO mig_entity_changes (id, entityName, entityId, sourceId, isSynced, utcChangedDate)
SELECT id, entityName, entityId, sourceId, isSynced, utcSyncDate FROM entity_changes;
DROP TABLE entity_changes;
ALTER TABLE mig_entity_changes RENAME TO entity_changes;
CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" (
`entityName`,
`entityId`
);
CREATE INDEX `IDX_entityChanges_utcChangedDate` ON "entity_changes" (
`utcChangedDate`
);

View File

@@ -0,0 +1,55 @@
CREATE TABLE IF NOT EXISTS "notes_mig" (
`noteId` TEXT NOT NULL,
`title` TEXT NOT NULL DEFAULT "note",
`isProtected` INT NOT NULL DEFAULT 0,
`type` TEXT NOT NULL DEFAULT 'text',
`mime` TEXT NOT NULL DEFAULT 'text/html',
`hash` TEXT DEFAULT "" NOT NULL,
`isDeleted` INT NOT NULL DEFAULT 0,
`deleteId` TEXT DEFAULT NULL,
`isErased` INT NOT NULL DEFAULT 0,
`dateCreated` TEXT NOT NULL,
`dateModified` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
PRIMARY KEY(`noteId`));
INSERT INTO notes_mig (noteId, title, isProtected, type, mime, hash, isDeleted, deleteId, isErased, dateCreated, dateModified, utcDateCreated, utcDateModified)
SELECT noteId, title, isProtected, type, mime, hash, isDeleted, deleteId, isErased, dateCreated, dateModified, utcDateCreated, utcDateModified FROM notes;
DROP TABLE notes;
ALTER TABLE notes_mig RENAME TO notes;
CREATE INDEX `IDX_notes_isDeleted` ON `notes` (`isDeleted`);
CREATE INDEX `IDX_notes_title` ON `notes` (`title`);
CREATE INDEX `IDX_notes_type` ON `notes` (`type`);
CREATE INDEX `IDX_notes_dateCreated` ON `notes` (`dateCreated`);
CREATE INDEX `IDX_notes_dateModified` ON `notes` (`dateModified`);
CREATE INDEX `IDX_notes_utcDateModified` ON `notes` (`utcDateModified`);
CREATE INDEX `IDX_notes_utcDateCreated` ON `notes` (`utcDateCreated`);
CREATE TABLE IF NOT EXISTS "note_revisions_mig" (`noteRevisionId` TEXT NOT NULL PRIMARY KEY,
`noteId` TEXT NOT NULL,
`title` TEXT,
`isErased` INT NOT NULL DEFAULT 0,
`isProtected` INT NOT NULL DEFAULT 0,
`utcDateLastEdited` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
`dateLastEdited` TEXT NOT NULL,
`dateCreated` TEXT NOT NULL,
type TEXT DEFAULT '' NOT NULL,
mime TEXT DEFAULT '' NOT NULL,
hash TEXT DEFAULT '' NOT NULL);
INSERT INTO note_revisions_mig (noteRevisionId, noteId, title, isErased, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated, type, mime, hash)
SELECT noteRevisionId, noteId, title, isErased, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated, type, mime, hash FROM note_revisions;
DROP TABLE note_revisions;
ALTER TABLE note_revisions_mig RENAME TO note_revisions;
CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (`noteId`);
CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCreated`);
CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`);
CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`);
CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`);

View File

@@ -0,0 +1,20 @@
CREATE TABLE IF NOT EXISTS "note_contents_mig" (
`noteId` TEXT NOT NULL,
`content` TEXT NULL DEFAULT NULL,
`hash` TEXT DEFAULT "" NOT NULL,
`dateModified` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
PRIMARY KEY(`noteId`)
);
INSERT INTO note_contents_mig (noteId, content, hash, dateModified, utcDateModified)
SELECT noteId,
content,
hash,
COALESCE((SELECT dateModified FROM notes WHERE noteId = note_contents.noteId), utcDateModified),
utcDateModified
FROM note_contents;
DROP TABLE note_contents;
ALTER TABLE note_contents_mig RENAME TO note_contents;

View File

@@ -0,0 +1 @@
DELETE FROM options WHERE name = 'keyboardShortcutsActivateParentNote';

View File

@@ -0,0 +1 @@
UPDATE attributes SET name = 'archived' WHERE name = 'hideInAutocomplete';

View File

@@ -0,0 +1,20 @@
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 origContent = note.getContent();
const newContent = origContent
.replace(/<h1/ig, "<h2")
.replace(/<\/h1/ig, "</h2");
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

@@ -0,0 +1,14 @@
const repository = require('../../src/services/repository');
const sql = require('../../src/services/sql');
module.exports = () => {
for (const note of repository.getEntities("SELECT * FROM notes")) {
let position = 0;
for (const branch of note.getChildBranches()) {
sql.execute(`UPDATE branches SET notePosition = ? WHERE branchId = ?`, [position, branch.branchId]);
position += 10;
}
}
};

View File

@@ -0,0 +1,15 @@
DELETE FROM options WHERE name IN (
'noteInfoWidget',
'attributesWidget',
'linkMapWidget',
'noteRevisionsWidget',
'whatLinksHereWidget',
'codeNotesMimeTypes',
'similarNotesWidget',
'editedNotesWidget',
'calendarWidget',
'sidebarMinWidth',
'sidebarWidthPercent',
'showSidebarInNewTab',
'hoistedNoteId'
);

View File

@@ -0,0 +1,69 @@
CREATE TABLE IF NOT EXISTS "mig_entity_changes" (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`entityName` TEXT NOT NULL,
`entityId` TEXT NOT NULL,
`hash` TEXT NOT NULL,
`sourceId` TEXT NOT NULL,
`isErased` INT NOT NULL,
`utcDateChanged` TEXT NOT NULL,
`isSynced` INTEGER NOT NULL);
INSERT INTO mig_entity_changes (id, entityName, entityId, hash, sourceId, isSynced, utcDateChanged, isErased)
SELECT id, entityName, entityId, '', sourceId, isSynced, utcChangedDate, 0 FROM entity_changes;
UPDATE mig_entity_changes SET isErased = (SELECT isErased FROM notes WHERE noteId = entityId) WHERE entityName = 'notes';
UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM notes WHERE noteId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'notes';
UPDATE mig_entity_changes SET isErased = (SELECT isErased FROM notes WHERE noteId = entityId) WHERE entityName = 'note_contents';
UPDATE mig_entity_changes SET isErased = (
SELECT isErased
FROM attributes
JOIN notes USING(noteId)
WHERE attributeId = entityId
) WHERE entityName = 'attributes';
UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM attributes WHERE attributeId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'attributes';
UPDATE mig_entity_changes SET isErased = (
SELECT isErased
FROM branches
JOIN notes USING(noteId)
WHERE branchId = entityId
) WHERE entityName = 'branches';
UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM branches WHERE branchId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'branches';
UPDATE mig_entity_changes SET isErased = (
SELECT isErased
FROM note_revisions
WHERE noteRevisionId = entityId
) WHERE entityName = 'note_revisions';
UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM note_revisions WHERE noteRevisionId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'note_revisions';
UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateCreated FROM api_tokens WHERE apiTokenId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'api_tokens';
UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM note_contents WHERE noteId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'note_contents';
UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM note_revision_contents WHERE noteRevisionId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'note_revision_contents';
UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM options WHERE name = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'options';
UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateCreated FROM recent_notes WHERE noteId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'options';
DROP TABLE entity_changes;
ALTER TABLE mig_entity_changes RENAME TO entity_changes;
CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" (
`entityName`,
`entityId`
);
DELETE FROM attributes WHERE noteId IN (SELECT noteId FROM notes WHERE isErased = 1);
DELETE FROM branches WHERE noteId IN (SELECT noteId FROM notes WHERE isErased = 1);
DELETE FROM note_contents WHERE noteId IN (SELECT noteId FROM notes WHERE isErased = 1);
DELETE FROM note_revision_contents WHERE noteRevisionId IN (
SELECT noteRevisionId FROM note_revisions WHERE isErased = 1
);
DELETE FROM note_revisions WHERE isErased = 1;
DELETE FROM notes WHERE isErased = 1;
UPDATE entity_changes SET isErased = COALESCE((SELECT isErased FROM entity_changes AS sub WHERE sub.entityId = entity_changes.entityId AND sub.entityName = 'note_revisions'), 0) WHERE entityName = 'note_revision_contents';

View File

@@ -0,0 +1,198 @@
CREATE TABLE IF NOT EXISTS "mig_entity_changes" (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`entityName` TEXT NOT NULL,
`entityId` TEXT NOT NULL,
`hash` TEXT NOT NULL,
`isErased` INT NOT NULL,
`sourceId` TEXT NOT NULL,
`isSynced` INTEGER NOT NULL,
`utcDateChanged` TEXT NOT NULL
);
INSERT INTO mig_entity_changes (id, entityName, entityId, hash, sourceId, isSynced, isErased, utcDateChanged)
SELECT id, entityName, entityId, '', sourceId, isSynced, isErased, utcDateChanged FROM entity_changes;
UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM api_tokens WHERE apiTokenId = entityId), '') WHERE entityName = 'api_tokens';
UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM attributes WHERE attributeId = entityId), '') WHERE entityName = 'attributes';
UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM branches WHERE branchId = entityId), '') WHERE entityName = 'branches';
UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM notes WHERE noteId = entityId), '') WHERE entityName = 'notes';
UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM note_contents WHERE noteId = entityId), '') WHERE entityName = 'note_contents';
UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM note_revisions WHERE noteRevisionId = entityId), '') WHERE entityName = 'note_revisions';
UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM note_revision_contents WHERE noteRevisionId = entityId), '') WHERE entityName = 'note_revision_contents';
UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM options WHERE name = entityId), '') WHERE entityName = 'options';
UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM recent_notes WHERE noteId = entityId), '') WHERE entityName = 'recent_notes';
DROP TABLE entity_changes;
ALTER TABLE mig_entity_changes RENAME TO entity_changes;
CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" (
`entityName`,
`entityId`
);
CREATE TABLE IF NOT EXISTS "mig_api_tokens"
(
apiTokenId TEXT PRIMARY KEY NOT NULL,
token TEXT NOT NULL,
utcDateCreated TEXT NOT NULL,
isDeleted INT NOT NULL DEFAULT 0);
INSERT INTO mig_api_tokens (apiTokenId, token, utcDateCreated, isDeleted)
SELECT apiTokenId, token, utcDateCreated, isDeleted FROM api_tokens;
DROP TABLE api_tokens;
ALTER TABLE mig_api_tokens RENAME TO api_tokens;
CREATE TABLE IF NOT EXISTS "mig_attributes"
(
attributeId TEXT not null primary key,
noteId TEXT not null,
type TEXT not null,
name TEXT not null,
value TEXT default '' not null,
position INT default 0 not null,
utcDateCreated TEXT not null,
utcDateModified TEXT not null,
isDeleted INT not null,
`deleteId` TEXT DEFAULT NULL,
isInheritable int DEFAULT 0 NULL);
INSERT INTO mig_attributes (attributeId, noteId, type, name, value, position, utcDateCreated, utcDateModified, isDeleted, deleteId, isInheritable)
SELECT attributeId, noteId, type, name, value, position, utcDateCreated, utcDateModified, isDeleted, deleteId, isInheritable FROM attributes;
DROP TABLE attributes;
ALTER TABLE mig_attributes RENAME TO attributes;
CREATE INDEX IDX_attributes_name_value
on attributes (name, value);
CREATE INDEX IDX_attributes_noteId_index
on attributes (noteId);
CREATE INDEX IDX_attributes_value_index
on attributes (value);
CREATE TABLE IF NOT EXISTS "mig_branches" (
`branchId` TEXT NOT NULL,
`noteId` TEXT NOT NULL,
`parentNoteId` TEXT NOT NULL,
`notePosition` INTEGER NOT NULL,
`prefix` TEXT,
`isExpanded` INTEGER NOT NULL DEFAULT 0,
`isDeleted` INTEGER NOT NULL DEFAULT 0,
`deleteId` TEXT DEFAULT NULL,
`utcDateModified` TEXT NOT NULL,
utcDateCreated TEXT NOT NULL,
PRIMARY KEY(`branchId`));
INSERT INTO mig_branches (branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, deleteId, utcDateModified, utcDateCreated)
SELECT branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, deleteId, utcDateModified, utcDateCreated FROM branches;
DROP TABLE branches;
ALTER TABLE mig_branches RENAME TO branches;
CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` (`noteId`,`parentNoteId`);
CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId);
CREATE TABLE IF NOT EXISTS "mig_notes" (
`noteId` TEXT NOT NULL,
`title` TEXT NOT NULL DEFAULT "note",
`isProtected` INT NOT NULL DEFAULT 0,
`type` TEXT NOT NULL DEFAULT 'text',
`mime` TEXT NOT NULL DEFAULT 'text/html',
`isDeleted` INT NOT NULL DEFAULT 0,
`deleteId` TEXT DEFAULT NULL,
`dateCreated` TEXT NOT NULL,
`dateModified` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
PRIMARY KEY(`noteId`));
INSERT INTO mig_notes (noteId, title, isProtected, type, mime, isDeleted, deleteId, dateCreated, dateModified, utcDateCreated, utcDateModified)
SELECT noteId, title, isProtected, type, mime, isDeleted, deleteId, dateCreated, dateModified, utcDateCreated, utcDateModified FROM notes;
DROP TABLE notes;
ALTER TABLE mig_notes RENAME TO notes;
CREATE INDEX `IDX_notes_isDeleted` ON `notes` (`isDeleted`);
CREATE INDEX `IDX_notes_title` ON `notes` (`title`);
CREATE INDEX `IDX_notes_type` ON `notes` (`type`);
CREATE INDEX `IDX_notes_dateCreated` ON `notes` (`dateCreated`);
CREATE INDEX `IDX_notes_dateModified` ON `notes` (`dateModified`);
CREATE INDEX `IDX_notes_utcDateModified` ON `notes` (`utcDateModified`);
CREATE INDEX `IDX_notes_utcDateCreated` ON `notes` (`utcDateCreated`);
CREATE TABLE IF NOT EXISTS "mig_note_contents" (
`noteId` TEXT NOT NULL,
`content` TEXT NULL DEFAULT NULL,
`dateModified` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
PRIMARY KEY(`noteId`)
);
INSERT INTO mig_note_contents (noteId, content, dateModified, utcDateModified)
SELECT noteId, content, dateModified, utcDateModified FROM note_contents;
DROP TABLE note_contents;
ALTER TABLE mig_note_contents RENAME TO note_contents;
CREATE TABLE IF NOT EXISTS "mig_note_revisions" (`noteRevisionId` TEXT NOT NULL PRIMARY KEY,
`noteId` TEXT NOT NULL,
type TEXT DEFAULT '' NOT NULL,
mime TEXT DEFAULT '' NOT NULL,
`title` TEXT,
`isProtected` INT NOT NULL DEFAULT 0,
`utcDateLastEdited` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
`dateLastEdited` TEXT NOT NULL,
`dateCreated` TEXT NOT NULL);
INSERT INTO mig_note_revisions (noteRevisionId, noteId, type, mime, title, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated)
SELECT noteRevisionId, noteId, type, mime, title, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated FROM note_revisions;
DROP TABLE note_revisions;
ALTER TABLE mig_note_revisions RENAME TO note_revisions;
CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (`noteId`);
CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCreated`);
CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`);
CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`);
CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`);
CREATE TABLE IF NOT EXISTS "mig_note_revision_contents" (`noteRevisionId` TEXT NOT NULL PRIMARY KEY,
`content` TEXT,
`utcDateModified` TEXT NOT NULL);
INSERT INTO mig_note_revision_contents (noteRevisionId, content, utcDateModified)
SELECT noteRevisionId, content, utcDateModified FROM note_revision_contents;
DROP TABLE note_revision_contents;
ALTER TABLE mig_note_revision_contents RENAME TO note_revision_contents;
CREATE TABLE IF NOT EXISTS "mig_options"
(
name TEXT not null PRIMARY KEY,
value TEXT,
isSynced INTEGER default 0 not null,
utcDateCreated TEXT not null,
utcDateModified TEXT NOT NULL
);
INSERT INTO mig_options (name, value, isSynced, utcDateCreated, utcDateModified)
SELECT name, value, isSynced, utcDateCreated, utcDateModified FROM options;
DROP TABLE options;
ALTER TABLE mig_options RENAME TO options;
CREATE TABLE mig_recent_notes
(
noteId TEXT not null primary key,
notePath TEXT not null,
utcDateCreated TEXT not null,
isDeleted INT NOT NULL DEFAULT 0
);
INSERT INTO mig_recent_notes (noteId, notePath, utcDateCreated, isDeleted)
SELECT noteId, notePath, utcDateCreated, isDeleted FROM recent_notes;
DROP TABLE recent_notes;
ALTER TABLE mig_recent_notes RENAME TO recent_notes;

View File

@@ -0,0 +1,2 @@
UPDATE options SET name = 'eraseEntitiesAfterTimeInSeconds' WHERE name = 'eraseNotesAfterTimeInSeconds';
UPDATE entity_changes SET entityId = 'eraseEntitiesAfterTimeInSeconds' WHERE entityName = 'options' AND entityId = 'eraseNotesAfterTimeInSeconds';

View File

@@ -0,0 +1,25 @@
CREATE TABLE IF NOT EXISTS "mig_attributes"
(
attributeId TEXT not null primary key,
noteId TEXT not null,
type TEXT not null,
name TEXT not null,
value TEXT default '' not null,
position INT default 0 not null,
utcDateModified TEXT not null,
isDeleted INT not null,
`deleteId` TEXT DEFAULT NULL,
isInheritable int DEFAULT 0 NULL);
INSERT INTO mig_attributes (attributeId, noteId, type, name, value, position, utcDateModified, isDeleted, deleteId, isInheritable)
SELECT attributeId, noteId, type, name, value, position, utcDateModified, isDeleted, deleteId, isInheritable FROM attributes;
DROP TABLE attributes;
ALTER TABLE mig_attributes RENAME TO attributes;
CREATE INDEX IDX_attributes_name_value
on attributes (name, value);
CREATE INDEX IDX_attributes_noteId_index
on attributes (noteId);
CREATE INDEX IDX_attributes_value_index
on attributes (value);

View File

@@ -0,0 +1,5 @@
DELETE FROM options WHERE name = 'keyboardShortcutsCreateNoteIntoInbox'; -- in case there is already one which shouldn't (except for in-dev documents)
UPDATE options SET name = 'keyboardShortcutsCreateNoteIntoInbox' WHERE name = 'keyboardShortcutsCreateNoteIntoDayNote';
DELETE FROM options WHERE name = 'keyboardShortcutsShowAttributes';
DELETE FROM entity_changes WHERE entityName = 'options' AND entityId = 'keyboardShortcutsShowAttributes';

View File

@@ -0,0 +1 @@
DROP INDEX IDX_notes_isDeleted;

View File

@@ -0,0 +1 @@
VACUUM

View File

@@ -0,0 +1,2 @@
UPDATE options SET name = 'keyboardShortcutsQuickSearch' WHERE name = 'keyboardShortcutsSearchNotes';
UPDATE entity_changes SET entityId = 'keyboardShortcutsQuickSearch' WHERE entityId = 'keyboardShortcutsSearchNotes' AND entityName = 'options';

View File

@@ -0,0 +1,5 @@
UPDATE entity_changes SET isSynced = COALESCE((
SELECT options.isSynced
FROM options
WHERE options.name = entity_changes.entityId
), 0) WHERE entityName = 'options';

View File

@@ -0,0 +1,14 @@
DELETE FROM entity_changes WHERE entityName = 'recent_notes';
CREATE TABLE IF NOT EXISTS "mig_recent_notes"
(
noteId TEXT not null primary key,
notePath TEXT not null,
utcDateCreated TEXT not null
);
INSERT INTO mig_recent_notes (noteId, notePath, utcDateCreated)
SELECT noteId, notePath, utcDateCreated FROM recent_notes;
DROP TABLE recent_notes;
ALTER TABLE mig_recent_notes RENAME TO recent_notes;

View File

@@ -0,0 +1,25 @@
const repository = require('../../src/services/repository');
module.exports = () => {
for (const note of repository.getEntities("SELECT * FROM notes WHERE type = 'search' AND isProtected = 0 AND isDeleted = 0")) {
try {
let origContent = note.getJsonContent();
if (!origContent) {
continue;
}
note.addLabel('searchString', origContent.searchString);
note.setContent('');
note.mime = 'text/plain';
note.save();
console.log(`Migrated search note ${note.noteId}`);
}
catch (e) {
console.log(`Changing note content for note ${note.noteId} failed with: ${e.message} ${e.stack}`);
}
}
};

View File

@@ -1,87 +1,19 @@
CREATE TABLE IF NOT EXISTS "source_ids" (
`sourceId` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
PRIMARY KEY(`sourceId`)
);
CREATE TABLE IF NOT EXISTS "entity_changes" (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`entityName` TEXT NOT NULL,
`entityId` TEXT NOT NULL,
`hash` TEXT NOT NULL,
`isErased` INT NOT NULL,
`sourceId` TEXT NOT NULL,
`isSynced` INTEGER NOT NULL,
`utcDateChanged` TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS "api_tokens"
(
apiTokenId TEXT PRIMARY KEY NOT NULL,
token TEXT NOT NULL,
utcDateCreated TEXT NOT NULL,
isDeleted INT NOT NULL DEFAULT 0,
hash TEXT DEFAULT "" NOT NULL);
CREATE TABLE IF NOT EXISTS "options"
(
name TEXT not null PRIMARY KEY,
value TEXT,
isSynced INTEGER default 0 not null,
hash TEXT default "" not null,
utcDateCreated TEXT not null,
utcDateModified TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS "note_contents" (
`noteId` TEXT NOT NULL,
`content` TEXT NULL DEFAULT NULL,
`hash` TEXT DEFAULT "" NOT NULL,
`utcDateModified` TEXT NOT NULL,
PRIMARY KEY(`noteId`)
);
CREATE TABLE recent_notes
(
noteId TEXT not null primary key,
notePath TEXT not null,
hash TEXT default "" not null,
utcDateCreated TEXT not null,
isDeleted INT
);
CREATE TABLE IF NOT EXISTS "note_revision_contents" (`noteRevisionId` TEXT NOT NULL PRIMARY KEY,
`content` TEXT,
hash TEXT DEFAULT '' NOT NULL,
`utcDateModified` TEXT NOT NULL);
CREATE TABLE IF NOT EXISTS "note_revisions" (`noteRevisionId` TEXT NOT NULL PRIMARY KEY,
`noteId` TEXT NOT NULL,
`title` TEXT,
`contentLength` INT NOT NULL,
`isErased` INT NOT NULL DEFAULT 0,
`isProtected` INT NOT NULL DEFAULT 0,
`utcDateLastEdited` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
`dateLastEdited` TEXT NOT NULL,
`dateCreated` TEXT NOT NULL,
type TEXT DEFAULT '' NOT NULL,
mime TEXT DEFAULT '' NOT NULL,
hash TEXT DEFAULT '' NOT NULL);
CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (`noteId`);
CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCreated`);
CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`);
CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`);
CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`);
CREATE INDEX IDX_source_ids_utcDateCreated
on source_ids (utcDateCreated);
CREATE TABLE IF NOT EXISTS "notes" (
`noteId` TEXT NOT NULL,
`title` TEXT NOT NULL DEFAULT "note",
`contentLength` INT NOT NULL,
`isProtected` INT NOT NULL DEFAULT 0,
`type` TEXT NOT NULL DEFAULT 'text',
`mime` TEXT NOT NULL DEFAULT 'text/html',
`hash` TEXT DEFAULT "" NOT NULL,
`isDeleted` INT NOT NULL DEFAULT 0,
`deleteId` TEXT DEFAULT NULL,
`isErased` INT NOT NULL DEFAULT 0,
`dateCreated` TEXT NOT NULL,
`dateModified` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
PRIMARY KEY(`noteId`));
CREATE INDEX `IDX_notes_isDeleted` ON `notes` (`isDeleted`);
CREATE INDEX `IDX_notes_title` ON `notes` (`title`);
CREATE INDEX `IDX_notes_type` ON `notes` (`type`);
CREATE INDEX `IDX_notes_dateCreated` ON `notes` (`dateCreated`);
CREATE INDEX `IDX_notes_dateModified` ON `notes` (`dateModified`);
CREATE INDEX `IDX_notes_utcDateModified` ON `notes` (`utcDateModified`);
CREATE INDEX `IDX_notes_utcDateCreated` ON `notes` (`utcDateCreated`);
apiTokenId TEXT PRIMARY KEY NOT NULL,
token TEXT NOT NULL,
utcDateCreated TEXT NOT NULL,
isDeleted INT NOT NULL DEFAULT 0);
CREATE TABLE IF NOT EXISTS "branches" (
`branchId` TEXT NOT NULL,
`noteId` TEXT NOT NULL,
@@ -93,10 +25,49 @@ CREATE TABLE IF NOT EXISTS "branches" (
`deleteId` TEXT DEFAULT NULL,
`utcDateModified` TEXT NOT NULL,
utcDateCreated TEXT NOT NULL,
hash TEXT DEFAULT "" NOT NULL,
PRIMARY KEY(`branchId`));
CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` (`noteId`,`parentNoteId`);
CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId);
CREATE TABLE IF NOT EXISTS "notes" (
`noteId` TEXT NOT NULL,
`title` TEXT NOT NULL DEFAULT "note",
`isProtected` INT NOT NULL DEFAULT 0,
`type` TEXT NOT NULL DEFAULT 'text',
`mime` TEXT NOT NULL DEFAULT 'text/html',
`isDeleted` INT NOT NULL DEFAULT 0,
`deleteId` TEXT DEFAULT NULL,
`dateCreated` TEXT NOT NULL,
`dateModified` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
PRIMARY KEY(`noteId`));
CREATE TABLE IF NOT EXISTS "note_contents" (
`noteId` TEXT NOT NULL,
`content` TEXT NULL DEFAULT NULL,
`dateModified` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
PRIMARY KEY(`noteId`)
);
CREATE TABLE IF NOT EXISTS "note_revisions" (`noteRevisionId` TEXT NOT NULL PRIMARY KEY,
`noteId` TEXT NOT NULL,
type TEXT DEFAULT '' NOT NULL,
mime TEXT DEFAULT '' NOT NULL,
`title` TEXT,
`isProtected` INT NOT NULL DEFAULT 0,
`utcDateLastEdited` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
`dateLastEdited` TEXT NOT NULL,
`dateCreated` TEXT NOT NULL);
CREATE TABLE IF NOT EXISTS "note_revision_contents" (`noteRevisionId` TEXT NOT NULL PRIMARY KEY,
`content` TEXT,
`utcDateModified` TEXT NOT NULL);
CREATE TABLE IF NOT EXISTS "options"
(
name TEXT not null PRIMARY KEY,
value TEXT,
isSynced INTEGER default 0 not null,
utcDateCreated TEXT not null,
utcDateModified TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS "attributes"
(
attributeId TEXT not null primary key,
@@ -105,29 +76,36 @@ CREATE TABLE IF NOT EXISTS "attributes"
name TEXT not null,
value TEXT default '' not null,
position INT default 0 not null,
utcDateCreated TEXT not null,
utcDateModified TEXT not null,
isDeleted INT not null,
`deleteId` TEXT DEFAULT NULL,
hash TEXT default "" not null,
isInheritable int DEFAULT 0 NULL);
CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" (
`entityName`,
`entityId`
);
CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` (`noteId`,`parentNoteId`);
CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId);
CREATE INDEX `IDX_notes_title` ON `notes` (`title`);
CREATE INDEX `IDX_notes_type` ON `notes` (`type`);
CREATE INDEX `IDX_notes_dateCreated` ON `notes` (`dateCreated`);
CREATE INDEX `IDX_notes_dateModified` ON `notes` (`dateModified`);
CREATE INDEX `IDX_notes_utcDateModified` ON `notes` (`utcDateModified`);
CREATE INDEX `IDX_notes_utcDateCreated` ON `notes` (`utcDateCreated`);
CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (`noteId`);
CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCreated`);
CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`);
CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`);
CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`);
CREATE INDEX IDX_attributes_name_value
on attributes (name, value);
CREATE INDEX IDX_attributes_noteId_index
on attributes (noteId);
CREATE INDEX IDX_attributes_value_index
on attributes (value);
CREATE TABLE IF NOT EXISTS "sync" (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`entityName` TEXT NOT NULL,
`entityId` TEXT NOT NULL,
`sourceId` TEXT NOT NULL,
`isSynced` INTEGER default 0 not null,
`utcSyncDate` TEXT NOT NULL);
CREATE UNIQUE INDEX `IDX_sync_entityName_entityId` ON `sync` (
`entityName`,
`entityId`
);
CREATE INDEX `IDX_sync_utcSyncDate` ON `sync` (
`utcSyncDate`
);
CREATE TABLE IF NOT EXISTS "recent_notes"
(
noteId TEXT not null primary key,
notePath TEXT not null,
utcDateCreated TEXT not null
);

View File

@@ -293,7 +293,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -106,7 +106,7 @@
<td class="description last"></td>
<td class="description last">immutable</td>
</tr>
@@ -129,7 +129,7 @@
<td class="description last"></td>
<td class="description last">immutable</td>
</tr>
@@ -152,7 +152,7 @@
<td class="description last"></td>
<td class="description last">immutable</td>
</tr>
@@ -175,7 +175,7 @@
<td class="description last"></td>
<td class="description last">immutable</td>
</tr>
@@ -244,7 +244,7 @@
<td class="description last"></td>
<td class="description last">immutable</td>
</tr>
@@ -298,29 +298,6 @@
<tr>
<td class="name"><code>utcDateCreated</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>utcDateModified</code></td>
@@ -378,7 +355,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line30">line 30</a>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line25">line 25</a>
</li></ul></dd>
@@ -445,7 +422,7 @@
<h4 class="name" id="getNote"><span class="type-signature">(async) </span>getNote<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getNote"><span class="type-signature"></span>getNote<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -493,7 +470,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line47">line 47</a>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line43">line 43</a>
</li></ul></dd>
@@ -529,7 +506,10 @@
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -547,7 +527,7 @@
<h4 class="name" id="getTargetNote"><span class="type-signature">(async) </span>getTargetNote<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getTargetNote"><span class="type-signature"></span>getTargetNote<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -595,7 +575,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line54">line 54</a>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line50">line 50</a>
</li></ul></dd>
@@ -631,7 +611,10 @@
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -697,7 +680,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line69">line 69</a>
<a href="entities_attribute.js.html">entities/attribute.js</a>, <a href="entities_attribute.js.html#line65">line 65</a>
</li></ul></dd>
@@ -767,7 +750,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -471,7 +471,7 @@
<h4 class="name" id="createDataNote"><span class="type-signature"></span>createDataNote<span class="signature">(parentNoteId, title, content)</span><span class="type-signature"> &rarr; {Promise.&lt;{note: <a href="Note.html">Note</a>, branch: <a href="Branch.html">Branch</a>}>}</span></h4>
<h4 class="name" id="createDataNote"><span class="type-signature"></span>createDataNote<span class="signature">(parentNoteId, title, content)</span><span class="type-signature"> &rarr; {Object}</span></h4>
@@ -619,7 +619,7 @@ JSON MIME type. See also createNewNote() for more options.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line204">line 204</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line207">line 207</a>
</li></ul></dd>
@@ -655,7 +655,7 @@ JSON MIME type. See also createNewNote() for more options.
</dt>
<dd>
<span class="param-type">Promise.&lt;{note: <a href="Note.html">Note</a>, branch: <a href="Branch.html">Branch</a>}></span>
<span class="param-type">Object</span>
</dd>
@@ -673,7 +673,7 @@ JSON MIME type. See also createNewNote() for more options.
<h4 class="name" id="createNewNote"><span class="type-signature"></span>createNewNote<span class="signature">(params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;{note: <a href="Note.html">Note</a>, branch: <a href="Branch.html">Branch</a>}>}</span></h4>
<h4 class="name" id="createNewNote"><span class="type-signature"></span>createNewNote<span class="signature">(params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Object}</span></h4>
@@ -782,7 +782,7 @@ JSON MIME type. See also createNewNote() for more options.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line231">line 231</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line234">line 234</a>
</li></ul></dd>
@@ -822,7 +822,7 @@ JSON MIME type. See also createNewNote() for more options.
</dt>
<dd>
<span class="param-type">Promise.&lt;{note: <a href="Note.html">Note</a>, branch: <a href="Branch.html">Branch</a>}></span>
<span class="param-type">Object</span>
</dd>
@@ -840,7 +840,7 @@ JSON MIME type. See also createNewNote() for more options.
<h4 class="name" id="createNote"><span class="type-signature"></span>createNote<span class="signature">(parentNoteId, title, content<span class="signature-attributes">opt</span>, extraOptions<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;{note: <a href="Note.html">Note</a>, branch: <a href="Branch.html">Branch</a>}>}</span></h4>
<h4 class="name" id="createNote"><span class="type-signature"></span>createNote<span class="signature">(parentNoteId, title, content<span class="signature-attributes">opt</span>, extraOptions<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Object}</span></h4>
@@ -1054,7 +1054,7 @@ JSON MIME type. See also createNewNote() for more options.
<dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>please use createNote() API method instead</li></ul></dd>
<dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>please use createTextNote() with similar API for simpler use cases or createNewNote() for more complex needs</li></ul></dd>
@@ -1068,7 +1068,7 @@ JSON MIME type. See also createNewNote() for more options.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line259">line 259</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line262">line 262</a>
</li></ul></dd>
@@ -1108,7 +1108,7 @@ JSON MIME type. See also createNewNote() for more options.
</dt>
<dd>
<span class="param-type">Promise.&lt;{note: <a href="Note.html">Note</a>, branch: <a href="Branch.html">Branch</a>}></span>
<span class="param-type">Object</span>
</dd>
@@ -1126,7 +1126,7 @@ JSON MIME type. See also createNewNote() for more options.
<h4 class="name" id="createTextNote"><span class="type-signature"></span>createTextNote<span class="signature">(parentNoteId, title, content)</span><span class="type-signature"> &rarr; {Promise.&lt;{note: <a href="Note.html">Note</a>, branch: <a href="Branch.html">Branch</a>}>}</span></h4>
<h4 class="name" id="createTextNote"><span class="type-signature"></span>createTextNote<span class="signature">(parentNoteId, title, content)</span><span class="type-signature"> &rarr; {Object}</span></h4>
@@ -1273,7 +1273,7 @@ JSON MIME type. See also createNewNote() for more options.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line188">line 188</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line191">line 191</a>
</li></ul></dd>
@@ -1309,7 +1309,7 @@ JSON MIME type. See also createNewNote() for more options.
</dt>
<dd>
<span class="param-type">Promise.&lt;{note: <a href="Note.html">Note</a>, branch: <a href="Branch.html">Branch</a>}></span>
<span class="param-type">Object</span>
</dd>
@@ -1327,7 +1327,7 @@ JSON MIME type. See also createNewNote() for more options.
<h4 class="name" id="ensureNoteIsAbsentFromParent"><span class="type-signature"></span>ensureNoteIsAbsentFromParent<span class="signature">(noteId, parentNoteId)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<h4 class="name" id="ensureNoteIsAbsentFromParent"><span class="type-signature"></span>ensureNoteIsAbsentFromParent<span class="signature">(noteId, parentNoteId)</span><span class="type-signature"> &rarr; {void}</span></h4>
@@ -1451,7 +1451,7 @@ JSON MIME type. See also createNewNote() for more options.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line159">line 159</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line162">line 162</a>
</li></ul></dd>
@@ -1487,7 +1487,7 @@ JSON MIME type. See also createNewNote() for more options.
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
<span class="param-type">void</span>
</dd>
@@ -1505,7 +1505,7 @@ JSON MIME type. See also createNewNote() for more options.
<h4 class="name" id="ensureNoteIsPresentInParent"><span class="type-signature"></span>ensureNoteIsPresentInParent<span class="signature">(noteId, parentNoteId, prefix)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<h4 class="name" id="ensureNoteIsPresentInParent"><span class="type-signature"></span>ensureNoteIsPresentInParent<span class="signature">(noteId, parentNoteId, prefix)</span><span class="type-signature"> &rarr; {void}</span></h4>
@@ -1652,7 +1652,7 @@ JSON MIME type. See also createNewNote() for more options.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line149">line 149</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line152">line 152</a>
</li></ul></dd>
@@ -1688,7 +1688,7 @@ JSON MIME type. See also createNewNote() for more options.
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
<span class="param-type">void</span>
</dd>
@@ -1754,7 +1754,7 @@ JSON MIME type. See also createNewNote() for more options.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line398">line 398</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line399">line 399</a>
</li></ul></dd>
@@ -1815,7 +1815,7 @@ JSON MIME type. See also createNewNote() for more options.
<h4 class="name" id="getAttribute"><span class="type-signature"></span>getAttribute<span class="signature">(attributeId)</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Attribute.html">Attribute</a>|null)>}</span></h4>
<h4 class="name" id="getAttribute"><span class="type-signature"></span>getAttribute<span class="signature">(attributeId)</span><span class="type-signature"> &rarr; {<a href="Attribute.html">Attribute</a>|null}</span></h4>
@@ -1948,7 +1948,10 @@ JSON MIME type. See also createNewNote() for more options.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Attribute.html">Attribute</a>|null)></span>
<span class="param-type"><a href="Attribute.html">Attribute</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -1966,7 +1969,7 @@ JSON MIME type. See also createNewNote() for more options.
<h4 class="name" id="getBranch"><span class="type-signature"></span>getBranch<span class="signature">(branchId)</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Branch.html">Branch</a>|null)>}</span></h4>
<h4 class="name" id="getBranch"><span class="type-signature"></span>getBranch<span class="signature">(branchId)</span><span class="type-signature"> &rarr; {<a href="Branch.html">Branch</a>|null}</span></h4>
@@ -2099,7 +2102,10 @@ JSON MIME type. See also createNewNote() for more options.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Branch.html">Branch</a>|null)></span>
<span class="param-type"><a href="Branch.html">Branch</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -2117,7 +2123,7 @@ JSON MIME type. See also createNewNote() for more options.
<h4 class="name" id="getDateNote"><span class="type-signature"></span>getDateNote<span class="signature">(date)</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getDateNote"><span class="type-signature"></span>getDateNote<span class="signature">(date)</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -2218,7 +2224,7 @@ JSON MIME type. See also createNewNote() for more options.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line315">line 315</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line320">line 320</a>
</li></ul></dd>
@@ -2254,7 +2260,10 @@ JSON MIME type. See also createNewNote() for more options.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -2272,7 +2281,7 @@ JSON MIME type. See also createNewNote() for more options.
<h4 class="name" id="getEntities"><span class="type-signature"></span>getEntities<span class="signature">(SQL, array)</span><span class="type-signature"> &rarr; {Promise.&lt;Array.&lt;<a href="Entity.html">Entity</a>>>}</span></h4>
<h4 class="name" id="getEntities"><span class="type-signature"></span>getEntities<span class="signature">(SQL, array)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="Entity.html">Entity</a>>}</span></h4>
@@ -2392,7 +2401,7 @@ JSON MIME type. See also createNewNote() for more options.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line94">line 94</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line87">line 87</a>
</li></ul></dd>
@@ -2428,7 +2437,7 @@ JSON MIME type. See also createNewNote() for more options.
</dt>
<dd>
<span class="param-type">Promise.&lt;Array.&lt;<a href="Entity.html">Entity</a>>></span>
<span class="param-type">Array.&lt;<a href="Entity.html">Entity</a>></span>
</dd>
@@ -2446,7 +2455,7 @@ JSON MIME type. See also createNewNote() for more options.
<h4 class="name" id="getEntity"><span class="type-signature"></span>getEntity<span class="signature">(SQL, array)</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Entity.html">Entity</a>|null)>}</span></h4>
<h4 class="name" id="getEntity"><span class="type-signature"></span>getEntity<span class="signature">(SQL, array)</span><span class="type-signature"> &rarr; {<a href="Entity.html">Entity</a>|null}</span></h4>
@@ -2570,7 +2579,7 @@ JSON MIME type. See also createNewNote() for more options.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line86">line 86</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line79">line 79</a>
</li></ul></dd>
@@ -2606,158 +2615,10 @@ JSON MIME type. See also createNewNote() for more options.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Entity.html">Entity</a>|null)></span>
<span class="param-type"><a href="Entity.html">Entity</a></span>
|
</dd>
</dl>
<h4 class="name" id="getImage"><span class="type-signature"></span>getImage<span class="signature">(imageId)</span><span class="type-signature"> &rarr; {Promise.&lt;(Image|null)>}</span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>imageId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line76">line 76</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;(Image|null)></span>
<span class="param-type">null</span>
</dd>
@@ -2885,7 +2746,7 @@ if some action needs to happen on only one specific instance.
<h4 class="name" id="getMonthNote"><span class="type-signature"></span>getMonthNote<span class="signature">(date)</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getMonthNote"><span class="type-signature"></span>getMonthNote<span class="signature">(date)</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -2986,7 +2847,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line342">line 342</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line347">line 347</a>
</li></ul></dd>
@@ -3022,7 +2883,10 @@ if some action needs to happen on only one specific instance.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -3040,7 +2904,7 @@ if some action needs to happen on only one specific instance.
<h4 class="name" id="getNote"><span class="type-signature"></span>getNote<span class="signature">(noteId)</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getNote"><span class="type-signature"></span>getNote<span class="signature">(noteId)</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -3173,7 +3037,10 @@ if some action needs to happen on only one specific instance.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -3191,7 +3058,7 @@ if some action needs to happen on only one specific instance.
<h4 class="name" id="getNotesWithLabel"><span class="type-signature"></span>getNotesWithLabel<span class="signature">(name, value<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Array.&lt;<a href="Note.html">Note</a>>>}</span></h4>
<h4 class="name" id="getNotesWithLabel"><span class="type-signature"></span>getNotesWithLabel<span class="signature">(name, value<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="Note.html">Note</a>>}</span></h4>
@@ -3335,7 +3202,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line128">line 128</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line131">line 131</a>
</li></ul></dd>
@@ -3371,7 +3238,7 @@ if some action needs to happen on only one specific instance.
</dt>
<dd>
<span class="param-type">Promise.&lt;Array.&lt;<a href="Note.html">Note</a>>></span>
<span class="param-type">Array.&lt;<a href="Note.html">Note</a>></span>
</dd>
@@ -3389,7 +3256,7 @@ if some action needs to happen on only one specific instance.
<h4 class="name" id="getNoteWithLabel"><span class="type-signature"></span>getNoteWithLabel<span class="signature">(name, value<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getNoteWithLabel"><span class="type-signature"></span>getNoteWithLabel<span class="signature">(name, value<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -3533,7 +3400,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line138">line 138</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line141">line 141</a>
</li></ul></dd>
@@ -3569,7 +3436,10 @@ if some action needs to happen on only one specific instance.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -3587,7 +3457,7 @@ if some action needs to happen on only one specific instance.
<h4 class="name" id="getRootCalendarNote"><span class="type-signature"></span>getRootCalendarNote<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getRootCalendarNote"><span class="type-signature"></span>getRootCalendarNote<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -3639,7 +3509,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line306">line 306</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line311">line 311</a>
</li></ul></dd>
@@ -3675,7 +3545,10 @@ if some action needs to happen on only one specific instance.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -3693,7 +3566,7 @@ if some action needs to happen on only one specific instance.
<h4 class="name" id="getTodayNote"><span class="type-signature"></span>getTodayNote<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getTodayNote"><span class="type-signature"></span>getTodayNote<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -3745,7 +3618,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line323">line 323</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line328">line 328</a>
</li></ul></dd>
@@ -3781,7 +3654,10 @@ if some action needs to happen on only one specific instance.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -3799,7 +3675,7 @@ if some action needs to happen on only one specific instance.
<h4 class="name" id="getWeekNote"><span class="type-signature"></span>getWeekNote<span class="signature">(date, options)</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getWeekNote"><span class="type-signature"></span>getWeekNote<span class="signature">(date, options)</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -3923,7 +3799,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line333">line 333</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line338">line 338</a>
</li></ul></dd>
@@ -3959,7 +3835,10 @@ if some action needs to happen on only one specific instance.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -3977,7 +3856,7 @@ if some action needs to happen on only one specific instance.
<h4 class="name" id="getYearNote"><span class="type-signature"></span>getYearNote<span class="signature">(year)</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getYearNote"><span class="type-signature"></span>getYearNote<span class="signature">(year)</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -4078,7 +3957,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line351">line 351</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line356">line 356</a>
</li></ul></dd>
@@ -4114,7 +3993,10 @@ if some action needs to happen on only one specific instance.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -4228,7 +4110,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line298">line 298</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line303">line 303</a>
</li></ul></dd>
@@ -4314,7 +4196,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line393">line 393</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line394">line 394</a>
</li></ul></dd>
@@ -4350,7 +4232,7 @@ if some action needs to happen on only one specific instance.
<h4 class="name" id="searchForNote"><span class="type-signature"></span>searchForNote<span class="signature">(searchString)</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="searchForNote"><span class="type-signature"></span>searchForNote<span class="signature">(searchString)</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -4359,7 +4241,7 @@ if some action needs to happen on only one specific instance.
<div class="description">
This is a powerful search method - you can search by attributes and their values, e.g.:
"@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
"#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
</div>
@@ -4452,7 +4334,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line114">line 114</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line117">line 117</a>
</li></ul></dd>
@@ -4488,7 +4370,10 @@ if some action needs to happen on only one specific instance.
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -4506,7 +4391,7 @@ if some action needs to happen on only one specific instance.
<h4 class="name" id="searchForNotes"><span class="type-signature"></span>searchForNotes<span class="signature">(searchString)</span><span class="type-signature"> &rarr; {Promise.&lt;Array.&lt;<a href="Note.html">Note</a>>>}</span></h4>
<h4 class="name" id="searchForNotes"><span class="type-signature"></span>searchForNotes<span class="signature">(query, searchParams<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="Note.html">Note</a>>}</span></h4>
@@ -4515,7 +4400,7 @@ if some action needs to happen on only one specific instance.
<div class="description">
This is a powerful search method - you can search by attributes and their values, e.g.:
"@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
"#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
</div>
@@ -4539,6 +4424,8 @@ if some action needs to happen on only one specific instance.
<th>Type</th>
<th>Attributes</th>
@@ -4551,7 +4438,7 @@ if some action needs to happen on only one specific instance.
<tr>
<td class="name"><code>searchString</code></td>
<td class="name"><code>query</code></td>
<td class="type">
@@ -4564,6 +4451,47 @@ if some action needs to happen on only one specific instance.
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>searchParams</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
@@ -4608,7 +4536,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line104">line 104</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line98">line 98</a>
</li></ul></dd>
@@ -4644,7 +4572,7 @@ if some action needs to happen on only one specific instance.
</dt>
<dd>
<span class="param-type">Promise.&lt;Array.&lt;<a href="Note.html">Note</a>>></span>
<span class="param-type">Array.&lt;<a href="Note.html">Note</a>></span>
</dd>
@@ -4817,7 +4745,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line372">line 372</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line376">line 376</a>
</li></ul></dd>
@@ -4950,7 +4878,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line358">line 358</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line362">line 362</a>
</li></ul></dd>
@@ -4975,16 +4903,6 @@ This method looks similar to toggleNoteInParent() but differs because we're look
<h5>Returns:</h5>
<div class="param-desc">
Promise<void>
</div>
@@ -4996,7 +4914,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
<h4 class="name" id="toggleNoteInParent"><span class="type-signature"></span>toggleNoteInParent<span class="signature">(present, noteId, parentNoteId, prefix)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<h4 class="name" id="toggleNoteInParent"><span class="type-signature"></span>toggleNoteInParent<span class="signature">(present, noteId, parentNoteId, prefix)</span><span class="type-signature"> &rarr; {void}</span></h4>
@@ -5166,7 +5084,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line171">line 171</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line174">line 174</a>
</li></ul></dd>
@@ -5202,7 +5120,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
<span class="param-type">void</span>
</dd>
@@ -5220,7 +5138,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
<h4 class="name" id="transactional"><span class="type-signature"></span>transactional<span class="signature">(func)</span><span class="type-signature"> &rarr; {Promise.&lt;?>}</span></h4>
<h4 class="name" id="transactional"><span class="type-signature"></span>transactional<span class="signature">(func)</span><span class="type-signature"> &rarr; {?}</span></h4>
@@ -5230,9 +5148,6 @@ This method looks similar to toggleNoteInParent() but differs because we're look
<div class="description">
This functions wraps code which is supposed to be running in transaction. If transaction already
exists, then we'll use that transaction.
This method is required only when script has label manualTransactionHandling, all other scripts are
transactional by default.
</div>
@@ -5325,7 +5240,7 @@ transactional by default.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line385">line 385</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line386">line 386</a>
</li></ul></dd>
@@ -5365,7 +5280,7 @@ transactional by default.
</dt>
<dd>
<span class="param-type">Promise.&lt;?></span>
<span class="param-type">?</span>
</dd>
@@ -5399,7 +5314,7 @@ transactional by default.
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -107,7 +107,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<td class="description last">primary key</td>
<td class="description last">primary key, immutable</td>
</tr>
@@ -130,7 +130,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<td class="description last"></td>
<td class="description last">immutable</td>
</tr>
@@ -153,7 +153,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<td class="description last"></td>
<td class="description last">immutable</td>
</tr>
@@ -356,7 +356,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line25">line 25</a>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line24">line 24</a>
</li></ul></dd>
@@ -423,7 +423,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<h4 class="name" id="getNote"><span class="type-signature">(async) </span>getNote<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getNote"><span class="type-signature"></span>getNote<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -471,7 +471,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line32">line 32</a>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line31">line 31</a>
</li></ul></dd>
@@ -507,7 +507,10 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -525,7 +528,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<h4 class="name" id="getParentNote"><span class="type-signature">(async) </span>getParentNote<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;(<a href="Note.html">Note</a>|null)>}</span></h4>
<h4 class="name" id="getParentNote"><span class="type-signature"></span>getParentNote<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>|null}</span></h4>
@@ -573,7 +576,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line37">line 37</a>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line36">line 36</a>
</li></ul></dd>
@@ -609,7 +612,10 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
<span class="param-type"><a href="Note.html">Note</a></span>
|
<span class="param-type">null</span>
</dd>
@@ -643,7 +649,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -150,7 +150,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_entity.js.html">entities/entity.js</a>, <a href="entities_entity.js.html#line9">line 9</a>
<a href="entities_entity.js.html">entities/entity.js</a>, <a href="entities_entity.js.html#line10">line 10</a>
</li></ul></dd>
@@ -218,7 +218,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

File diff suppressed because it is too large Load Diff

View File

@@ -198,52 +198,6 @@
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>contentLength</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>isErased</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"></td>
</tr>
@@ -421,7 +375,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_revision.js.html">entities/note_revision.js</a>, <a href="entities_note_revision.js.html#line35">line 35</a>
<a href="entities_note_revision.js.html">entities/note_revision.js</a>, <a href="entities_note_revision.js.html#line27">line 27</a>
</li></ul></dd>
@@ -488,7 +442,7 @@
<h4 class="name" id="getContent"><span class="type-signature">(async) </span>getContent<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;*>}</span></h4>
<h4 class="name" id="getContent"><span class="type-signature"></span>getContent<span class="signature">()</span><span class="type-signature"> &rarr; {*}</span></h4>
@@ -536,7 +490,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_revision.js.html">entities/note_revision.js</a>, <a href="entities_note_revision.js.html#line69">line 69</a>
<a href="entities_note_revision.js.html">entities/note_revision.js</a>, <a href="entities_note_revision.js.html#line66">line 66</a>
</li></ul></dd>
@@ -572,7 +526,7 @@
</dt>
<dd>
<span class="param-type">Promise.&lt;*></span>
<span class="param-type">*</span>
</dd>
@@ -638,7 +592,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_revision.js.html">entities/note_revision.js</a>, <a href="entities_note_revision.js.html#line55">line 55</a>
<a href="entities_note_revision.js.html">entities/note_revision.js</a>, <a href="entities_note_revision.js.html#line52">line 52</a>
</li></ul></dd>
@@ -691,108 +645,6 @@
<h4 class="name" id="setContent"><span class="type-signature">(async) </span>setContent<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_revision.js.html">entities/note_revision.js</a>, <a href="entities_note_revision.js.html#line105">line 105</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
@@ -814,7 +666,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -237,7 +237,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_option.js.html">entities/option.js</a>, <a href="entities_option.js.html#line22">line 22</a>
<a href="entities_option.js.html">entities/option.js</a>, <a href="entities_option.js.html#line17">line 17</a>
</li></ul></dd>
@@ -316,7 +316,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -136,30 +136,7 @@
<tr>
<td class="name"><code>isDeleted</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>utcDateModified</code></td>
<td class="name"><code>utcDateCreated</code></td>
<td class="type">
@@ -214,7 +191,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_recent_note.js.html">entities/recent_note.js</a>, <a href="entities_recent_note.js.html#line16">line 16</a>
<a href="entities_recent_note.js.html">entities/recent_note.js</a>, <a href="entities_recent_note.js.html#line15">line 15</a>
</li></ul></dd>
@@ -293,7 +270,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -75,7 +75,7 @@ module.exports = ApiToken;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -28,24 +28,24 @@
<article>
<pre class="prettyprint source linenums"><code>"use strict";
const Entity = require('./entity');
const repository = require('../services/repository');
const dateUtils = require('../services/date_utils');
const sql = require('../services/sql');
const promotedAttributeDefinitionParser = require("../services/promoted_attribute_definition_parser");
/**
* Attribute is key value pair owned by a note.
*
* @property {string} attributeId
* @property {string} noteId
* @property {string} type
* @property {string} name
* @property {string} attributeId - immutable
* @property {string} noteId - immutable
* @property {string} type - immutable
* @property {string} name - immutable
* @property {string} value
* @property {int} position
* @property {boolean} isInheritable
* @property {boolean} isInheritable - immutable
* @property {boolean} isDeleted
* @property {string|null} deleteId - ID identifying delete transaction
* @property {string} utcDateCreated
* @property {string} utcDateModified
*
* @extends Entity
@@ -53,33 +53,29 @@ const sql = require('../services/sql');
class Attribute extends Entity {
static get entityName() { return "attributes"; }
static get primaryKeyName() { return "attributeId"; }
static get hashedProperties() { return ["attributeId", "noteId", "type", "name", "value", "isInheritable", "isDeleted", "utcDateCreated"]; }
static get hashedProperties() { return ["attributeId", "noteId", "type", "name", "value", "isInheritable", "isDeleted"]; }
constructor(row) {
super(row);
this.isInheritable = !!this.isInheritable;
}
if (this.isDefinition()) {
try {
this.value = JSON.parse(this.value);
}
catch (e) {
}
}
isAutoLink() {
return this.type === 'relation' &amp;&amp; ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(this.name);
}
/**
* @returns {Promise&lt;Note|null>}
* @returns {Note|null}
*/
async getNote() {
return await repository.getNote(this.noteId);
getNote() {
return this.repository.getNote(this.noteId);
}
/**
* @returns {Promise&lt;Note|null>}
* @returns {Note|null}
*/
async getTargetNote() {
getTargetNote() {
if (this.type !== 'relation') {
throw new Error(`Attribute ${this.attributeId} is not relation`);
}
@@ -88,17 +84,31 @@ class Attribute extends Entity {
return null;
}
return await repository.getNote(this.value);
return this.repository.getNote(this.value);
}
/**
* @return {boolean}
*/
isDefinition() {
return this.type === 'label-definition' || this.type === 'relation-definition';
return this.type === 'label' &amp;&amp; (this.name.startsWith('label:') || this.name.startsWith('relation:'));
}
async beforeSaving() {
getDefinition() {
return promotedAttributeDefinitionParser.parse(this.value);
}
getDefinedName() {
if (this.type === 'label' &amp;&amp; this.name.startsWith('label:')) {
return this.name.substr(6);
} else if (this.type === 'label' &amp;&amp; this.name.startsWith('relation:')) {
return this.name.substr(9);
} else {
return this.name;
}
}
beforeSaving() {
if (!this.value) {
if (this.type === 'relation') {
throw new Error(`Cannot save relation ${this.name} since it does not target any note.`);
@@ -109,7 +119,7 @@ class Attribute extends Entity {
}
if (this.position === undefined) {
this.position = 1 + await sql.getValue(`SELECT COALESCE(MAX(position), 0) FROM attributes WHERE noteId = ?`, [this.noteId]);
this.position = 1 + sql.getValue(`SELECT COALESCE(MAX(position), 0) FROM attributes WHERE noteId = ?`, [this.noteId]);
}
if (!this.isInheritable) {
@@ -120,39 +130,27 @@ class Attribute extends Entity {
this.isDeleted = false;
}
if (!this.utcDateCreated) {
this.utcDateCreated = dateUtils.utcNowDateTime();
}
super.beforeSaving();
if (this.isChanged) {
this.utcDateModified = dateUtils.utcNowDateTime();
}
this.utcDateModified = dateUtils.utcNowDateTime();
}
// cannot be static!
updatePojo(pojo) {
delete pojo.isOwned;
delete pojo.__note;
}
createClone(type, name, value) {
createClone(type, name, value, isInheritable) {
return new Attribute({
noteId: this.noteId,
type: type,
name: name,
value: value,
position: this.position,
isInheritable: this.isInheritable,
isInheritable: isInheritable,
isDeleted: false,
utcDateCreated: this.utcDateCreated,
utcDateModified: this.utcDateModified
});
}
}
module.exports = Attribute;</code></pre>
module.exports = Attribute;
</code></pre>
</article>
</section>
@@ -168,7 +166,7 @@ module.exports = Attribute;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -30,16 +30,15 @@
const Entity = require('./entity');
const dateUtils = require('../services/date_utils');
const repository = require('../services/repository');
const sql = require('../services/sql');
/**
* Branch represents note's placement in the tree - it's essentially pair of noteId and parentNoteId.
* Each note can have multiple (at least one) branches, meaning it can be placed into multiple places in the tree.
*
* @property {string} branchId - primary key
* @property {string} noteId
* @property {string} parentNoteId
* @property {string} branchId - primary key, immutable
* @property {string} noteId - immutable
* @property {string} parentNoteId - immutable
* @property {int} notePosition
* @property {string} prefix
* @property {boolean} isExpanded
@@ -56,19 +55,19 @@ class Branch extends Entity {
// notePosition is not part of hash because it would produce a lot of updates in case of reordering
static get hashedProperties() { return ["branchId", "noteId", "parentNoteId", "isDeleted", "deleteId", "prefix"]; }
/** @returns {Promise&lt;Note|null>} */
async getNote() {
return await repository.getNote(this.noteId);
/** @returns {Note|null} */
getNote() {
return this.repository.getNote(this.noteId);
}
/** @returns {Promise&lt;Note|null>} */
async getParentNote() {
return await repository.getNote(this.parentNoteId);
/** @returns {Note|null} */
getParentNote() {
return this.repository.getNote(this.parentNoteId);
}
async beforeSaving() {
if (this.notePosition === undefined) {
const maxNotePos = await sql.getValue('SELECT MAX(notePosition) FROM branches WHERE parentNoteId = ? AND isDeleted = 0', [this.parentNoteId]);
beforeSaving() {
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;
}
@@ -86,9 +85,7 @@ class Branch extends Entity {
super.beforeSaving();
if (this.isChanged) {
this.utcDateModified = dateUtils.utcNowDateTime();
}
this.utcDateModified = dateUtils.utcNowDateTime();
}
createClone(parentNoteId, notePosition) {
@@ -105,7 +102,8 @@ class Branch extends Entity {
}
}
module.exports = Branch;</code></pre>
module.exports = Branch;
</code></pre>
</article>
</section>
@@ -121,7 +119,7 @@ module.exports = Branch;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -29,6 +29,7 @@
<pre class="prettyprint source linenums"><code>"use strict";
const utils = require('../services/utils');
let repo = null;
class Entity {
/**
@@ -42,25 +43,13 @@ class Entity {
}
}
if ('isDeleted' in this) {
if ('isDeleted' in this &amp;&amp; this.constructor.entityName !== 'recent_notes') {
this.isDeleted = !!this.isDeleted;
}
}
beforeSaving() {
this.generateIdIfNecessary();
const origHash = this.hash;
this.hash = this.generateHash();
if (this.forcedChange) {
this.isChanged = true;
delete this.forcedChange;
}
else {
this.isChanged = origHash !== this.hash;
}
}
generateIdIfNecessary() {
@@ -79,14 +68,27 @@ class Entity {
return utils.hash(contentToHash).substr(0, 10);
}
async save() {
await require('../services/repository').updateEntity(this);
getUtcDateChanged() {
return this.utcDateModified;
}
get repository() {
if (!repo) {
repo = require('../services/repository');
}
return repo;
}
save() {
this.repository.updateEntity(this);
return this;
}
}
module.exports = Entity;</code></pre>
module.exports = Entity;
</code></pre>
</article>
</section>
@@ -102,7 +104,7 @@ module.exports = Entity;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -31,16 +31,13 @@
const Entity = require('./entity');
const Attribute = require('./attribute');
const protectedSessionService = require('../services/protected_session');
const repository = require('../services/repository');
const sql = require('../services/sql');
const utils = require('../services/utils');
const dateUtils = require('../services/date_utils');
const syncTableService = require('../services/sync_table');
const entityChangesService = require('../services/entity_changes.js');
const LABEL = 'label';
const LABEL_DEFINITION = 'label-definition';
const RELATION = 'relation';
const RELATION_DEFINITION = 'relation-definition';
/**
* This represents a Note which is a central object in the Trilium Notes project.
@@ -49,11 +46,9 @@ const RELATION_DEFINITION = 'relation-definition';
* @property {string} type - one of "text", "code", "file" or "render"
* @property {string} mime - MIME type, e.g. "text/html"
* @property {string} title - note title
* @property {int} contentLength - length of content
* @property {boolean} isProtected - true if note is protected
* @property {boolean} isDeleted - true if note is deleted
* @property {string|null} deleteId - ID identifying delete transaction
* @property {boolean} isErased - true if note's content is erased after it has been deleted
* @property {string} dateCreated - local date time (with offset)
* @property {string} dateModified - local date time (with offset)
* @property {string} utcDateCreated
@@ -95,16 +90,16 @@ class Note extends Entity {
* part of Note entity with it's own sync. Reasons behind this hybrid design has been:
*
* - content can be quite large and it's not necessary to load it / fill memory for any note access even if we don't need a content, especially for bulk operations like search
* - changes in the note metadata or title should not trigger note content sync (so we keep separate utcDateModified and sync rows)
* - changes in the note metadata or title should not trigger note content sync (so we keep separate utcDateModified and entity changes records)
* - but to the user note content and title changes are one and the same - single dateModified (so all changes must go through Note and content is not a separate entity)
*/
/** @returns {Promise&lt;*>} */
async getContent(silentNotFoundError = false) {
/** @returns {*} */
getContent(silentNotFoundError = false) {
if (this.content === undefined) {
const res = await sql.getRow(`SELECT content, hash FROM note_contents WHERE noteId = ?`, [this.noteId]);
const row = sql.getRow(`SELECT content FROM note_contents WHERE noteId = ?`, [this.noteId]);
if (!res) {
if (!row) {
if (silentNotFoundError) {
return undefined;
}
@@ -113,7 +108,7 @@ class Note extends Entity {
}
}
this.content = res.content;
this.content = row.content;
if (this.isProtected) {
if (this.isContentAvailable) {
@@ -135,9 +130,20 @@ class Note extends Entity {
}
}
/** @returns {Promise&lt;*>} */
async getJsonContent() {
const content = await this.getContent();
/** @returns {{contentLength, dateModified, utcDateModified}} */
getContentMetadata() {
return sql.getRow(`
SELECT
LENGTH(content) AS contentLength,
dateModified,
utcDateModified
FROM note_contents
WHERE noteId = ?`, [this.noteId]);
}
/** @returns {*} */
getJsonContent() {
const content = this.getContent();
if (!content || !content.trim()) {
return null;
@@ -146,26 +152,25 @@ class Note extends Entity {
return JSON.parse(content);
}
/** @returns {Promise} */
async setContent(content) {
setContent(content) {
if (content === null || content === undefined) {
throw new Error(`Cannot set null content to note ${this.noteId}`);
}
content = Buffer.isBuffer(content) ? content : Buffer.from(content);
// force updating note itself so that dateModified is represented correctly even for the content
this.forcedChange = true;
this.contentLength = content.byteLength;
await this.save();
if (this.isStringNote()) {
content = content.toString();
}
else {
content = Buffer.isBuffer(content) ? content : Buffer.from(content);
}
this.content = content;
const pojo = {
noteId: this.noteId,
content: content,
utcDateModified: dateUtils.utcNowDateTime(),
hash: utils.hash(this.noteId + "|" + content.toString())
dateModified: dateUtils.localNowDateTime(),
utcDateModified: dateUtils.utcNowDateTime()
};
if (this.isProtected) {
@@ -177,14 +182,21 @@ class Note extends Entity {
}
}
await sql.upsert("note_contents", "noteId", pojo);
sql.upsert("note_contents", "noteId", pojo);
await syncTableService.addNoteContentSync(this.noteId);
const hash = utils.hash(this.noteId + "|" + content.toString());
entityChangesService.addEntityChange({
entityName: 'note_contents',
entityId: this.noteId,
hash: hash,
isErased: false,
utcDateChanged: this.getUtcDateChanged()
}, null);
}
/** @returns {Promise} */
async setJsonContent(content) {
await this.setContent(JSON.stringify(content, null, '\t'));
setJsonContent(content) {
this.setContent(JSON.stringify(content, null, '\t'));
}
/** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */
@@ -232,8 +244,8 @@ class Note extends Entity {
return null;
}
async loadOwnedAttributesToCache() {
this.__ownedAttributeCache = await repository.getEntities(`SELECT * FROM attributes WHERE isDeleted = 0 AND noteId = ?`, [this.noteId]);
loadOwnedAttributesToCache() {
this.__ownedAttributeCache = this.repository.getEntities(`SELECT * FROM attributes WHERE isDeleted = 0 AND noteId = ?`, [this.noteId]);
return this.__ownedAttributeCache;
}
@@ -243,11 +255,11 @@ class Note extends Entity {
*
* @param {string} [type] - (optional) attribute type to filter
* @param {string} [name] - (optional) attribute name to filter
* @returns {Promise&lt;Attribute[]>} note's "owned" attributes - excluding inherited ones
* @returns {Attribute[]} note's "owned" attributes - excluding inherited ones
*/
async getOwnedAttributes(type, name) {
getOwnedAttributes(type, name) {
if (!this.__ownedAttributeCache) {
await this.loadOwnedAttributesToCache();
this.loadOwnedAttributesToCache();
}
if (type &amp;&amp; name) {
@@ -265,31 +277,31 @@ class Note extends Entity {
}
/**
* @returns {Promise&lt;Attribute>} attribute belonging to this specific note (excludes inherited attributes)
* @returns {Attribute} attribute belonging to this specific note (excludes inherited attributes)
*
* This method can be significantly faster than the getAttribute()
*/
async getOwnedAttribute(type, name) {
const attrs = await this.getOwnedAttributes(type, name);
getOwnedAttribute(type, name) {
const attrs = this.getOwnedAttributes(type, name);
return attrs.length > 0 ? attrs[0] : null;
}
/**
* @returns {Promise&lt;Attribute[]>} relations targetting this specific note
* @returns {Attribute[]} relations targetting this specific note
*/
async getTargetRelations() {
return await repository.getEntities("SELECT * FROM attributes WHERE type = 'relation' AND isDeleted = 0 AND value = ?", [this.noteId]);
getTargetRelations() {
return this.repository.getEntities("SELECT * FROM attributes WHERE type = 'relation' AND isDeleted = 0 AND value = ?", [this.noteId]);
}
/**
* @param {string} [type] - (optional) attribute type to filter
* @param {string} [name] - (optional) attribute name to filter
* @returns {Promise&lt;Attribute[]>} all note's attributes, including inherited ones
* @returns {Attribute[]} all note's attributes, including inherited ones
*/
async getAttributes(type, name) {
getAttributes(type, name) {
if (!this.__attributeCache) {
await this.loadAttributesToCache();
this.loadAttributesToCache();
}
if (type &amp;&amp; name) {
@@ -308,67 +320,51 @@ class Note extends Entity {
/**
* @param {string} [name] - label name to filter
* @returns {Promise&lt;Attribute[]>} all note's labels (attributes with type label), including inherited ones
* @returns {Attribute[]} all note's labels (attributes with type label), including inherited ones
*/
async getLabels(name) {
return await this.getAttributes(LABEL, name);
getLabels(name) {
return this.getAttributes(LABEL, name);
}
/**
* @param {string} [name] - label name to filter
* @returns {Promise&lt;Attribute[]>} all note's labels (attributes with type label), excluding inherited ones
* @returns {Attribute[]} all note's labels (attributes with type label), excluding inherited ones
*/
async getOwnedLabels(name) {
return await this.getOwnedAttributes(LABEL, name);
}
/**
* @param {string} [name] - label name to filter
* @returns {Promise&lt;Attribute[]>} all note's label definitions, including inherited ones
*/
async getLabelDefinitions(name) {
return await this.getAttributes(LABEL_DEFINITION, name);
getOwnedLabels(name) {
return this.getOwnedAttributes(LABEL, name);
}
/**
* @param {string} [name] - relation name to filter
* @returns {Promise&lt;Attribute[]>} all note's relations (attributes with type relation), including inherited ones
* @returns {Attribute[]} all note's relations (attributes with type relation), including inherited ones
*/
async getRelations(name) {
return await this.getAttributes(RELATION, name);
getRelations(name) {
return this.getAttributes(RELATION, name);
}
/**
* @param {string} [name] - relation name to filter
* @returns {Promise&lt;Attribute[]>} all note's relations (attributes with type relation), excluding inherited ones
* @returns {Attribute[]} all note's relations (attributes with type relation), excluding inherited ones
*/
async getOwnedRelations(name) {
return await this.getOwnedAttributes(RELATION, name);
getOwnedRelations(name) {
return this.getOwnedAttributes(RELATION, name);
}
/**
* @param {string} [name] - relation name to filter
* @returns {Promise&lt;Note[]>}
* @returns {Note[]}
*/
async getRelationTargets(name) {
const relations = await this.getRelations(name);
getRelationTargets(name) {
const relations = this.getRelations(name);
const targets = [];
for (const relation of relations) {
targets.push(await relation.getTargetNote());
targets.push(relation.getTargetNote());
}
return targets;
}
/**
* @param {string} [name] - relation name to filter
* @returns {Promise&lt;Attribute[]>} all note's relation definitions including inherited ones
*/
async getRelationDefinitions(name) {
return await this.getAttributes(RELATION_DEFINITION, name);
}
/**
* Clear note's attributes cache to force fresh reload for next attribute request.
* Cache is note instance scoped.
@@ -378,9 +374,8 @@ class Note extends Entity {
this.__ownedAttributeCache = null;
}
/** @returns {Promise&lt;void>} */
async loadAttributesToCache() {
const attributes = await repository.getEntities(`
loadAttributesToCache() {
const attributes = this.repository.getEntities(`
WITH RECURSIVE
tree(noteId, level) AS (
SELECT ?, 0
@@ -412,6 +407,7 @@ class Note extends Entity {
return false;
}
// FIXME: this code is quite questionable, one problem is that other caches (TreeCache, NoteCache) have nothing like that
if (attr.isDefinition()) {
const firstDefinitionIndex = attributes.findIndex(el => el.type === attr.type &amp;&amp; el.name === attr.name);
@@ -419,15 +415,15 @@ class Note extends Entity {
return firstDefinitionIndex === index;
}
else {
const definitionAttr = attributes.find(el => el.type === attr.type + '-definition' &amp;&amp; el.name === attr.name);
const definitionAttr = attributes.find(el => el.type === 'label' &amp;&amp; el.name === attr.type + ':' + attr.name);
if (!definitionAttr) {
return true;
}
const definition = definitionAttr.value;
const definition = definitionAttr.getDefinition();
if (definition.multiplicityType === 'multivalue') {
if (definition.multiplicity === 'multi') {
return true;
}
else {
@@ -439,38 +435,34 @@ class Note extends Entity {
}
});
for (const attr of filteredAttributes) {
attr.isOwned = attr.noteId === this.noteId;
}
this.__attributeCache = filteredAttributes;
}
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @returns {Promise&lt;boolean>} true if note has an attribute with given type and name (including inherited)
* @returns {boolean} true if note has an attribute with given type and name (including inherited)
*/
async hasAttribute(type, name) {
return !!await this.getAttribute(type, name);
hasAttribute(type, name) {
return !!this.getAttribute(type, name);
}
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @returns {Promise&lt;boolean>} true if note has an attribute with given type and name (excluding inherited)
* @returns {boolean} true if note has an attribute with given type and name (excluding inherited)
*/
async hasOwnedAttribute(type, name) {
return !!await this.getOwnedAttribute(type, name);
hasOwnedAttribute(type, name) {
return !!this.getOwnedAttribute(type, name);
}
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @returns {Promise&lt;Attribute>} attribute of given type and name. If there's more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
* @returns {Attribute} attribute of given type and name. If there's more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
*/
async getAttribute(type, name) {
const attributes = await this.getAttributes();
getAttribute(type, name) {
const attributes = this.getAttributes();
return attributes.find(attr => attr.type === type &amp;&amp; attr.name === name);
}
@@ -478,10 +470,10 @@ class Note extends Entity {
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @returns {Promise&lt;string|null>} attribute value of given type and name or null if no such attribute exists.
* @returns {string|null} attribute value of given type and name or null if no such attribute exists.
*/
async getAttributeValue(type, name) {
const attr = await this.getAttribute(type, name);
getAttributeValue(type, name) {
const attr = this.getAttribute(type, name);
return attr ? attr.value : null;
}
@@ -489,10 +481,10 @@ class Note extends Entity {
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @returns {Promise&lt;string|null>} attribute value of given type and name or null if no such attribute exists.
* @returns {string|null} attribute value of given type and name or null if no such attribute exists.
*/
async getOwnedAttributeValue(type, name) {
const attr = await this.getOwnedAttribute(type, name);
getOwnedAttributeValue(type, name) {
const attr = this.getOwnedAttribute(type, name);
return attr ? attr.value : null;
}
@@ -504,14 +496,13 @@ class Note extends Entity {
* @param {boolean} enabled - toggle On or Off
* @param {string} name - attribute name
* @param {string} [value] - attribute value (optional)
* @returns {Promise&lt;void>}
*/
async toggleAttribute(type, enabled, name, value) {
toggleAttribute(type, enabled, name, value) {
if (enabled) {
await this.setAttribute(type, name, value);
this.setAttribute(type, name, value);
}
else {
await this.removeAttribute(type, name, value);
this.removeAttribute(type, name, value);
}
}
@@ -521,16 +512,15 @@ class Note extends Entity {
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @param {string} [value] - attribute value (optional)
* @returns {Promise&lt;void>}
*/
async setAttribute(type, name, value) {
const attributes = await this.loadOwnedAttributesToCache();
setAttribute(type, name, value) {
const attributes = this.loadOwnedAttributesToCache();
let attr = attributes.find(attr => attr.type === type &amp;&amp; attr.name === name);
if (attr) {
if (attr.value !== value) {
attr.value = value;
await attr.save();
attr.save();
this.invalidateAttributeCache();
}
@@ -543,7 +533,7 @@ class Note extends Entity {
value: value !== undefined ? value : ""
});
await attr.save();
attr.save();
this.invalidateAttributeCache();
}
@@ -555,15 +545,14 @@ class Note extends Entity {
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @param {string} [value] - attribute value (optional)
* @returns {Promise&lt;void>}
*/
async removeAttribute(type, name, value) {
const attributes = await this.loadOwnedAttributesToCache();
removeAttribute(type, name, value) {
const attributes = this.loadOwnedAttributesToCache();
for (const attribute of attributes) {
if (attribute.type === type &amp;&amp; attribute.name === name &amp;&amp; (value === undefined || value === attribute.value)) {
attribute.isDeleted = true;
await attribute.save();
attribute.save();
this.invalidateAttributeCache();
}
@@ -571,121 +560,123 @@ class Note extends Entity {
}
/**
* @return {Promise&lt;Attribute>}
* @return {Attribute}
*/
async addAttribute(type, name, value = "") {
addAttribute(type, name, value = "", isInheritable = false, position = 1000) {
const attr = new Attribute({
noteId: this.noteId,
type: type,
name: name,
value: value
value: value,
isInheritable: isInheritable,
position: position
});
await attr.save();
attr.save();
this.invalidateAttributeCache();
return attr;
}
async addLabel(name, value = "") {
return await this.addAttribute(LABEL, name, value);
addLabel(name, value = "", isInheritable = false) {
return this.addAttribute(LABEL, name, value, isInheritable);
}
async addRelation(name, targetNoteId) {
return await this.addAttribute(RELATION, name, targetNoteId);
addRelation(name, targetNoteId, isInheritable = false) {
return this.addAttribute(RELATION, name, targetNoteId, isInheritable);
}
/**
* @param {string} name - label name
* @returns {Promise&lt;boolean>} true if label exists (including inherited)
* @returns {boolean} true if label exists (including inherited)
*/
async hasLabel(name) { return await this.hasAttribute(LABEL, name); }
hasLabel(name) { return this.hasAttribute(LABEL, name); }
/**
* @param {string} name - label name
* @returns {Promise&lt;boolean>} true if label exists (excluding inherited)
* @returns {boolean} true if label exists (excluding inherited)
*/
async hasOwnedLabel(name) { return await this.hasOwnedAttribute(LABEL, name); }
hasOwnedLabel(name) { return this.hasOwnedAttribute(LABEL, name); }
/**
* @param {string} name - relation name
* @returns {Promise&lt;boolean>} true if relation exists (including inherited)
* @returns {boolean} true if relation exists (including inherited)
*/
async hasRelation(name) { return await this.hasAttribute(RELATION, name); }
hasRelation(name) { return this.hasAttribute(RELATION, name); }
/**
* @param {string} name - relation name
* @returns {Promise&lt;boolean>} true if relation exists (excluding inherited)
* @returns {boolean} true if relation exists (excluding inherited)
*/
async hasOwnedRelation(name) { return await this.hasOwnedAttribute(RELATION, name); }
hasOwnedRelation(name) { return this.hasOwnedAttribute(RELATION, name); }
/**
* @param {string} name - label name
* @returns {Promise&lt;Attribute|null>} label if it exists, null otherwise
* @returns {Attribute|null} label if it exists, null otherwise
*/
async getLabel(name) { return await this.getAttribute(LABEL, name); }
getLabel(name) { return this.getAttribute(LABEL, name); }
/**
* @param {string} name - label name
* @returns {Promise&lt;Attribute|null>} label if it exists, null otherwise
* @returns {Attribute|null} label if it exists, null otherwise
*/
async getOwnedLabel(name) { return await this.getOwnedAttribute(LABEL, name); }
getOwnedLabel(name) { return this.getOwnedAttribute(LABEL, name); }
/**
* @param {string} name - relation name
* @returns {Promise&lt;Attribute|null>} relation if it exists, null otherwise
* @returns {Attribute|null} relation if it exists, null otherwise
*/
async getRelation(name) { return await this.getAttribute(RELATION, name); }
getRelation(name) { return this.getAttribute(RELATION, name); }
/**
* @param {string} name - relation name
* @returns {Promise&lt;Attribute|null>} relation if it exists, null otherwise
* @returns {Attribute|null} relation if it exists, null otherwise
*/
async getOwnedRelation(name) { return await this.getOwnedAttribute(RELATION, name); }
getOwnedRelation(name) { return this.getOwnedAttribute(RELATION, name); }
/**
* @param {string} name - label name
* @returns {Promise&lt;string|null>} label value if label exists, null otherwise
* @returns {string|null} label value if label exists, null otherwise
*/
async getLabelValue(name) { return await this.getAttributeValue(LABEL, name); }
getLabelValue(name) { return this.getAttributeValue(LABEL, name); }
/**
* @param {string} name - label name
* @returns {Promise&lt;string|null>} label value if label exists, null otherwise
* @returns {string|null} label value if label exists, null otherwise
*/
async getOwnedLabelValue(name) { return await this.getOwnedAttributeValue(LABEL, name); }
getOwnedLabelValue(name) { return this.getOwnedAttributeValue(LABEL, name); }
/**
* @param {string} name - relation name
* @returns {Promise&lt;string|null>} relation value if relation exists, null otherwise
* @returns {string|null} relation value if relation exists, null otherwise
*/
async getRelationValue(name) { return await this.getAttributeValue(RELATION, name); }
getRelationValue(name) { return this.getAttributeValue(RELATION, name); }
/**
* @param {string} name - relation name
* @returns {Promise&lt;string|null>} relation value if relation exists, null otherwise
* @returns {string|null} relation value if relation exists, null otherwise
*/
async getOwnedRelationValue(name) { return await this.getOwnedAttributeValue(RELATION, name); }
getOwnedRelationValue(name) { return this.getOwnedAttributeValue(RELATION, name); }
/**
* @param {string} name
* @returns {Promise&lt;Note>|null} target note of the relation or null (if target is empty or note was not found)
* @returns {Note|null} target note of the relation or null (if target is empty or note was not found)
*/
async getRelationTarget(name) {
const relation = await this.getRelation(name);
getRelationTarget(name) {
const relation = this.getRelation(name);
return relation ? await repository.getNote(relation.value) : null;
return relation ? this.repository.getNote(relation.value) : null;
}
/**
* @param {string} name
* @returns {Promise&lt;Note>|null} target note of the relation or null (if target is empty or note was not found)
* @returns {Note|null} target note of the relation or null (if target is empty or note was not found)
*/
async getOwnedRelationTarget(name) {
const relation = await this.getOwnedRelation(name);
getOwnedRelationTarget(name) {
const relation = this.getOwnedRelation(name);
return relation ? await repository.getNote(relation.value) : null;
return relation ? this.repository.getNote(relation.value) : null;
}
/**
@@ -694,9 +685,8 @@ class Note extends Entity {
* @param {boolean} enabled - toggle On or Off
* @param {string} name - label name
* @param {string} [value] - label value (optional)
* @returns {Promise&lt;void>}
*/
async toggleLabel(enabled, name, value) { return await this.toggleAttribute(LABEL, enabled, name, value); }
toggleLabel(enabled, name, value) { return this.toggleAttribute(LABEL, enabled, name, value); }
/**
* Based on enabled, relation is either set or removed.
@@ -704,51 +694,46 @@ class Note extends Entity {
* @param {boolean} enabled - toggle On or Off
* @param {string} name - relation name
* @param {string} [value] - relation value (noteId)
* @returns {Promise&lt;void>}
*/
async toggleRelation(enabled, name, value) { return await this.toggleAttribute(RELATION, enabled, name, value); }
toggleRelation(enabled, name, value) { return this.toggleAttribute(RELATION, enabled, name, value); }
/**
* Update's given label's value or creates it if it doesn't exist
*
* @param {string} name - label name
* @param {string} [value] - label value
* @returns {Promise&lt;void>}
*/
async setLabel(name, value) { return await this.setAttribute(LABEL, name, value); }
setLabel(name, value) { return this.setAttribute(LABEL, name, value); }
/**
* Update's given relation's value or creates it if it doesn't exist
*
* @param {string} name - relation name
* @param {string} [value] - relation value (noteId)
* @returns {Promise&lt;void>}
*/
async setRelation(name, value) { return await this.setAttribute(RELATION, name, value); }
setRelation(name, value) { return this.setAttribute(RELATION, name, value); }
/**
* Remove label name-value pair, if it exists.
*
* @param {string} name - label name
* @param {string} [value] - label value
* @returns {Promise&lt;void>}
*/
async removeLabel(name, value) { return await this.removeAttribute(LABEL, name, value); }
removeLabel(name, value) { return this.removeAttribute(LABEL, name, value); }
/**
* Remove relation name-value pair, if it exists.
*
* @param {string} name - relation name
* @param {string} [value] - relation value (noteId)
* @returns {Promise&lt;void>}
*/
async removeRelation(name, value) { return await this.removeAttribute(RELATION, name, value); }
removeRelation(name, value) { return this.removeAttribute(RELATION, name, value); }
/**
* @return {Promise&lt;string[]>} return list of all descendant noteIds of this note. Returning just noteIds because number of notes can be huge. Includes also this note's noteId
* @return {string[]} return list of all descendant noteIds of this note. Returning just noteIds because number of notes can be huge. Includes also this note's noteId
*/
async getDescendantNoteIds() {
return await sql.getColumn(`
getDescendantNoteIds() {
return sql.getColumn(`
WITH RECURSIVE
tree(noteId) AS (
SELECT ?
@@ -768,9 +753,9 @@ class Note extends Entity {
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @param {string} [value] - attribute value
* @returns {Promise&lt;Note[]>}
* @returns {Note[]}
*/
async getDescendantNotesWithAttribute(type, name, value) {
getDescendantNotesWithAttribute(type, name, value) {
const params = [this.noteId, name];
let valueCondition = "";
@@ -779,7 +764,7 @@ class Note extends Entity {
valueCondition = " AND attributes.value = ?";
}
const notes = await repository.getEntities(`
const notes = this.repository.getEntities(`
WITH RECURSIVE
tree(noteId) AS (
SELECT ?
@@ -806,36 +791,36 @@ class Note extends Entity {
*
* @param {string} name - label name
* @param {string} [value] - label value
* @returns {Promise&lt;Note[]>}
* @returns {Note[]}
*/
async getDescendantNotesWithLabel(name, value) { return await this.getDescendantNotesWithAttribute(LABEL, name, value); }
getDescendantNotesWithLabel(name, value) { return this.getDescendantNotesWithAttribute(LABEL, name, value); }
/**
* Finds descendant notes with given relation name and value. Only own relations are considered, not inherited ones
*
* @param {string} name - relation name
* @param {string} [value] - relation value
* @returns {Promise&lt;Note[]>}
* @returns {Note[]}
*/
async getDescendantNotesWithRelation(name, value) { return await this.getDescendantNotesWithAttribute(RELATION, name, value); }
getDescendantNotesWithRelation(name, value) { return this.getDescendantNotesWithAttribute(RELATION, name, value); }
/**
* Returns note revisions of this note.
*
* @returns {Promise&lt;NoteRevision[]>}
* @returns {NoteRevision[]}
*/
async getRevisions() {
return await repository.getEntities("SELECT * FROM note_revisions WHERE noteId = ?", [this.noteId]);
getRevisions() {
return this.repository.getEntities("SELECT * FROM note_revisions WHERE noteId = ?", [this.noteId]);
}
/**
* Get list of links coming out of this note.
*
* @deprecated - not intended for general use
* @returns {Promise&lt;Attribute[]>}
* @returns {Attribute[]}
*/
async getLinks() {
return await repository.getEntities(`
getLinks() {
return this.repository.getEntities(`
SELECT *
FROM attributes
WHERE noteId = ? AND
@@ -845,24 +830,24 @@ class Note extends Entity {
}
/**
* @returns {Promise&lt;Branch[]>}
* @returns {Branch[]}
*/
async getBranches() {
return await repository.getEntities("SELECT * FROM branches WHERE isDeleted = 0 AND noteId = ?", [this.noteId]);
getBranches() {
return this.repository.getEntities("SELECT * FROM branches WHERE isDeleted = 0 AND noteId = ?", [this.noteId]);
}
/**
* @returns {boolean} - true if note has children
*/
async hasChildren() {
return (await this.getChildNotes()).length > 0;
hasChildren() {
return this.getChildNotes().length > 0;
}
/**
* @returns {Promise&lt;Note[]>} child notes of this note
* @returns {Note[]} child notes of this note
*/
async getChildNotes() {
return await repository.getEntities(`
getChildNotes() {
return this.repository.getEntities(`
SELECT notes.*
FROM branches
JOIN notes USING(noteId)
@@ -873,10 +858,10 @@ class Note extends Entity {
}
/**
* @returns {Promise&lt;Branch[]>} child branches of this note
* @returns {Branch[]} child branches of this note
*/
async getChildBranches() {
return await repository.getEntities(`
getChildBranches() {
return this.repository.getEntities(`
SELECT branches.*
FROM branches
WHERE branches.isDeleted = 0
@@ -885,10 +870,10 @@ class Note extends Entity {
}
/**
* @returns {Promise&lt;Note[]>} parent notes of this note (note can have multiple parents because of cloning)
* @returns {Note[]} parent notes of this note (note can have multiple parents because of cloning)
*/
async getParentNotes() {
return await repository.getEntities(`
getParentNotes() {
return this.repository.getEntities(`
SELECT parent_notes.*
FROM
branches AS child_tree
@@ -899,17 +884,17 @@ class Note extends Entity {
}
/**
* @return {Promise&lt;string[][]>} - array of notePaths (each represented by array of noteIds constituting the particular note path)
* @return {string[][]} - array of notePaths (each represented by array of noteIds constituting the particular note path)
*/
async getAllNotePaths() {
getAllNotePaths() {
if (this.noteId === 'root') {
return [['root']];
}
const notePaths = [];
for (const parentNote of await this.getParentNotes()) {
for (const parentPath of await parentNote.getAllNotePaths()) {
for (const parentNote of this.getParentNotes()) {
for (const parentPath of parentNote.getAllNotePaths()) {
parentPath.push(this.noteId);
notePaths.push(parentPath);
}
@@ -918,12 +903,22 @@ class Note extends Entity {
return notePaths;
}
getRelationDefinitions() {
return this.getLabels()
.filter(l => l.name.startsWith("relation:"));
}
getLabelDefinitions() {
return this.getLabels()
.filter(l => l.name.startsWith("relation:"));
}
/**
* @param ancestorNoteId
* @return {Promise&lt;boolean>} - true if ancestorNoteId occurs in at least one of the note's paths
* @return {boolean} - true if ancestorNoteId occurs in at least one of the note's paths
*/
async isDescendantOfNote(ancestorNoteId) {
const notePaths = await this.getAllNotePaths();
isDescendantOfNote(ancestorNoteId) {
const notePaths = this.getAllNotePaths();
return notePaths.some(path => path.includes(ancestorNoteId));
}
@@ -941,16 +936,10 @@ class Note extends Entity {
this.utcDateCreated = dateUtils.utcNowDateTime();
}
if (this.contentLength === undefined) {
this.contentLength = -1;
}
super.beforeSaving();
if (this.isChanged) {
this.dateModified = dateUtils.localNowDateTime();
this.utcDateModified = dateUtils.utcNowDateTime();
}
this.dateModified = dateUtils.localNowDateTime();
this.utcDateModified = dateUtils.utcNowDateTime();
}
// cannot be static!
@@ -974,7 +963,8 @@ class Note extends Entity {
}
}
module.exports = Note;</code></pre>
module.exports = Note;
</code></pre>
</article>
</section>
@@ -990,7 +980,7 @@ module.exports = Note;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -30,11 +30,10 @@
const Entity = require('./entity');
const protectedSessionService = require('../services/protected_session');
const repository = require('../services/repository');
const utils = require('../services/utils');
const sql = require('../services/sql');
const dateUtils = require('../services/date_utils');
const syncTableService = require('../services/sync_table');
const entityChangesService = require('../services/entity_changes.js');
/**
* NoteRevision represents snapshot of note's title and content at some point in the past. It's used for seamless note versioning.
@@ -44,8 +43,6 @@ const syncTableService = require('../services/sync_table');
* @property {string} type
* @property {string} mime
* @property {string} title
* @property {int} contentLength
* @property {boolean} isErased
* @property {boolean} isProtected
* @property {string} dateLastEdited
* @property {string} dateCreated
@@ -58,7 +55,7 @@ const syncTableService = require('../services/sync_table');
class NoteRevision extends Entity {
static get entityName() { return "note_revisions"; }
static get primaryKeyName() { return "noteRevisionId"; }
static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "contentLength", "isErased", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; }
static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; }
constructor(row) {
super(row);
@@ -75,8 +72,8 @@ class NoteRevision extends Entity {
}
}
async getNote() {
return await repository.getNote(this.noteId);
getNote() {
return this.repository.getNote(this.noteId);
}
/** @returns {boolean} true if the note has string content (not binary) */
@@ -93,10 +90,10 @@ class NoteRevision extends Entity {
* This is the same approach as is used for Note's content.
*/
/** @returns {Promise&lt;*>} */
async getContent(silentNotFoundError = false) {
/** @returns {*} */
getContent(silentNotFoundError = false) {
if (this.content === undefined) {
const res = await sql.getRow(`SELECT content, hash FROM note_revision_contents WHERE noteRevisionId = ?`, [this.noteRevisionId]);
const res = sql.getRow(`SELECT content FROM note_revision_contents WHERE noteRevisionId = ?`, [this.noteRevisionId]);
if (!res) {
if (silentNotFoundError) {
@@ -108,7 +105,6 @@ class NoteRevision extends Entity {
}
this.content = res.content;
if (this.isProtected) {
if (protectedSessionService.isProtectedSessionAvailable()) {
this.content = protectedSessionService.decrypt(this.content);
@@ -129,20 +125,13 @@ class NoteRevision extends Entity {
}
}
/** @returns {Promise} */
async setContent(content) {
// force updating note itself so that utcDateModified is represented correctly even for the content
this.forcedChange = true;
this.contentLength = content === null ? 0 : content.length;
await this.save();
setContent(content) {
this.content = content;
const pojo = {
noteRevisionId: this.noteRevisionId,
content: content,
utcDateModified: dateUtils.utcNowDateTime(),
hash: utils.hash(this.noteRevisionId + "|" + content)
utcDateModified: dateUtils.utcNowDateTime()
};
if (this.isProtected) {
@@ -154,17 +143,23 @@ class NoteRevision extends Entity {
}
}
await sql.upsert("note_revision_contents", "noteRevisionId", pojo);
sql.upsert("note_revision_contents", "noteRevisionId", pojo);
await syncTableService.addNoteRevisionContentSync(this.noteRevisionId);
const hash = utils.hash(this.noteRevisionId + "|" + content);
entityChangesService.addEntityChange({
entityName: 'note_revision_contents',
entityId: this.noteRevisionId,
hash: hash,
isErased: false,
utcDateChanged: this.getUtcDateChanged()
}, null);
}
beforeSaving() {
super.beforeSaving();
if (this.isChanged) {
this.utcDateModified = dateUtils.utcNowDateTime();
}
this.utcDateModified = dateUtils.utcNowDateTime();
}
// cannot be static!
@@ -183,7 +178,8 @@ class NoteRevision extends Entity {
}
}
module.exports = NoteRevision;</code></pre>
module.exports = NoteRevision;
</code></pre>
</article>
</section>
@@ -199,7 +195,7 @@ module.exports = NoteRevision;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -60,13 +60,12 @@ class Option extends Entity {
super.beforeSaving();
if (this.isChanged) {
this.utcDateModified = dateUtils.utcNowDateTime();
}
this.utcDateModified = dateUtils.utcNowDateTime();
}
}
module.exports = Option;</code></pre>
module.exports = Option;
</code></pre>
</article>
</section>
@@ -82,7 +81,7 @@ module.exports = Option;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -36,21 +36,15 @@ const dateUtils = require('../services/date_utils');
*
* @property {string} noteId
* @property {string} notePath
* @property {boolean} isDeleted
* @property {string} utcDateModified
* @property {string} utcDateCreated
*
* @extends Entity
*/
class RecentNote extends Entity {
static get entityName() { return "recent_notes"; }
static get primaryKeyName() { return "noteId"; }
static get hashedProperties() { return ["noteId", "notePath", "utcDateCreated", "isDeleted"]; }
beforeSaving() {
if (!this.isDeleted) {
this.isDeleted = false;
}
if (!this.utcDateCreated) {
this.utcDateCreated = dateUtils.utcNowDateTime();
}
@@ -59,7 +53,8 @@ class RecentNote extends Entity {
}
}
module.exports = RecentNote;</code></pre>
module.exports = RecentNote;
</code></pre>
</article>
</section>
@@ -75,7 +70,7 @@ module.exports = RecentNote;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -391,7 +391,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line212">line 212</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line215">line 215</a>
</li></ul></dd>
@@ -579,7 +579,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line173">line 173</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line176">line 176</a>
</li></ul></dd>
@@ -767,7 +767,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line233">line 233</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line236">line 236</a>
</li></ul></dd>
@@ -1053,7 +1053,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line240">line 240</a>
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line243">line 243</a>
</li></ul></dd>
@@ -1089,7 +1089,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -56,7 +56,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -38,9 +38,9 @@ const repository = require('./repository');
const axios = require('axios');
const dayjs = require('dayjs');
const cloningService = require('./cloning');
const ws = require('./ws.js');
const appInfo = require('./app_info');
const searchService = require('./search');
const searchService = require('./search/services/search');
const SearchContext = require("./search/search_context.js");
/**
* This is the main backend API interface for scripts. It's published in the local "api" object.
@@ -78,38 +78,31 @@ function BackendScriptApi(currentNote, apiParams) {
/**
* @method
* @param {string} noteId
* @returns {Promise&lt;Note|null>}
* @returns {Note|null}
*/
this.getNote = repository.getNote;
/**
* @method
* @param {string} branchId
* @returns {Promise&lt;Branch|null>}
* @returns {Branch|null}
*/
this.getBranch = repository.getBranch;
/**
* @method
* @param {string} attributeId
* @returns {Promise&lt;Attribute|null>}
* @returns {Attribute|null}
*/
this.getAttribute = repository.getAttribute;
/**
* @method
* @param {string} imageId
* @returns {Promise&lt;Image|null>}
*/
this.getImage = repository.getImage;
/**
* Retrieves first entity from the SQL's result set.
*
* @method
* @param {string} SQL query
* @param {Array.&lt;?>} array of params
* @returns {Promise&lt;Entity|null>}
* @returns {Entity|null}
*/
this.getEntity = repository.getEntity;
@@ -117,30 +110,40 @@ function BackendScriptApi(currentNote, apiParams) {
* @method
* @param {string} SQL query
* @param {Array.&lt;?>} array of params
* @returns {Promise&lt;Entity[]>}
* @returns {Entity[]}
*/
this.getEntities = repository.getEntities;
/**
* This is a powerful search method - you can search by attributes and their values, e.g.:
* "@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
*
* @method
* @param {string} searchString
* @returns {Promise&lt;Note[]>}
* @param {string} query
* @param {Object} [searchParams]
* @returns {Note[]}
*/
this.searchForNotes = searchService.searchForNotes;
this.searchForNotes = (query, searchParams = {}) => {
if (searchParams.includeArchivedNotes === undefined) {
searchParams.includeArchivedNotes = true;
}
const noteIds = searchService.findNotesWithQuery(query, new SearchContext(searchParams))
.map(sr => sr.noteId);
return repository.getNotes(noteIds);
};
/**
* This is a powerful search method - you can search by attributes and their values, e.g.:
* "@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
*
* @method
* @param {string} searchString
* @returns {Promise&lt;Note|null>}
* @returns {Note|null}
*/
this.searchForNote = async searchString => {
const notes = await searchService.searchForNotes(searchString);
this.searchForNote = searchString => {
const notes = searchService.searchNoteEntities(searchString);
return notes.length > 0 ? notes[0] : null;
};
@@ -151,7 +154,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @method
* @param {string} name - attribute name
* @param {string} [value] - attribute value
* @returns {Promise&lt;Note[]>}
* @returns {Note[]}
*/
this.getNotesWithLabel = attributeService.getNotesWithLabel;
@@ -161,7 +164,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @method
* @param {string} name - attribute name
* @param {string} [value] - attribute value
* @returns {Promise&lt;Note|null>}
* @returns {Note|null}
*/
this.getNoteWithLabel = attributeService.getNoteWithLabel;
@@ -172,7 +175,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @param {string} noteId
* @param {string} parentNoteId
* @param {string} prefix - if branch will be create between note and parent note, set this prefix
* @returns {Promise&lt;void>}
* @returns {void}
*/
this.ensureNoteIsPresentInParent = cloningService.ensureNoteIsPresentInParent;
@@ -182,7 +185,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @method
* @param {string} noteId
* @param {string} parentNoteId
* @returns {Promise&lt;void>}
* @returns {void}
*/
this.ensureNoteIsAbsentFromParent = cloningService.ensureNoteIsAbsentFromParent;
@@ -194,7 +197,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @param {string} noteId
* @param {string} parentNoteId
* @param {string} prefix - if branch will be create between note and parent note, set this prefix
* @returns {Promise&lt;void>}
* @returns {void}
*/
this.toggleNoteInParent = cloningService.toggleNoteInParent;
@@ -211,9 +214,9 @@ function BackendScriptApi(currentNote, apiParams) {
* @param {string} parentNoteId
* @param {string} title
* @param {string} content
* @return {Promise&lt;{note: Note, branch: Branch}>}
* @return {{note: Note, branch: Branch}}
*/
this.createTextNote = async (parentNoteId, title, content = '') => await noteService.createNewNote({
this.createTextNote = (parentNoteId, title, content = '') => noteService.createNewNote({
parentNoteId,
title,
content,
@@ -227,9 +230,9 @@ function BackendScriptApi(currentNote, apiParams) {
* @param {string} parentNoteId
* @param {string} title
* @param {object} content
* @return {Promise&lt;{note: Note, branch: Branch}>}
* @return {{note: Note, branch: Branch}}
*/
this.createDataNote = async (parentNoteId, title, content = {}) => await noteService.createNewNote({
this.createDataNote = (parentNoteId, title, content = {}) => noteService.createNewNote({
parentNoteId,
title,
content: JSON.stringify(content, null, '\t'),
@@ -254,7 +257,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @method
*
* @param {CreateNewNoteParams} [params]
* @returns {Promise&lt;{note: Note, branch: Branch}>} object contains newly created entities note and branch
* @returns {{note: Note, branch: Branch}} object contains newly created entities note and branch
*/
this.createNewNote = noteService.createNewNote;
@@ -276,19 +279,19 @@ function BackendScriptApi(currentNote, apiParams) {
/**
* @method
* @deprecated please use createNote() API method instead
* @deprecated please use createTextNote() with similar API for simpler use cases or createNewNote() for more complex needs
*
* @param {string} parentNoteId - create new note under this parent
* @param {string} title
* @param {string} [content=""]
* @param {CreateNoteExtraOptions} [extraOptions={}]
* @returns {Promise&lt;{note: Note, branch: Branch}>} object contains newly created entities note and branch
* @returns {{note: Note, branch: Branch}} object contains newly created entities note and branch
*/
this.createNote = async (parentNoteId, title, content = "", extraOptions= {}) => {
this.createNote = (parentNoteId, title, content = "", extraOptions= {}) => {
extraOptions.parentNoteId = parentNoteId;
extraOptions.title = title;
const parentNote = await repository.getNote(parentNoteId);
const parentNote = repository.getNote(parentNoteId);
// code note type can be inherited, otherwise text is default
extraOptions.type = parentNote.type === 'code' ? 'code' : 'text';
@@ -303,19 +306,21 @@ function BackendScriptApi(currentNote, apiParams) {
extraOptions.content = content;
}
const {note, branch} = await noteService.createNewNote(extraOptions);
return sql.transactional(() => {
const {note, branch} = noteService.createNewNote(extraOptions);
for (const attr of extraOptions.attributes || []) {
await attributeService.createAttribute({
noteId: note.noteId,
type: attr.type,
name: attr.name,
value: attr.value,
isInheritable: !!attr.isInheritable
});
}
for (const attr of extraOptions.attributes || []) {
attributeService.createAttribute({
noteId: note.noteId,
type: attr.type,
name: attr.name,
value: attr.value,
isInheritable: !!attr.isInheritable
});
}
return {note, branch};
return {note, branch};
});
};
/**
@@ -329,7 +334,7 @@ function BackendScriptApi(currentNote, apiParams) {
* Returns root note of the calendar.
*
* @method
* @returns {Promise&lt;Note|null>}
* @returns {Note|null}
*/
this.getRootCalendarNote = dateNoteService.getRootCalendarNote;
@@ -338,7 +343,7 @@ function BackendScriptApi(currentNote, apiParams) {
*
* @method
* @param {string} date in YYYY-MM-DD format
* @returns {Promise&lt;Note|null>}
* @returns {Note|null}
*/
this.getDateNote = dateNoteService.getDateNote;
@@ -346,7 +351,7 @@ function BackendScriptApi(currentNote, apiParams) {
* Returns today's day note. If such note doesn't exist, it is created.
*
* @method
* @returns {Promise&lt;Note|null>}
* @returns {Note|null}
*/
this.getTodayNote = dateNoteService.getTodayNote;
@@ -356,7 +361,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @method
* @param {string} date in YYYY-MM-DD format
* @param {object} options - "startOfTheWeek" - either "monday" (default) or "sunday"
* @returns {Promise&lt;Note|null>}
* @returns {Note|null}
*/
this.getWeekNote = dateNoteService.getWeekNote;
@@ -365,7 +370,7 @@ function BackendScriptApi(currentNote, apiParams) {
*
* @method
* @param {string} date in YYYY-MM format
* @returns {Promise&lt;Note|null>}
* @returns {Note|null}
*/
this.getMonthNote = dateNoteService.getMonthNote;
@@ -374,14 +379,13 @@ function BackendScriptApi(currentNote, apiParams) {
*
* @method
* @param {string} year in YYYY format
* @returns {Promise&lt;Note|null>}
* @returns {Note|null}
*/
this.getYearNote = dateNoteService.getYearNote;
/**
* @method
* @param {string} parentNoteId - this note's child notes will be sorted
* @returns Promise&lt;void>
*/
this.sortNotesAlphabetically = treeService.sortNotesAlphabetically;
@@ -403,12 +407,9 @@ function BackendScriptApi(currentNote, apiParams) {
* This functions wraps code which is supposed to be running in transaction. If transaction already
* exists, then we'll use that transaction.
*
* This method is required only when script has label manualTransactionHandling, all other scripts are
* transactional by default.
*
* @method
* @param {function} func
* @returns {Promise&lt;?>} result of func callback
* @returns {?} result of func callback
*/
this.transactional = sql.transactional;
@@ -443,7 +444,7 @@ module.exports = BackendScriptApi;
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -93,7 +93,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line3">line 3</a>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line2">line 2</a>
</li></ul></dd>
@@ -201,7 +201,7 @@
<h4 class="name" id="isDeleted"><span class="type-signature"></span>isDeleted<span class="type-signature"></span></h4>
<h4 class="name" id="fromSearchNote"><span class="type-signature"></span>fromSearchNote<span class="type-signature"></span></h4>
@@ -259,6 +259,64 @@
<h4 class="name" id="isDeleted"><span class="type-signature"></span>isDeleted<span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line25">line 25</a>
</li></ul></dd>
</dl>
<h4 class="name" id="isExpanded"><span class="type-signature"></span>isExpanded<span class="type-signature"></span></h4>
@@ -607,7 +665,109 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line27">line 27</a>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line29">line 29</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="NoteShort.html">NoteShort</a></span>
</dd>
</dl>
<h4 class="name" id="getNoteFromCache"><span class="type-signature"></span>getNoteFromCache<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="NoteShort.html">NoteShort</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line34">line 34</a>
</li></ul></dd>
@@ -709,7 +869,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line32">line 32</a>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line39">line 39</a>
</li></ul></dd>
@@ -811,7 +971,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line37">line 37</a>
<a href="entities_branch.js.html">entities/branch.js</a>, <a href="entities_branch.js.html#line44">line 44</a>
</li></ul></dd>
@@ -885,7 +1045,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -81,7 +81,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line24">line 24</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line22">line 22</a>
</li></ul></dd>
@@ -223,7 +223,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line28">line 28</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line26">line 26</a>
</li></ul></dd>
@@ -329,7 +329,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line50">line 50</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line48">line 48</a>
</li></ul></dd>
@@ -435,7 +435,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line41">line 41</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line39">line 39</a>
</li></ul></dd>
@@ -545,7 +545,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line33">line 33</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line31">line 31</a>
</li></ul></dd>
@@ -658,7 +658,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line35">line 35</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line33">line 33</a>
</li></ul></dd>
@@ -768,7 +768,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line31">line 31</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line29">line 29</a>
</li></ul></dd>
@@ -874,7 +874,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line44">line 44</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line42">line 42</a>
</li></ul></dd>
@@ -980,7 +980,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line47">line 47</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line45">line 45</a>
</li></ul></dd>
@@ -1109,7 +1109,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line69">line 69</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line67">line 67</a>
</li></ul></dd>
@@ -1264,7 +1264,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line59">line 59</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line57">line 57</a>
</li></ul></dd>
@@ -1419,7 +1419,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line89">line 89</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line101">line 101</a>
</li></ul></dd>
@@ -1556,7 +1556,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line289">line 289</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line302">line 302</a>
</li></ul></dd>
@@ -1712,7 +1712,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line394">line 394</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line413">line 413</a>
</li></ul></dd>
@@ -1748,7 +1748,7 @@
<h4 class="name" id="createNoteLink"><span class="type-signature"></span>createNoteLink<span class="signature">(notePath, noteTitle<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<h4 class="name" id="createNoteLink"><span class="type-signature"></span>createNoteLink<span class="signature">(notePath, params<span class="signature-attributes">opt</span>, title=<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
@@ -1825,7 +1825,148 @@
<tr>
<td class="name"><code>noteTitle</code></td>
<td class="name"><code>params</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>showTooltip</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last">enable/disable tooltip on the link</td>
</tr>
<tr>
<td class="name"><code>showNotePath</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">show also whole note's path as part of the link</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>title=</code></td>
<td class="type">
@@ -1851,7 +1992,7 @@
<td class="description last">if not present we'll use note title</td>
<td class="description last">custom link tile with note's title as default</td>
</tr>
@@ -1892,7 +2033,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line281">line 281</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line294">line 294</a>
</li></ul></dd>
@@ -2025,7 +2166,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line243">line 243</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line253">line 253</a>
</li></ul></dd>
@@ -2131,7 +2272,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line295">line 295</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line308">line 308</a>
</li></ul></dd>
@@ -2237,7 +2378,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line309">line 309</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line322">line 322</a>
</li></ul></dd>
@@ -2391,7 +2532,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line303">line 303</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line316">line 316</a>
</li></ul></dd>
@@ -2528,7 +2669,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line360">line 360</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line373">line 373</a>
</li></ul></dd>
@@ -2635,7 +2776,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line236">line 236</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line246">line 246</a>
</li></ul></dd>
@@ -2790,7 +2931,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line369">line 369</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line382">line 382</a>
</li></ul></dd>
@@ -2946,7 +3087,7 @@ if some action needs to happen on only one specific instance.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line208">line 208</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line218">line 218</a>
</li></ul></dd>
@@ -3147,7 +3288,7 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line220">line 220</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line230">line 230</a>
</li></ul></dd>
@@ -3253,7 +3394,7 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line351">line 351</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line364">line 364</a>
</li></ul></dd>
@@ -3408,7 +3549,7 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line378">line 378</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line391">line 391</a>
</li></ul></dd>
@@ -3462,6 +3603,184 @@ otherwise (by e.g. createNoteLink())
<h4 class="name" id="openTabWithNote"><span class="type-signature"></span>openTabWithNote<span class="signature">(notePath, activate)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<div class="description">
Open a note in a new tab.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>notePath</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">(or noteId)</td>
</tr>
<tr>
<td class="name"><code>activate</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">set to true to activate the new tab, false to stay on the current tab</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line81">line 81</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
</dd>
</dl>
<h4 class="name" id="parseDate"><span class="type-signature"></span>parseDate<span class="signature">(str)</span><span class="type-signature"> &rarr; {Date}</span></h4>
@@ -3559,7 +3878,7 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line250">line 250</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line260">line 260</a>
</li></ul></dd>
@@ -3667,7 +3986,7 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line321">line 321</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line334">line 334</a>
</li></ul></dd>
@@ -3823,7 +4142,7 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line332">line 332</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line345">line 345</a>
</li></ul></dd>
@@ -3979,7 +4298,139 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line341">line 341</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line354">line 354</a>
</li></ul></dd>
</dl>
<h4 class="name" id="refreshIncludedNote"><span class="type-signature"></span>refreshIncludedNote<span class="signature">(includedNoteId)</span><span class="type-signature"></span></h4>
<div class="description">
This will refresh all currently opened notes which have included note specified in the parameter
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>includedNoteId</code></td>
<td class="type">
</td>
<td class="description last">noteId of the included note</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line431">line 431</a>
</li></ul></dd>
@@ -4065,7 +4516,7 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line272">line 272</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line282">line 282</a>
</li></ul></dd>
@@ -4202,7 +4653,7 @@ otherwise (by e.g. createNoteLink())
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line228">line 228</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line238">line 238</a>
</li></ul></dd>
@@ -4363,7 +4814,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line139">line 139</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line151">line 151</a>
</li></ul></dd>
@@ -4471,7 +4922,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line168">line 168</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line180">line 180</a>
</li></ul></dd>
@@ -4516,7 +4967,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<div class="description">
This is a powerful search method - you can search by attributes and their values, e.g.:
"@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
"#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
</div>
@@ -4609,7 +5060,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line196">line 196</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line206">line 206</a>
</li></ul></dd>
@@ -4672,7 +5123,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<div class="description">
This is a powerful search method - you can search by attributes and their values, e.g.:
"@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
"#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
</div>
@@ -4765,7 +5216,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line178">line 178</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line190">line 190</a>
</li></ul></dd>
@@ -4827,7 +5278,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<div class="description">
Hoist note. See https://github.com/zadam/trilium/wiki/Note-hoisting
Hoist note in the current tab. See https://github.com/zadam/trilium/wiki/Note-hoisting
</div>
@@ -4920,7 +5371,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line387">line 387</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line400">line 400</a>
</li></ul></dd>
@@ -5071,7 +5522,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line315">line 315</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line328">line 328</a>
</li></ul></dd>
@@ -5208,7 +5659,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line266">line 266</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line276">line 276</a>
</li></ul></dd>
@@ -5345,7 +5796,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line258">line 258</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line268">line 268</a>
</li></ul></dd>
@@ -5437,7 +5888,7 @@ Typical use case is when new note has been created, we should wait until it is s
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line405">line 405</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line424">line 424</a>
</li></ul></dd>
@@ -5489,7 +5940,7 @@ Typical use case is when new note has been created, we should wait until it is s
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -93,7 +93,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line5">line 5</a>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line4">line 4</a>
</li></ul></dd>
@@ -143,6 +143,122 @@
<h4 class="name" id="combinedDateModified"><span class="type-signature"></span>combinedDateModified<span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
<h4 class="name" id="combinedUtcDateModified"><span class="type-signature"></span>combinedUtcDateModified<span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line35">line 35</a>
</li></ul></dd>
</dl>
<h4 class="name" id="content"><span class="type-signature"></span>content<span class="type-signature"></span></h4>
@@ -183,7 +299,65 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line10">line 10</a>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line12">line 12</a>
</li></ul></dd>
</dl>
<h4 class="name" id="contentLength"><span class="type-signature"></span>contentLength<span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line15">line 15</a>
</li></ul></dd>
@@ -241,7 +415,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line13">line 13</a>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line18">line 18</a>
</li></ul></dd>
@@ -299,7 +473,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line16">line 16</a>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line21">line 21</a>
</li></ul></dd>
@@ -415,7 +589,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line19">line 19</a>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line24">line 24</a>
</li></ul></dd>
@@ -473,7 +647,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line22">line 22</a>
<a href="entities_note_complement.js.html">entities/note_complement.js</a>, <a href="entities_note_complement.js.html#line27">line 27</a>
</li></ul></dd>
@@ -513,7 +687,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

File diff suppressed because it is too large Load Diff

View File

@@ -26,7 +26,9 @@
<section>
<article>
<pre class="prettyprint source linenums"><code>class Attribute {
<pre class="prettyprint source linenums"><code>import promotedAttributeDefinitionParser from '../services/promoted_attribute_definition_parser.js';
class Attribute {
constructor(treeCache, row) {
this.treeCache = treeCache;
@@ -47,29 +49,88 @@
/** @param {int} position */
this.position = row.position;
/** @param {boolean} isInheritable */
this.isInheritable = row.isInheritable;
this.isInheritable = !!row.isInheritable;
/** @param {boolean} */
this.isDeleted = !!row.isDeleted;
}
/** @returns {NoteShort} */
async getNote() {
return await this.treeCache.getNote(this.noteId);
getNote() {
return this.treeCache.notes[this.noteId];
}
get jsonValue() {
try {
return JSON.parse(this.value);
}
catch (e) {
return null;
}
get targetNoteId() { // alias
return this.type === 'relation' ? this.value : undefined;
}
get isAutoLink() {
return this.type === 'relation' &amp;&amp; ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(this.name);
}
get toString() {
return `Attribute(attributeId=${this.attributeId}, type=${this.type}, name=${this.name}, value=${this.value})`;
}
/**
* @return {boolean} - returns true if this attribute has the potential to influence the note in the argument.
* That can happen in multiple ways:
* 1. attribute is owned by the note
* 2. attribute is owned by the template of the note
* 3. attribute is owned by some note's ancestor and is inheritable
*/
isAffecting(affectedNote) {
if (!affectedNote) {
return false;
}
const attrNote = this.getNote();
if (!attrNote) {
// the note (owner of the attribute) is not even loaded into the cache so it should not affect anything else
return false;
}
const owningNotes = [affectedNote, ...affectedNote.getTemplateNotes()];
for (const owningNote of owningNotes) {
if (owningNote.noteId === attrNote.noteId) {
return true;
}
}
if (this.isInheritable) {
for (const owningNote of owningNotes) {
if (owningNote.hasAncestor(attrNote)) {
return true;
}
}
}
return false;
}
isDefinition() {
return this.type === 'label' &amp;&amp; (this.name.startsWith('label:') || this.name.startsWith('relation:'));
}
getDefinition() {
return promotedAttributeDefinitionParser.parse(this.value);
}
isDefinitionFor(attr) {
return this.type === 'label' &amp;&amp; this.name === `${attr.type}:${attr.name}`;
}
get dto() {
const dto = Object.assign({}, this);
delete dto.treeCache;
return dto;
}
}
export default Attribute;</code></pre>
export default Attribute;
</code></pre>
</article>
</section>
@@ -85,7 +146,7 @@ export default Attribute;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -48,6 +48,8 @@ class Branch {
/** @param {boolean} */
this.isExpanded = !!row.isExpanded;
/** @param {boolean} */
this.fromSearchNote = !!row.fromSearchNote;
/** @param {boolean} */
this.isDeleted = !!row.isDeleted;
}
@@ -56,6 +58,11 @@ class Branch {
return this.treeCache.getNote(this.noteId);
}
/** @returns {NoteShort} */
getNoteFromCache() {
return this.treeCache.getNoteFromCache(this.noteId);
}
/** @returns {NoteShort} */
async getParentNote() {
return this.treeCache.getNote(this.parentNoteId);
@@ -71,7 +78,8 @@ class Branch {
}
}
export default Branch;</code></pre>
export default Branch;
</code></pre>
</article>
</section>
@@ -87,7 +95,7 @@ export default Branch;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -34,9 +34,14 @@ class NoteComplement {
/** @param {string} */
this.noteId = row.noteId;
/** @param {string} */
/**
* @param {string} - can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images)
*/
this.content = row.content;
/** @param {int} */
this.contentLength = row.contentLength;
/** @param {string} */
this.dateCreated = row.dateCreated;
@@ -48,10 +53,19 @@ class NoteComplement {
/** @param {string} */
this.utcDateModified = row.utcDateModified;
// "combined" date modified give larger out of note's and note_content's dateModified
/** @param {string} */
this.combinedDateModified = row.combinedDateModified;
/** @param {string} */
this.combinedUtcDateModified = row.combinedUtcDateModified;
}
}
export default NoteComplement;</code></pre>
export default NoteComplement;
</code></pre>
</article>
</section>
@@ -67,7 +81,7 @@ export default NoteComplement;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -27,14 +27,26 @@
<section>
<article>
<pre class="prettyprint source linenums"><code>import server from '../services/server.js';
import Attribute from './attribute.js';
import noteAttributeCache from "../services/note_attribute_cache.js";
import ws from "../services/ws.js";
import options from "../services/options.js";
const LABEL = 'label';
const LABEL_DEFINITION = 'label-definition';
const RELATION = 'relation';
const RELATION_DEFINITION = 'relation-definition';
const NOTE_TYPE_ICONS = {
"file": "bx bx-file",
"image": "bx bx-image",
"code": "bx bx-code",
"render": "bx bx-extension",
"search": "bx bx-file-find",
"relation-map": "bx bx-map-alt",
"book": "bx bx-book"
};
/**
* FIXME: since there's no "full note" anymore we can rename this to Note
*
* This note's representation is used in note tree and is kept in TreeCache.
*/
class NoteShort {
@@ -70,8 +82,6 @@ class NoteShort {
this.noteId = row.noteId;
/** @param {string} */
this.title = row.title;
/** @param {int} */
this.contentLength = row.contentLength;
/** @param {boolean} */
this.isProtected = !!row.isProtected;
/** @param {string} one of 'text', 'code', 'file' or 'render' */
@@ -79,10 +89,14 @@ class NoteShort {
/** @param {string} content-type, e.g. "application/json" */
this.mime = row.mime;
/** @param {boolean} */
this.isDeleted = row.isDeleted;
this.isDeleted = !!row.isDeleted;
}
addParent(parentNoteId, branchId) {
if (parentNoteId === 'none') {
return;
}
if (!this.parents.includes(parentNoteId)) {
this.parents.push(parentNoteId);
}
@@ -90,13 +104,19 @@ class NoteShort {
this.parentToBranch[parentNoteId] = branchId;
}
addChild(childNoteId, branchId) {
if (!this.children.includes(childNoteId)) {
addChild(childNoteId, branchId, sort = true) {
if (!(childNoteId in this.childToBranch)) {
this.children.push(childNoteId);
}
this.childToBranch[childNoteId] = branchId;
if (sort) {
this.sortChildren();
}
}
sortChildren() {
const branchIdPos = {};
for (const branchId of Object.values(this.childToBranch)) {
@@ -184,9 +204,9 @@ class NoteShort {
getOwnedAttributes(type, name) {
const attrs = this.attributes
.map(attributeId => this.treeCache.attributes[attributeId])
.filter(attr => !!attr);
.filter(Boolean); // filter out nulls;
return this.__filterAttrs(attrs, type, name)
return this.__filterAttrs(attrs, type, name);
}
/**
@@ -195,48 +215,66 @@ class NoteShort {
* @returns {Attribute[]} all note's attributes, including inherited ones
*/
getAttributes(type, name) {
const ownedAttributes = this.getOwnedAttributes();
return this.__filterAttrs(this.__getCachedAttributes([]), type, name);
}
const attrArrs = [
ownedAttributes
];
for (const templateAttr of ownedAttributes.filter(oa => oa.type === 'relation' &amp;&amp; oa.name === 'template')) {
const templateNote = this.treeCache.getNoteFromCache(templateAttr.value);
if (templateNote) {
attrArrs.push(templateNote.getAttributes());
}
__getCachedAttributes(path) {
// notes/clones cannot form tree cycles, it is possible to create attribute inheritance cycle via templates
// when template instance is a parent of template itself
if (path.includes(this.noteId)) {
return [];
}
if (this.noteId !== 'root') {
for (const parentNote of this.getParentNotes()) {
// these virtual parent-child relationships are also loaded into frontend tree cache
if (parentNote.type !== 'search') {
attrArrs.push(parentNote.getInheritableAttributes());
if (!(this.noteId in noteAttributeCache.attributes)) {
const newPath = [...path, this.noteId];
const attrArrs = [ this.getOwnedAttributes() ];
if (this.noteId !== 'root') {
for (const parentNote of this.getParentNotes()) {
// these virtual parent-child relationships are also loaded into frontend tree cache
if (parentNote.type !== 'search') {
attrArrs.push(parentNote.__getInheritableAttributes(newPath));
}
}
}
for (const templateAttr of attrArrs.flat().filter(attr => attr.type === 'relation' &amp;&amp; attr.name === 'template')) {
const templateNote = this.treeCache.notes[templateAttr.value];
if (templateNote &amp;&amp; templateNote.noteId !== this.noteId) {
attrArrs.push(templateNote.__getCachedAttributes(newPath));
}
}
noteAttributeCache.attributes[this.noteId] = [];
const addedAttributeIds = new Set();
for (const attr of attrArrs.flat()) {
if (!addedAttributeIds.has(attr.attributeId)) {
addedAttributeIds.add(attr.attributeId);
noteAttributeCache.attributes[this.noteId].push(attr);
}
}
}
const attributes = attrArrs.flat();
return this.__filterAttrs(attributes, type, name);
return noteAttributeCache.attributes[this.noteId];
}
__filterAttrs(attributes, type, name) {
if (type &amp;&amp; name) {
if (!type &amp;&amp; !name) {
return attributes;
} else if (type &amp;&amp; name) {
return attributes.filter(attr => attr.type === type &amp;&amp; attr.name === name);
} else if (type) {
return attributes.filter(attr => attr.type === type);
} else if (name) {
return attributes.filter(attr => attr.name === name);
} else {
return attributes;
}
}
getInheritableAttributes() {
const attrs = this.getAttributes();
__getInheritableAttributes(path) {
const attrs = this.__getCachedAttributes(path);
return attrs.filter(attr => attr.isInheritable);
}
@@ -257,12 +295,61 @@ class NoteShort {
return this.getAttributes(LABEL, name);
}
/**
* @param {string} [name] - label name to filter
* @returns {Attribute[]} all note's label definitions, including inherited ones
*/
getLabelDefinitions(name) {
return this.getAttributes(LABEL_DEFINITION, name);
getIcon() {
const iconClassLabels = this.getLabels('iconClass');
const workspaceIconClass = this.getWorkspaceIconClass();
if (iconClassLabels.length > 0) {
return iconClassLabels.map(l => l.value).join(' ');
}
else if (workspaceIconClass) {
return workspaceIconClass;
}
else if (this.noteId === 'root') {
return "bx bx-chevrons-right";
}
else if (this.type === 'text') {
if (this.isFolder()) {
return "bx bx-folder";
}
else {
return "bx bx-note";
}
}
else if (this.type === 'code' &amp;&amp; this.mime.startsWith('text/x-sql')) {
return "bx bx-data";
}
else {
return NOTE_TYPE_ICONS[this.type];
}
}
isFolder() {
return this.type === 'search'
|| this.getFilteredChildBranches().length > 0;
}
getFilteredChildBranches() {
let childBranches = this.getChildBranches();
if (!childBranches) {
ws.logError(`No children for ${parentNote}. This shouldn't happen.`);
return;
}
if (options.is("hideIncludedImages_main")) {
const imageLinks = this.getRelations('imageLink');
// image is already visible in the parent note so no need to display it separately in the book
childBranches = childBranches.filter(branch => !imageLinks.find(rel => rel.value === branch.noteId));
}
// we're not checking hideArchivedNotes since that would mean we need to lazy load the child notes
// which would seriously slow down everything.
// we check this flag only once user chooses to expand the parent. This has the negative consequence that
// note may appear as folder but not contain any children when all of them are archived
return childBranches;
}
/**
@@ -281,14 +368,6 @@ class NoteShort {
return this.getAttributes(RELATION, name);
}
/**
* @param {string} [name] - relation name to filter
* @returns {Attribute[]} all note's relation definitions including inherited ones
*/
getRelationDefinitions(name) {
return this.getAttributes(RELATION_DEFINITION, name);
}
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
@@ -326,7 +405,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;
}
/**
@@ -448,6 +527,58 @@ class NoteShort {
return targets;
}
/**
* @returns {NoteShort[]}
*/
getTemplateNotes() {
const relations = this.getRelations('template');
return relations.map(rel => this.treeCache.notes[rel.value]);
}
getPromotedDefinitionAttributes() {
if (this.hasLabel('hidePromotedAttributes')) {
return [];
}
return this.getAttributes()
.filter(attr => attr.isDefinition())
.filter(attr => {
const def = attr.getDefinition();
return def &amp;&amp; def.isPromoted;
});
}
hasAncestor(ancestorNote, visitedNoteIds) {
if (this.noteId === ancestorNote.noteId) {
return true;
}
if (!visitedNoteIds) {
visitedNoteIds = new Set();
} else if (visitedNoteIds.has(this.noteId)) {
// to avoid infinite cycle when template is descendent of the instance
return false;
}
visitedNoteIds.add(this.noteId);
for (const templateNote of this.getTemplateNotes()) {
if (templateNote.hasAncestor(ancestorNote, visitedNoteIds)) {
return true;
}
}
for (const parentNote of this.getParentNotes()) {
if (parentNote.hasAncestor(ancestorNote, visitedNoteIds)) {
return true;
}
}
return false;
}
/**
* Clear note's attributes cache to force fresh reload for next attribute request.
* Cache is note instance scoped.
@@ -466,6 +597,26 @@ class NoteShort {
.map(attributeId => this.treeCache.attributes[attributeId]);
}
/**
* Get relations which target this note
*
* @returns {NoteShort[]}
*/
async getTargetRelationSourceNotes() {
const targetRelations = this.getTargetRelations();
return await this.treeCache.getNotes(targetRelations.map(tr => tr.noteId));
}
/**
* Return note complement which is most importantly note's content
*
* @return {Promise&lt;NoteComplement>}
*/
async getNoteComplement() {
return await this.treeCache.getNoteComplement(this.noteId);
}
get toString() {
return `Note(noteId=${this.noteId}, title=${this.title})`;
}
@@ -481,9 +632,20 @@ class NoteShort {
const labels = this.getLabels('cssClass');
return labels.map(l => l.value).join(' ');
}
getWorkspaceIconClass() {
const labels = this.getLabels('workspaceIconClass');
return labels.length > 0 ? labels[0].value : "";
}
getWorkspaceTabBackgroundColor() {
const labels = this.getLabels('workspaceTabBackgroundColor');
return labels.length > 0 ? labels[0].value : "";
}
}
export default NoteShort;</code></pre>
export default NoteShort;
</code></pre>
</article>
</section>
@@ -499,7 +661,7 @@ export default NoteShort;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -156,7 +156,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="widgets_collapsible_widget.js.html">widgets/collapsible_widget.js</a>, <a href="widgets_collapsible_widget.js.html#line93">line 93</a>
<a href="widgets_collapsible_widget.js.html">widgets/collapsible_widget.js</a>, <a href="widgets_collapsible_widget.js.html#line124">line 124</a>
</li></ul></dd>
@@ -244,7 +244,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="widgets_collapsible_widget.js.html">widgets/collapsible_widget.js</a>, <a href="widgets_collapsible_widget.js.html#line96">line 96</a>
<a href="widgets_collapsible_widget.js.html">widgets/collapsible_widget.js</a>, <a href="widgets_collapsible_widget.js.html#line127">line 127</a>
</li></ul></dd>
@@ -333,7 +333,7 @@ separately but should behave uniformly for the user.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="widgets_collapsible_widget.js.html">widgets/collapsible_widget.js</a>, <a href="widgets_collapsible_widget.js.html#line86">line 86</a>
<a href="widgets_collapsible_widget.js.html">widgets/collapsible_widget.js</a>, <a href="widgets_collapsible_widget.js.html#line117">line 117</a>
</li></ul></dd>
@@ -572,7 +572,7 @@ separately but should behave uniformly for the user.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line76">line 76</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line88">line 88</a>
</li></ul></dd>
@@ -608,7 +608,7 @@ separately but should behave uniformly for the user.
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -56,7 +56,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -26,8 +26,7 @@
<section>
<article>
<pre class="prettyprint source linenums"><code>import treeService from './tree.js';
import server from './server.js';
<pre class="prettyprint source linenums"><code>import server from './server.js';
import utils from './utils.js';
import toastService from './toast.js';
import linkService from './link.js';
@@ -37,7 +36,6 @@ import protectedSessionService from './protected_session.js';
import dateNotesService from './date_notes.js';
import CollapsibleWidget from '../widgets/collapsible_widget.js';
import ws from "./ws.js";
import hoistedNoteService from "./hoisted_note.js";
import appContext from "./app_context.js";
import TabAwareWidget from "../widgets/tab_aware_widget.js";
import TabCachingWidget from "../widgets/tab_caching_widget.js";
@@ -95,12 +93,26 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* @return {Promise&lt;void>}
*/
this.activateNewNote = async notePath => {
await ws.waitForMaxKnownSyncId();
await ws.waitForMaxKnownEntityChangeId();
await appContext.tabManager.getActiveTabContext().setNote(notePath);
appContext.triggerEvent('focusAndSelectTitle');
};
/**
* Open a note in a new tab.
*
* @param {string} notePath (or noteId)
* @param {boolean} activate - set to true to activate the new tab, false to stay on the current tab
* @return {Promise&lt;void>}
*/
this.openTabWithNote = async (notePath, activate) => {
await ws.waitForMaxKnownEntityChangeId();
await appContext.tabManager.openTabWithNote(notePath, activate);
appContext.triggerEvent('focusAndSelectTitle');
};
/**
* @typedef {Object} ToolbarButtonOptions
* @property {string} title
@@ -115,9 +127,9 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* @param {ToolbarButtonOptions} opts
*/
this.addButtonToToolbar = opts => {
const buttonId = "toolbar-button-" + opts.title.replace(/[^a-zA-Z0-9]/g, "-");
const buttonId = "toolbar-button-" + opts.title.replace(/\s/g, "-");
const button = $('&lt;button>')
const button = $('&lt;button class="noborder">')
.addClass("btn btn-sm")
.on('click', opts.action);
@@ -180,7 +192,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
if (ret.success) {
// wait until all the changes done in the script has been synced to frontend before continuing
await ws.waitForSyncId(ret.maxSyncId);
await ws.waitForEntityChangeId(ret.maxEntityChangeId);
return ret.executionResult;
}
@@ -197,25 +209,23 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
/**
* This is a powerful search method - you can search by attributes and their values, e.g.:
* "@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
*
* @method
* @param {string} searchString
* @returns {Promise&lt;NoteShort[]>}
*/
this.searchForNotes = async searchString => {
const noteIds = await this.runOnServer(async searchString => {
const notes = await api.searchForNotes(searchString);
return notes.map(note => note.noteId);
}, [searchString]);
const noteIds = await this.runOnBackend(
searchString => api.searchForNotes(searchString).map(note => note.noteId),
[searchString]);
return await treeCache.getNotes(noteIds);
};
/**
* This is a powerful search method - you can search by attributes and their values, e.g.:
* "@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
*
* @method
* @param {string} searchString
@@ -304,7 +314,10 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
*
* @method
* @param {string} notePath (or noteId)
* @param {string} [noteTitle] - if not present we'll use note title
* @param {object} [params]
* @param {boolean} [params.showTooltip=true] - enable/disable tooltip on the link
* @param {boolean} [params.showNotePath=false] - show also whole note's path as part of the link
* @param {string} [title=] - custom link tile with note's title as default
*/
this.createNoteLink = linkService.createNoteLink;
@@ -406,13 +419,19 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
this.getYearNote = dateNotesService.getYearNote;
/**
* Hoist note. See https://github.com/zadam/trilium/wiki/Note-hoisting
* Hoist note in the current tab. See https://github.com/zadam/trilium/wiki/Note-hoisting
*
* @method
* @param {string} noteId - set hoisted note. 'root' will effectively unhoist
* @return {Promise}
*/
this.setHoistedNoteId = hoistedNoteService.setHoistedNoteId;
this.setHoistedNoteId = (noteId) => {
const activeTabContext = appContext.tabManager.getActiveTabContext();
if (activeTabContext) {
activeTabContext.setHoistedNoteId(noteId);
}
};
/**
* @method
@@ -430,10 +449,18 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
*
* @method
*/
this.waitUntilSynced = ws.waitForMaxKnownSyncId;
this.waitUntilSynced = ws.waitForMaxKnownEntityChangeId;
/**
* This will refresh all currently opened notes which have included note specified in the parameter
*
* @param includedNoteId - noteId of the included note
*/
this.refreshIncludedNote = includedNoteId => appContext.triggerEvent('refreshIncludedNote', {noteId: includedNoteId});
}
export default FrontendScriptApi;</code></pre>
export default FrontendScriptApi;
</code></pre>
</article>
</section>
@@ -449,7 +476,7 @@ export default FrontendScriptApi;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -31,16 +31,25 @@ import options from "../services/options.js";
const WIDGET_TPL = `
&lt;div class="card widget">
&lt;div class="card-header">
&lt;div class="card-header">
&lt;div>
&lt;button class="btn btn-sm widget-title" data-toggle="collapse" data-target="#[to be set]">
Collapsible Group Item
&lt;/button>
&lt;a class="widget-help external no-arrow bx bx-info-circle">&lt;/a>
&lt;a class="widget-toggle-button no-arrow"
title="Minimize/maximize widget"
data-toggle="collapse" data-target="#[to be set]">
&lt;span class="widget-toggle-icon bx">&lt;/span>
&lt;span class="widget-title">
Collapsible Group Item
&lt;/span>
&lt;/a>
&lt;span class="widget-header-actions">&lt;/span>
&lt;/div>
&lt;div class="widget-header-actions">&lt;/div>
&lt;div>
&lt;a class="widget-help external no-arrow bx bx-info-circle">&lt;/a>
&lt;/div>
&lt;/div>
&lt;div id="[to be set]" class="collapse body-wrapper" style="transition: none; ">
@@ -57,20 +66,28 @@ export default class CollapsibleWidget extends TabAwareWidget {
doRender() {
this.$widget = $(WIDGET_TPL);
this.contentSized();
this.$widget.find('[data-target]').attr('data-target', "#" + this.componentId);
this.$bodyWrapper = this.$widget.find('.body-wrapper');
this.$bodyWrapper.attr('id', this.componentId); // for toggle to work we need id
this.widgetName = this.constructor.name;
// not using constructor name because of webpack mangling class names ...
this.widgetName = this.widgetTitle.replace(/[^[a-zA-Z0-9]/g, "_");
if (!options.is(this.widgetName + 'Collapsed')) {
this.$toggleButton = this.$widget.find('.widget-toggle-button');
this.$toggleIcon = this.$widget.find('.widget-toggle-icon');
const collapsed = options.is(this.widgetName + 'Collapsed');
if (!collapsed) {
this.$bodyWrapper.collapse("show");
}
this.updateToggleIcon(collapsed);
// using immediate variants of the event so that the previous collapse is not caught
this.$bodyWrapper.on('hide.bs.collapse', () => this.saveCollapsed(true));
this.$bodyWrapper.on('show.bs.collapse', () => this.saveCollapsed(false));
this.$bodyWrapper.on('hide.bs.collapse', () => this.toggleCollapsed(true));
this.$bodyWrapper.on('show.bs.collapse', () => this.toggleCollapsed(false));
this.$body = this.$bodyWrapper.find('.card-body');
@@ -92,21 +109,35 @@ export default class CollapsibleWidget extends TabAwareWidget {
}
this.$headerActions = this.$widget.find('.widget-header-actions');
this.$headerActions.append(...this.headerActions);
this.$headerActions.append(this.headerActions);
this.initialized = this.doRenderBody();
this.decorateWidget();
return this.$widget;
}
saveCollapsed(collapse) {
toggleCollapsed(collapse) {
this.updateToggleIcon(collapse);
options.save(this.widgetName + 'Collapsed', collapse.toString());
this.triggerEvent(`widgetCollapsedStateChanged`, {widgetName: this.widgetName, collapse});
}
updateToggleIcon(collapse) {
if (collapse) {
this.$toggleIcon
.addClass("bx-chevron-right")
.removeClass("bx-chevron-down")
.attr("title", "Show");
} else {
this.$toggleIcon
.addClass("bx-chevron-down")
.removeClass("bx-chevron-right")
.attr("title", "Hide");
}
}
/**
* This event is used to synchronize collapsed state of all the tab-cached widgets since they are all rendered
* separately but should behave uniformly for the user.
@@ -126,7 +157,8 @@ export default class CollapsibleWidget extends TabAwareWidget {
isExpanded() {
return this.$bodyWrapper.hasClass("show");
}
}</code></pre>
}
</code></pre>
</article>
</section>
@@ -142,7 +174,7 @@ export default class CollapsibleWidget extends TabAwareWidget {
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>
</footer>
<script> prettyPrint(); </script>

View File

@@ -24,8 +24,6 @@ app.on('window-all-closed', () => {
app.on('ready', async () => {
app.setAppUserModelId('com.github.zadam.trilium');
await sqlInit.dbConnection;
// if db is not initialized -> setup process
// if db is initialized, then we need to wait until the migration process is finished
if (await sqlInit.isDbInitialized()) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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

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