display mirror relations correctly on relation map

This commit is contained in:
azivner 2018-11-13 12:50:08 +01:00
parent 144e814b02
commit 0b85f87cb2
36 changed files with 843 additions and 115 deletions

View File

@ -288,7 +288,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -406,6 +406,310 @@
<h3 class="subsection-title">Methods</h3>
<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>
<dl class="details">
<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#line46">line 46</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
</dd>
</dl>
<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>
<dl class="details">
<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#line57">line 57</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;(<a href="Note.html">Note</a>|null)></span>
</dd>
</dl>
<h4 class="name" id="isDefinition"><span class="type-signature"></span>isDefinition<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<dl class="details">
<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#line76">line 76</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
@ -426,7 +730,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -3814,7 +3814,7 @@ transactional by default.
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -511,7 +511,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/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -216,7 +216,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -358,7 +358,7 @@ this is different concept than attribute/relation.</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -373,7 +373,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line27">line 27</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line29">line 29</a>
</li></ul></dd>
@ -613,7 +613,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line425">line 425</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line443">line 443</a>
</li></ul></dd>
@ -809,7 +809,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line463">line 463</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line481">line 481</a>
</li></ul></dd>
@ -1005,7 +1005,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line472">line 472</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line490">line 490</a>
</li></ul></dd>
@ -1177,7 +1177,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line233">line 233</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line251">line 251</a>
</li></ul></dd>
@ -1342,7 +1342,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line118">line 118</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line120">line 120</a>
</li></ul></dd>
@ -1518,7 +1518,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line244">line 244</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line262">line 262</a>
</li></ul></dd>
@ -1622,7 +1622,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line502">line 502</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line520">line 520</a>
</li></ul></dd>
@ -1722,7 +1722,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line530">line 530</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line548">line 548</a>
</li></ul></dd>
@ -1826,7 +1826,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line516">line 516</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line534">line 534</a>
</li></ul></dd>
@ -1979,7 +1979,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line331">line 331</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line349">line 349</a>
</li></ul></dd>
@ -2035,6 +2035,171 @@
<h4 class="name" id="getLabelDefinitions"><span class="type-signature">(async) </span>getLabelDefinitions<span class="signature">(name<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Array.&lt;<a href="Attribute.html">Attribute</a>>>}</span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">label name to filter</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line145">line 145</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
all note's label definitions, including inherited ones
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Array.&lt;<a href="Attribute.html">Attribute</a>>></span>
</dd>
</dl>
<h4 class="name" id="getLabels"><span class="type-signature">(async) </span>getLabels<span class="signature">(name<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Array.&lt;<a href="Attribute.html">Attribute</a>>>}</span></h4>
@ -2144,7 +2309,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line135">line 135</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line137">line 137</a>
</li></ul></dd>
@ -2297,7 +2462,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line343">line 343</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line361">line 361</a>
</li></ul></dd>
@ -2401,7 +2566,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line486">line 486</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line504">line 504</a>
</li></ul></dd>
@ -2505,7 +2670,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line495">line 495</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line513">line 513</a>
</li></ul></dd>
@ -2605,7 +2770,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line103">line 103</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line105">line 105</a>
</li></ul></dd>
@ -2709,7 +2874,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line542">line 542</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line560">line 560</a>
</li></ul></dd>
@ -2862,7 +3027,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line337">line 337</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line355">line 355</a>
</li></ul></dd>
@ -2918,6 +3083,171 @@
<h4 class="name" id="getRelationDefinitions"><span class="type-signature">(async) </span>getRelationDefinitions<span class="signature">(name<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Array.&lt;<a href="Attribute.html">Attribute</a>>>}</span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">relation name to filter</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line161">line 161</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
all note's relation definitions including inherited ones
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Array.&lt;<a href="Attribute.html">Attribute</a>>></span>
</dd>
</dl>
<h4 class="name" id="getRelations"><span class="type-signature">(async) </span>getRelations<span class="signature">(name<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Array.&lt;<a href="Attribute.html">Attribute</a>>>}</span></h4>
@ -3027,7 +3357,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line143">line 143</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line153">line 153</a>
</li></ul></dd>
@ -3180,7 +3510,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line411">line 411</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line429">line 429</a>
</li></ul></dd>
@ -3336,7 +3666,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line349">line 349</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line367">line 367</a>
</li></ul></dd>
@ -3444,7 +3774,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line479">line 479</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line497">line 497</a>
</li></ul></dd>
@ -3544,7 +3874,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line84">line 84</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line86">line 86</a>
</li></ul></dd>
@ -3648,7 +3978,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line110">line 110</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line112">line 112</a>
</li></ul></dd>
@ -3824,7 +4154,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line224">line 224</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line242">line 242</a>
</li></ul></dd>
@ -3928,7 +4258,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line509">line 509</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line527">line 527</a>
</li></ul></dd>
@ -4081,7 +4411,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line319">line 319</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line337">line 337</a>
</li></ul></dd>
@ -4234,7 +4564,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line325">line 325</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line343">line 343</a>
</li></ul></dd>
@ -4343,7 +4673,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line151">line 151</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line169">line 169</a>
</li></ul></dd>
@ -4425,7 +4755,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line79">line 79</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line81">line 81</a>
</li></ul></dd>
@ -4529,7 +4859,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line73">line 73</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line75">line 75</a>
</li></ul></dd>
@ -4633,7 +4963,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line68">line 68</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line70">line 70</a>
</li></ul></dd>
@ -4737,7 +5067,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line63">line 63</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line65">line 65</a>
</li></ul></dd>
@ -4841,7 +5171,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line156">line 156</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line174">line 174</a>
</li></ul></dd>
@ -5068,7 +5398,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line302">line 302</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line320">line 320</a>
</li></ul></dd>
@ -5264,7 +5594,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line396">line 396</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line414">line 414</a>
</li></ul></dd>
@ -5460,7 +5790,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line405">line 405</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line423">line 423</a>
</li></ul></dd>
@ -5687,7 +6017,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line276">line 276</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line294">line 294</a>
</li></ul></dd>
@ -5883,7 +6213,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line378">line 378</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line396">line 396</a>
</li></ul></dd>
@ -6079,7 +6409,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line387">line 387</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line405">line 405</a>
</li></ul></dd>
@ -6337,7 +6667,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line259">line 259</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line277">line 277</a>
</li></ul></dd>
@ -6564,7 +6894,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line359">line 359</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line377">line 377</a>
</li></ul></dd>
@ -6791,7 +7121,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line369">line 369</a>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line387">line 387</a>
</li></ul></dd>
@ -6859,7 +7189,7 @@ Cache is note instance scoped.
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -403,7 +403,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -311,7 +311,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -288,7 +288,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</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/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -68,10 +68,20 @@ class Attribute extends Entity {
}
}
/**
* @returns {Promise&lt;Note|null>}
*/
async getNote() {
return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
if (!this.__note) {
this.__note = await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
}
return this.__note;
}
/**
* @returns {Promise&lt;Note|null>}
*/
async getTargetNote() {
if (this.type !== 'relation') {
throw new Error(`Attribute ${this.attributeId} is not relation`);
@ -81,9 +91,16 @@ class Attribute extends Entity {
return null;
}
return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.value]);
if (!this.__targetNote) {
this.__targetNote = await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.value]);
}
return this.__targetNote;
}
/**
* @return {boolean}
*/
isDefinition() {
return this.type === 'label-definition' || this.type === 'relation-definition';
}
@ -134,7 +151,7 @@ module.exports = Attribute;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -105,7 +105,7 @@ module.exports = Branch;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -93,7 +93,7 @@ module.exports = Entity;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -92,7 +92,7 @@ module.exports = Link;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -35,7 +35,9 @@ const repository = require('../services/repository');
const dateUtils = require('../services/date_utils');
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.
@ -164,6 +166,14 @@ class Note extends Entity {
return (await this.getAttributes(name)).filter(attr => attr.type === LABEL);
}
/**
* @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(name)).filter(attr => attr.type === LABEL_DEFINITION);
}
/**
* @param {string} [name] - relation name to filter
* @returns {Promise&lt;Attribute[]>} all note's relations (attributes with type relation), including inherited ones
@ -172,6 +182,14 @@ class Note extends Entity {
return (await this.getAttributes(name)).filter(attr => attr.type === RELATION);
}
/**
* @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(name)).filter(attr => attr.type === RELATION_DEFINITION);
}
/**
* Clear note's attributes cache to force fresh reload for next attribute request.
* Cache is note instance scoped.
@ -622,7 +640,7 @@ module.exports = Note;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -91,7 +91,7 @@ module.exports = NoteRevision;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -78,7 +78,7 @@ module.exports = Option;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -75,7 +75,7 @@ module.exports = RecentNote;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -594,7 +594,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -56,7 +56,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -278,7 +278,7 @@ module.exports = BackendScriptApi;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:33 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:03 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -719,7 +719,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:34 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -1057,7 +1057,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#line195">line 195</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line197">line 197</a>
</li></ul></dd>
@ -1188,7 +1188,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#line155">line 155</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line157">line 157</a>
</li></ul></dd>
@ -1292,7 +1292,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#line219">line 219</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line221">line 221</a>
</li></ul></dd>
@ -1396,7 +1396,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#line201">line 201</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line203">line 203</a>
</li></ul></dd>
@ -1500,7 +1500,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#line213">line 213</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line215">line 215</a>
</li></ul></dd>
@ -1609,7 +1609,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#line148">line 148</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line150">line 150</a>
</li></ul></dd>
@ -1808,7 +1808,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#line140">line 140</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line142">line 142</a>
</li></ul></dd>
@ -1957,7 +1957,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#line207">line 207</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line209">line 209</a>
</li></ul></dd>
@ -2088,7 +2088,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#line162">line 162</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line164">line 164</a>
</li></ul></dd>
@ -2196,7 +2196,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#line186">line 186</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line188">line 188</a>
</li></ul></dd>
@ -2373,7 +2373,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#line108">line 108</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line110">line 110</a>
</li></ul></dd>
@ -2526,7 +2526,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#line225">line 225</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line227">line 227</a>
</li></ul></dd>
@ -2661,7 +2661,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#line180">line 180</a>
</li></ul></dd>
@ -2796,7 +2796,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#line170">line 170</a>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line172">line 172</a>
</li></ul></dd>
@ -2846,7 +2846,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:34 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -279,7 +279,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:34 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -1316,7 +1316,7 @@ Its notable omission is the note content.</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:34 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@ export default Branch;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:34 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -64,7 +64,7 @@ export default NoteFull;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:34 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -128,7 +128,7 @@ export default NoteShort;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:34 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -339,7 +339,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:34 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -56,7 +56,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:34 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -88,14 +88,16 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
this.addButtonToToolbar = opts => {
const buttonId = "toolbar-button-" + opts.title.replace(/[^a-zA-Z0-9]/g, "-");
const icon = $("&lt;span>")
.addClass("jam jam-" + opts.icon);
const button = $('&lt;button>')
.addClass("btn btn-sm")
.click(opts.action)
.append(icon)
.append($("&lt;span>").text(opts.title));
.click(opts.action);
if (opts.icon) {
button.append($("&lt;span>").addClass("jam jam-" + opts.icon))
.append("&amp;nbsp;");
}
button.append($("&lt;span>").text(opts.title));
button.attr('id', buttonId);
@ -269,7 +271,7 @@ export default FrontendScriptApi;</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 09 2018 14:44:34 GMT+0100 (Central European Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Nov 13 2018 12:12:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>

View File

@ -7,7 +7,9 @@ const repository = require('../services/repository');
const dateUtils = require('../services/date_utils');
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.
@ -136,6 +138,14 @@ class Note extends Entity {
return (await this.getAttributes(name)).filter(attr => attr.type === LABEL);
}
/**
* @param {string} [name] - label name to filter
* @returns {Promise<Attribute[]>} all note's label definitions, including inherited ones
*/
async getLabelDefinitions(name) {
return (await this.getAttributes(name)).filter(attr => attr.type === LABEL_DEFINITION);
}
/**
* @param {string} [name] - relation name to filter
* @returns {Promise<Attribute[]>} all note's relations (attributes with type relation), including inherited ones
@ -144,6 +154,14 @@ class Note extends Entity {
return (await this.getAttributes(name)).filter(attr => attr.type === RELATION);
}
/**
* @param {string} [name] - relation name to filter
* @returns {Promise<Attribute[]>} all note's relation definitions including inherited ones
*/
async getRelationDefinitions(name) {
return (await this.getAttributes(name)).filter(attr => attr.type === RELATION_DEFINITION);
}
/**
* Clear note's attributes cache to force fresh reload for next attribute request.
* Cache is note instance scoped.

View File

@ -24,7 +24,7 @@ function initAttributeNameAutocomplete({ $el, attributeType, open }) {
});
if (result.length === 0) {
result.push({name: "No results"})
result.push({name: "No results"});
}
cb(result);

View File

@ -48,6 +48,25 @@ const biDirectionalOverlays = [
} ]
];
const mirrorOverlays = [
[ "Arrow", {
location: 1,
id: "arrow",
length: 14,
foldback: 0.8
} ],
[ "Label", { label: "", location: 0.2, id: "label-source", cssClass: "connection-label" }],
[ "Label", { label: "", location: 0.8, id: "label-target", cssClass: "connection-label" }],
[ "Arrow", {
location: 0,
id: "arrow2",
length: 14,
direction: -1,
foldback: 0.8
} ]
];
function loadMapData() {
const currentNote = noteDetailService.getCurrentNote();
mapData = {
@ -88,12 +107,12 @@ async function loadNotesAndRelations() {
for (const relation of data.relations) {
const match = relations.find(rel =>
rel.name === relation.name
rel.name === data.mirrorRelations[relation.name]
&& ((rel.sourceNoteId === relation.sourceNoteId && rel.targetNoteId === relation.targetNoteId)
|| (rel.sourceNoteId === relation.targetNoteId && rel.targetNoteId === relation.sourceNoteId)));
if (match) {
match.type = relation.type = 'biDirectional';
match.type = relation.type = relation.name === data.mirrorRelations[relation.name] ? 'biDirectional' : 'mirror';
relation.render = false; // don't render second relation
} else {
relation.type = 'uniDirectional';
@ -128,7 +147,15 @@ async function loadNotesAndRelations() {
});
connection.id = relation.attributeId;
if (relation.type === 'mirror') {
connection.getOverlay("label-source").setLabel(relation.name);
connection.getOverlay("label-target").setLabel(data.mirrorRelations[relation.name]);
}
else {
connection.getOverlay("label").setLabel(relation.name);
}
connection.canvas.setAttribute("data-connection-id", connection.id);
}
});
@ -222,6 +249,8 @@ function initJsPlumbInstance () {
jsPlumbInstance.registerConnectionType("biDirectional", { anchor:"Continuous", connector:"StateMachine", overlays: biDirectionalOverlays });
jsPlumbInstance.registerConnectionType("mirror", { anchor:"Continuous", connector:"StateMachine", overlays: mirrorOverlays });
jsPlumbInstance.bind("connection", connectionCreatedHandler);
// so that canvas is not panned when clicking/dragging note box
@ -330,7 +359,7 @@ async function noteContextMenuHandler(event, cmd) {
}
else if (cmd === "edit-title") {
const $title = $noteBox.find(".title a");
const title = await promptDialog.ask("Enter new note title:", $title.text());
const title = await promptDialog.ask({ message: "Enter new note title:", defaultValue: $title.text() });
if (!title) {
return;

View File

@ -95,8 +95,11 @@ async function setNoteTypeMime(req) {
async function getRelationMap(req) {
const noteIds = req.body.noteIds;
const resp = {
// noteId => title
noteTitles: {},
relations: []
relations: [],
// relation name => mirror relation name
mirrorRelations: {}
};
if (noteIds.length === 0) {
@ -105,19 +108,26 @@ async function getRelationMap(req) {
const questionMarks = noteIds.map(noteId => '?').join(',');
(await repository.getEntities(`SELECT * FROM notes WHERE isDeleted = 0 AND noteId IN (${questionMarks})`, noteIds))
.forEach(note => resp.noteTitles[note.noteId] = note.title);
const notes = await repository.getEntities(`SELECT * FROM notes WHERE isDeleted = 0 AND noteId IN (${questionMarks})`, noteIds);
// FIXME: this actually doesn't take into account inherited relations! But maybe it is better this way?
resp.relations = (await repository.getEntities(`SELECT * FROM attributes WHERE isDeleted = 0 AND type = 'relation' AND noteId IN (${questionMarks})`, noteIds))
for (const note of notes) {
resp.noteTitles[note.noteId] = note.title;
resp.relations = resp.relations.concat((await note.getRelations())
.filter(relation => noteIds.includes(relation.value))
.map(relation => { return {
attributeId: relation.attributeId,
sourceNoteId: relation.noteId,
targetNoteId: relation.value,
name: relation.name
}; })
// both sourceNoteId and targetNoteId has to be in the included notes, but source was already checked in the SQL query
.filter(relation => noteIds.includes(relation.targetNoteId));
}; }));
for (const relationDefinition of await note.getRelationDefinitions()) {
if (relationDefinition.value.mirrorRelation) {
resp.mirrorRelations[relationDefinition.name] = relationDefinition.value.mirrorRelation;
}
}
}
return resp;
}