Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
updated API docs
zadamc0b30e603afc
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.htmlindex 6f60a7867e..d4415c6ca8 100644--- a/docs/frontend_api/FrontendScriptApi.html+++ b/docs/frontend_api/FrontendScriptApi.html@@ -1390,7 +1390,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#line279">line 279</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line273">line 273</a></li></ul></dd>@@ -1523,7 +1523,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#line239">line 239</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line233">line 233</a></li></ul></dd>@@ -1629,7 +1629,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#line285">line 285</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line279">line 279</a></li></ul></dd>@@ -1735,7 +1735,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#line291">line 291</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line285">line 285</a></li></ul></dd>@@ -1894,7 +1894,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#line338">line 338</a>+ <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></li></ul></dd>@@ -2001,7 +2001,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#line232">line 232</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line226">line 226</a></li></ul></dd>@@ -2156,7 +2156,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#line347">line 347</a>+ <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></li></ul></dd>@@ -2619,7 +2619,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#line329">line 329</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line323">line 323</a></li></ul></dd>@@ -2774,7 +2774,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#line356">line 356</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line350">line 350</a></li></ul></dd>@@ -2883,7 +2883,7 @@ note.<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#line302">line 302</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line296">line 296</a></li></ul></dd>@@ -3038,7 +3038,7 @@ note.<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#line310">line 310</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line304">line 304</a></li></ul></dd>@@ -3171,7 +3171,7 @@ note.<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#line246">line 246</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line240">line 240</a></li></ul></dd>@@ -3277,7 +3277,7 @@ note.<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#line315">line 315</a></li></ul></dd>@@ -3365,7 +3365,7 @@ note.<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#line270">line 270</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line264">line 264</a></li></ul></dd>@@ -3419,7 +3419,7 @@ note.- <h4 class="name" id="reloadNotesAndTheirChildren"><span class="type-signature"></span>reloadNotesAndTheirChildren<span class="signature">(noteId)</span><span class="type-signature"></span></h4>+ <h4 class="name" id="reloadNotes"><span class="type-signature"></span>reloadNotes<span class="signature">(noteIds)</span><span class="type-signature"></span></h4>@@ -3459,13 +3459,13 @@ note.<tr>- <td class="name"><code>noteId</code></td>+ <td class="name"><code>noteIds</code></td><td class="type">-<span class="param-type">string</span>+<span class="param-type">Array.<string></span>@@ -3546,139 +3546,6 @@ note.------- <h4 class="name" id="reloadParents"><span class="type-signature"></span>reloadParents<span class="signature">(noteId)</span><span class="type-signature"></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>noteId</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_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line224">line 224</a>- </li></ul></dd>--------</dl>--------------------@@ -4281,7 +4148,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#line365">line 365</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line359">line 359</a></li></ul></dd>@@ -4432,7 +4299,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#line316">line 316</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line310">line 310</a></li></ul></dd>@@ -4569,7 +4436,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#line262">line 262</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line256">line 256</a></li></ul></dd>@@ -4706,7 +4573,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#line254">line 254</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line248">line 248</a></li></ul></dd>diff --git a/docs/frontend_api/NoteShort.html b/docs/frontend_api/NoteShort.htmlindex 11675a2c8a..1192154d21 100644--- a/docs/frontend_api/NoteShort.html+++ b/docs/frontend_api/NoteShort.html@@ -28,7 +28,7 @@<header>- <h2><span class="attribs"><span class="type-signature"></span></span>NoteShort<span class="signature">()</span><span class="type-signature"></span></h2>+ <h2><span class="attribs"><span class="type-signature"></span></span>NoteShort<span class="signature">(treeCache, row, branches)</span><span class="type-signature"></span></h2><div class="class-description">FIXME: rethink how attributes are cached in Note entities since they are long lived inside the cache.Attribute cache should be limited to "transaction".@@ -48,7 +48,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>- <h4 class="name" id="NoteShort"><span class="type-signature"></span>new NoteShort<span class="signature">()</span><span class="type-signature"></span></h4>+ <h4 class="name" id="NoteShort"><span class="type-signature"></span>new NoteShort<span class="signature">(treeCache, row, branches)</span><span class="type-signature"></span></h4>@@ -63,6 +63,101 @@ This note's representation is used in note tree and is kept in TreeCache.</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>treeCache</code></td>+++ <td class="type">+++<span class="param-type">TreeCache</span>++++ </td>++++++ <td class="description last"></td>+ </tr>++++ <tr>++ <td class="name"><code>row</code></td>+++ <td class="type">+++<span class="param-type">Object.<string, Object></span>++++ </td>++++++ <td class="description last"></td>+ </tr>++++ <tr>++ <td class="name"><code>branches</code></td>+++ <td class="type">+++<span class="param-type">Array.<<a href="Branch.html">Branch</a>></span>++++ </td>++++++ <td class="description last">all relevant branches, i.e. where this note is either child or parent</td>+ </tr>+++ </tbody>+</table>++@@ -96,7 +191,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line16">line 16</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line22">line 22</a></li></ul></dd>@@ -186,7 +281,143 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line29">line 29</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line35">line 35</a>+ </li></ul></dd>++++++++</dl>+++++++++<h4 class="name" id="children"><span class="type-signature"></span>children<span class="type-signature"> :Array.<string></span></h4>+++++++ <h5>Type:</h5>+ <ul>+ <li>++<span class="param-type">Array.<string></span>+++ </li>+ </ul>++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line42">line 42</a>+ </li></ul></dd>++++++++</dl>+++++++++<h4 class="name" id="childToBranch"><span class="type-signature"></span>childToBranch<span class="type-signature"> :Object.<string, string></span></h4>+++++++ <h5>Type:</h5>+ <ul>+ <li>++<span class="param-type">Object.<string, string></span>+++ </li>+ </ul>++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line48">line 48</a></li></ul></dd>@@ -244,7 +475,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line31">line 31</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line37">line 37</a></li></ul></dd>@@ -302,7 +533,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line23">line 23</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line29">line 29</a></li></ul></dd>@@ -360,7 +591,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line27">line 27</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line33">line 33</a></li></ul></dd>@@ -418,7 +649,143 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line19">line 19</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line25">line 25</a>+ </li></ul></dd>++++++++</dl>+++++++++<h4 class="name" id="parents"><span class="type-signature"></span>parents<span class="type-signature"> :Array.<string></span></h4>+++++++ <h5>Type:</h5>+ <ul>+ <li>++<span class="param-type">Array.<string></span>+++ </li>+ </ul>++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line40">line 40</a>+ </li></ul></dd>++++++++</dl>+++++++++<h4 class="name" id="parentToBranch"><span class="type-signature"></span>parentToBranch<span class="type-signature"> :Object.<string, string></span></h4>+++++++ <h5>Type:</h5>+ <ul>+ <li>++<span class="param-type">Object.<string, string></span>+++ </li>+ </ul>++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line45">line 45</a></li></ul></dd>@@ -476,7 +843,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line21">line 21</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line27">line 27</a></li></ul></dd>@@ -534,7 +901,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line25">line 25</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line31">line 31</a></li></ul></dd>@@ -682,7 +1049,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line169">line 169</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line217">line 217</a></li></ul></dd>@@ -849,7 +1216,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line109">line 109</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line157">line 157</a></li></ul></dd>@@ -1023,7 +1390,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line180">line 180</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line228">line 228</a></li></ul></dd>@@ -1129,7 +1496,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line60">line 60</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line115">line 115</a></li></ul></dd>@@ -1231,7 +1598,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line74">line 74</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line127">line 127</a></li></ul></dd>@@ -1333,7 +1700,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line96">line 96</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line144">line 144</a></li></ul></dd>@@ -1435,7 +1802,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line101">line 101</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line149">line 149</a></li></ul></dd>@@ -1586,7 +1953,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line202">line 202</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line250">line 250</a></li></ul></dd>@@ -1753,7 +2120,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line135">line 135</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line183">line 183</a></li></ul></dd>@@ -1920,7 +2287,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line127">line 127</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line175">line 175</a></li></ul></dd>@@ -2075,7 +2442,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line214">line 214</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line262">line 262</a></li></ul></dd>@@ -2181,7 +2548,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line86">line 86</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line134">line 134</a></li></ul></dd>@@ -2283,7 +2650,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line91">line 91</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line139">line 139</a></li></ul></dd>@@ -2434,7 +2801,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line208">line 208</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line256">line 256</a></li></ul></dd>@@ -2601,7 +2968,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line151">line 151</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line199">line 199</a></li></ul></dd>@@ -2768,7 +3135,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line143">line 143</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line191">line 191</a></li></ul></dd>@@ -2923,7 +3290,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line226">line 226</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line274">line 274</a></li></ul></dd>@@ -3093,7 +3460,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line236">line 236</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line284">line 284</a></li></ul></dd>@@ -3244,7 +3611,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line220">line 220</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line268">line 268</a></li></ul></dd>@@ -3354,7 +3721,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line260">line 260</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line308">line 308</a></li></ul></dd>@@ -3528,7 +3895,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line160">line 160</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line208">line 208</a></li></ul></dd>@@ -3634,7 +4001,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line68">line 68</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line122">line 122</a></li></ul></dd>@@ -3785,7 +4152,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line190">line 190</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line238">line 238</a></li></ul></dd>@@ -3940,7 +4307,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line196">line 196</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line244">line 244</a></li></ul></dd>@@ -4051,7 +4418,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line251">line 251</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line299">line 299</a></li></ul></dd>@@ -4135,7 +4502,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line35">line 35</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line90">line 90</a></li></ul></dd>diff --git a/docs/frontend_api/entities_note_full.js.html b/docs/frontend_api/entities_note_full.js.htmlindex ceca67bc9a..b66927b7bc 100644--- a/docs/frontend_api/entities_note_full.js.html+++ b/docs/frontend_api/entities_note_full.js.html@@ -32,8 +32,8 @@* Represents full note, specifically including note's content.*/class NoteFull extends NoteShort {- constructor(treeCache, row) {- super(treeCache, row);+ constructor(treeCache, row, noteShort) {+ super(treeCache, row, []);/** @param {string} */this.content = row.content;@@ -49,6 +49,12 @@ class NoteFull extends NoteShort {/** @param {string} */this.utcDateModified = row.utcDateModified;++ /* ugly */+ this.parents = noteShort.parents;+ this.parentToBranch = noteShort.parentToBranch;+ this.children = noteShort.children;+ this.childToBranch = noteShort.childToBranch;}}diff --git a/docs/frontend_api/entities_note_short.js.html b/docs/frontend_api/entities_note_short.js.htmlindex a61030a294..debf678558 100644--- a/docs/frontend_api/entities_note_short.js.html+++ b/docs/frontend_api/entities_note_short.js.html@@ -28,6 +28,7 @@<article><pre class="prettyprint source linenums"><code>import server from '../services/server.js';import Attribute from './attribute.js';+import branches from "../services/branches.js";const LABEL = 'label';const LABEL_DEFINITION = 'label-definition';@@ -41,7 +42,12 @@ const RELATION_DEFINITION = 'relation-definition';* This note's representation is used in note tree and is kept in TreeCache.*/class NoteShort {- constructor(treeCache, row) {+ /**+ * @param {TreeCache} treeCache+ * @param {Object.<string, Object>} row+ * @param {Branch[]} branches - all relevant branches, i.e. where this note is either child or parent+ */+ constructor(treeCache, row, branches) {this.treeCache = treeCache;/** @param {string} */this.noteId = row.noteId;@@ -57,6 +63,55 @@ class NoteShort {this.archived = row.archived;/** @param {string} */this.cssClass = row.cssClass;++ /** @type {string[]} */+ this.parents = [];+ /** @type {string[]} */+ this.children = [];++ /** @type {Object.<string, string>} */+ this.parentToBranch = {};++ /** @type {Object.<string, string>} */+ this.childToBranch = {};++ for (const branch of branches) {+ if (this.noteId === branch.noteId) {+ this.parents.push(branch.parentNoteId);+ this.parentToBranch[branch.parentNoteId] = branch.branchId;+ }+ else if (this.noteId === branch.parentNoteId) {+ this.children.push(branch.noteId);+ this.childToBranch[branch.noteId] = branch.branchId;+ }+ else {+ throw new Error(`Unknown branch ${branch.branchId} for note ${this.noteId}`);+ }+ }+ }++ addParent(parentNoteId, branchId) {+ if (!this.parents.includes(parentNoteId)) {+ this.parents.push(parentNoteId);+ }++ this.parentToBranch[parentNoteId] = branchId;+ }++ addChild(childNoteId, branchId) {+ if (!this.children.includes(childNoteId)) {+ this.children.push(childNoteId);+ }++ this.childToBranch[childNoteId] = branchId;++ const branchIdPos = {};++ for (const branchId of Object.values(this.childToBranch)) {+ branchIdPos[branchId] = this.treeCache.branches[branchId].notePosition;+ }++ this.children.sort((a, b) => branchIdPos[this.childToBranch[a]] < branchIdPos[this.childToBranch[b]] ? -1 : 1);}/** @returns {boolean} */@@ -86,48 +141,41 @@ class NoteShort {/** @returns {Promise<Branch[]>} */async getBranches() {- const branchIds = this.treeCache.parents[this.noteId].map(- parentNoteId => this.treeCache.getBranchIdByChildParent(this.noteId, parentNoteId));+ const branchIds = Object.values(this.parentToBranch);return this.treeCache.getBranches(branchIds);}/** @returns {boolean} */hasChildren() {- return this.treeCache.children[this.noteId]- && this.treeCache.children[this.noteId].length > 0;+ return this.children.length > 0;}/** @returns {Promise<Branch[]>} */async getChildBranches() {- if (!this.treeCache.children[this.noteId]) {- return [];- }+ const branchIds = Object.values(this.childToBranch);- const branchIds = this.treeCache.children[this.noteId].map(- childNoteId => this.treeCache.getBranchIdByChildParent(childNoteId, this.noteId));-- return await this.treeCache.getBranches(branchIds);+ return this.treeCache.getBranches(branchIds);}/** @returns {string[]} */getParentNoteIds() {- return this.treeCache.parents[this.noteId] || [];+ return this.parents;}/** @returns {Promise<NoteShort[]>} */async getParentNotes() {- return await this.treeCache.getNotes(this.getParentNoteIds());+ return await this.treeCache.getNotes(this.parents);}/** @returns {string[]} */getChildNoteIds() {- return this.treeCache.children[this.noteId] || [];+ return this.children;}/** @returns {Promise<NoteShort[]>} */async getChildNotes() {- return await this.treeCache.getNotes(this.getChildNoteIds());+ return await this.treeCache.getNotes(this.children);}/**diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.htmlindex 9d0d2c6004..8f42be7653 100644--- a/docs/frontend_api/services_frontend_script_api.js.html+++ b/docs/frontend_api/services_frontend_script_api.js.html@@ -240,16 +240,10 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabContethis.getNotes = async (noteIds, silentNotFoundError = false) => await treeCache.getNotes(noteIds, silentNotFoundError);/**- * @param {string} noteId- * @method- */- this.reloadNotesAndTheirChildren = async noteId => await treeCache.reloadNotesAndTheirChildren(noteId);-- /**- * @param {string} noteId+ * @param {string[]} noteIds* @method*/- this.reloadParents = async noteId => await treeCache.reloadParents(noteId);+ this.reloadNotes = async noteIds => await treeCache.reloadNotes(noteIds);/*** Instance name identifies particular Trilium instance. It can be useful for scriptsdiff --git a/src/public/javascripts/services/frontend_script_api.js b/src/public/javascripts/services/frontend_script_api.jsindex 252e3837f8..a71955c244 100644--- a/src/public/javascripts/services/frontend_script_api.js+++ b/src/public/javascripts/services/frontend_script_api.js@@ -212,10 +212,12 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabContethis.getNotes = async (noteIds, silentNotFoundError = false) => await treeCache.getNotes(noteIds, silentNotFoundError);/**- * @param {string} noteId+ * Update frontend tree (note) cache from the backend.+ *+ * @param {string[]} noteIds* @method*/- this.reloadNotes = async noteId => await treeCache.reloadNotes(noteId);+ this.reloadNotes = async noteIds => await treeCache.reloadNotes(noteIds);/*** Instance name identifies particular Trilium instance. It can be useful for scriptsdiff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.jsindex c6ce1ec675..202d248f6b 100644--- a/src/public/javascripts/services/tree.js+++ b/src/public/javascripts/services/tree.js@@ -832,8 +832,6 @@ async function reloadNotes(noteIds) {return;}- console.debug("Reloading notes", noteIds);-await treeCache.reloadNotes(noteIds);const activeNotePath = noteDetailService.getActiveTabNotePath();