Skip to content

Build your personal knowledge base with Trilium Notes

display mirror relations correctly on relation map

azivner0b85f87cb2ab
diff --git a/docs/backend_api/ApiToken.html b/docs/backend_api/ApiToken.html
index 0860ebfdb8..a0c9867ef6 100644
--- a/docs/backend_api/ApiToken.html
+++ b/docs/backend_api/ApiToken.html
@@ -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>
diff --git a/docs/backend_api/Attribute.html b/docs/backend_api/Attribute.html
index 3d2aadf8aa..841556a23d 100644
--- a/docs/backend_api/Attribute.html
+++ b/docs/backend_api/Attribute.html
@@ -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>
diff --git a/docs/backend_api/BackendScriptApi.html b/docs/backend_api/BackendScriptApi.html
index 5659ad3ad7..fd7cc35f38 100644
--- a/docs/backend_api/BackendScriptApi.html
+++ b/docs/backend_api/BackendScriptApi.html
@@ -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>
diff --git a/docs/backend_api/Branch.html b/docs/backend_api/Branch.html
index e4b2598642..0fb9512b4b 100644
--- a/docs/backend_api/Branch.html
+++ b/docs/backend_api/Branch.html
@@ -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>
diff --git a/docs/backend_api/Entity.html b/docs/backend_api/Entity.html
index 9888804b64..5738a6d65f 100644
--- a/docs/backend_api/Entity.html
+++ b/docs/backend_api/Entity.html
@@ -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>
diff --git a/docs/backend_api/Link.html b/docs/backend_api/Link.html
index 7ba997e975..2247f9bfea 100644
--- a/docs/backend_api/Link.html
+++ b/docs/backend_api/Link.html
@@ -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>
diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.html
index e3dbcb7958..04446ec7e1 100644
--- a/docs/backend_api/Note.html
+++ b/docs/backend_api/Note.html
@@ -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>
diff --git a/docs/backend_api/NoteRevision.html b/docs/backend_api/NoteRevision.html
index 4a49565fa5..87fdf35ae2 100644
--- a/docs/backend_api/NoteRevision.html
+++ b/docs/backend_api/NoteRevision.html
@@ -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>
diff --git a/docs/backend_api/Option.html b/docs/backend_api/Option.html
index fd10300fd4..155eb46dc4 100644
--- a/docs/backend_api/Option.html
+++ b/docs/backend_api/Option.html
@@ -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>
diff --git a/docs/backend_api/RecentNote.html b/docs/backend_api/RecentNote.html
index f5b3e375b8..fa9e3e9d75 100644
--- a/docs/backend_api/RecentNote.html
+++ b/docs/backend_api/RecentNote.html
@@ -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>
diff --git a/docs/backend_api/entities_api_token.js.html b/docs/backend_api/entities_api_token.js.html
index ba4bef39be..a123fcaccd 100644
--- a/docs/backend_api/entities_api_token.js.html
+++ b/docs/backend_api/entities_api_token.js.html
@@ -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>
diff --git a/docs/backend_api/entities_attribute.js.html b/docs/backend_api/entities_attribute.js.html
index 466968b155..10ed9ffbfb 100644
--- a/docs/backend_api/entities_attribute.js.html
+++ b/docs/backend_api/entities_attribute.js.html
@@ -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>
diff --git a/docs/backend_api/entities_branch.js.html b/docs/backend_api/entities_branch.js.html
index 432f2ef646..da5323629c 100644
--- a/docs/backend_api/entities_branch.js.html
+++ b/docs/backend_api/entities_branch.js.html
@@ -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>
diff --git a/docs/backend_api/entities_entity.js.html b/docs/backend_api/entities_entity.js.html
index ac9df1cc0d..e02c82614c 100644
--- a/docs/backend_api/entities_entity.js.html
+++ b/docs/backend_api/entities_entity.js.html
@@ -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>
diff --git a/docs/backend_api/entities_link.js.html b/docs/backend_api/entities_link.js.html
index 82a6c7804e..2912ef6665 100644
--- a/docs/backend_api/entities_link.js.html
+++ b/docs/backend_api/entities_link.js.html
@@ -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>
diff --git a/docs/backend_api/entities_note.js.html b/docs/backend_api/entities_note.js.html
index f35313b7a0..dedb6c6f9b 100644
--- a/docs/backend_api/entities_note.js.html
+++ b/docs/backend_api/entities_note.js.html
@@ -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>
diff --git a/docs/backend_api/entities_note_revision.js.html b/docs/backend_api/entities_note_revision.js.html
index 8423fa335e..6b9c5de297 100644
--- a/docs/backend_api/entities_note_revision.js.html
+++ b/docs/backend_api/entities_note_revision.js.html
@@ -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>
diff --git a/docs/backend_api/entities_option.js.html b/docs/backend_api/entities_option.js.html
index e0d78488a2..06d3c5f022 100644
--- a/docs/backend_api/entities_option.js.html
+++ b/docs/backend_api/entities_option.js.html
@@ -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>
diff --git a/docs/backend_api/entities_recent_note.js.html b/docs/backend_api/entities_recent_note.js.html
index ca0c1cab00..289d64f84d 100644
--- a/docs/backend_api/entities_recent_note.js.html
+++ b/docs/backend_api/entities_recent_note.js.html
@@ -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>
diff --git a/docs/backend_api/global.html b/docs/backend_api/global.html
index fa45b532d8..00a68a5635 100644
--- a/docs/backend_api/global.html
+++ b/docs/backend_api/global.html
@@ -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>
diff --git a/docs/backend_api/index.html b/docs/backend_api/index.html
index d9146110d9..8197f413b0 100644
--- a/docs/backend_api/index.html
+++ b/docs/backend_api/index.html
@@ -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>
diff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.html
index 8857d54390..c9ac8a9d31 100644
--- a/docs/backend_api/services_backend_script_api.js.html
+++ b/docs/backend_api/services_backend_script_api.js.html
@@ -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>
diff --git a/docs/frontend_api/Branch.html b/docs/frontend_api/Branch.html
index 9cb26a0ded..8f2470bf98 100644
--- a/docs/frontend_api/Branch.html
+++ b/docs/frontend_api/Branch.html
@@ -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>
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html
index c259cbc3d3..d198bb54d4 100644
--- a/docs/frontend_api/FrontendScriptApi.html
+++ b/docs/frontend_api/FrontendScriptApi.html
@@ -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>
diff --git a/docs/frontend_api/NoteFull.html b/docs/frontend_api/NoteFull.html
index 5a626119d4..7a49c7a15a 100644
--- a/docs/frontend_api/NoteFull.html
+++ b/docs/frontend_api/NoteFull.html
@@ -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>
diff --git a/docs/frontend_api/NoteShort.html b/docs/frontend_api/NoteShort.html
index a1fe24219d..df0266233c 100644
--- a/docs/frontend_api/NoteShort.html
+++ b/docs/frontend_api/NoteShort.html
@@ -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>
diff --git a/docs/frontend_api/entities_branch.js.html b/docs/frontend_api/entities_branch.js.html
index 636a5b3744..c9d5338a98 100644
--- a/docs/frontend_api/entities_branch.js.html
+++ b/docs/frontend_api/entities_branch.js.html
@@ -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>
diff --git a/docs/frontend_api/entities_note_full.js.html b/docs/frontend_api/entities_note_full.js.html
index 045ef4aeef..93312d6c0d 100644
--- a/docs/frontend_api/entities_note_full.js.html
+++ b/docs/frontend_api/entities_note_full.js.html
@@ -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>
diff --git a/docs/frontend_api/entities_note_short.js.html b/docs/frontend_api/entities_note_short.js.html
index 14ea8a0efe..9b56f110ea 100644
--- a/docs/frontend_api/entities_note_short.js.html
+++ b/docs/frontend_api/entities_note_short.js.html
@@ -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>
diff --git a/docs/frontend_api/global.html b/docs/frontend_api/global.html
index cb112cfce1..901fbe5153 100644
--- a/docs/frontend_api/global.html
+++ b/docs/frontend_api/global.html
@@ -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>
diff --git a/docs/frontend_api/index.html b/docs/frontend_api/index.html
index 21ecb0409b..9ba1bcdba5 100644
--- a/docs/frontend_api/index.html
+++ b/docs/frontend_api/index.html
@@ -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>
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html
index b13f21bba2..5c5517160a 100644
--- a/docs/frontend_api/services_frontend_script_api.js.html
+++ b/docs/frontend_api/services_frontend_script_api.js.html
@@ -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>
diff --git a/src/entities/note.js b/src/entities/note.js
index 4875242a7c..efeade0022 100644
--- a/src/entities/note.js
+++ b/src/entities/note.js
@@ -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.
diff --git a/src/public/javascripts/services/attribute_autocomplete.js b/src/public/javascripts/services/attribute_autocomplete.js
index c7d7aa5eb3..804ba79e3b 100644
--- a/src/public/javascripts/services/attribute_autocomplete.js
+++ b/src/public/javascripts/services/attribute_autocomplete.js
@@ -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);
diff --git a/src/public/javascripts/services/note_detail_relation_map.js b/src/public/javascripts/services/note_detail_relation_map.js
index 76a506d986..d7bade9ad8 100644
--- a/src/public/javascripts/services/note_detail_relation_map.js
+++ b/src/public/javascripts/services/note_detail_relation_map.js
@@ -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;
- connection.getOverlay("label").setLabel(relation.name);
+
+ 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;
diff --git a/src/routes/api/notes.js b/src/routes/api/notes.js
index 91551b50be..6c3560d0fb 100644
--- a/src/routes/api/notes.js
+++ b/src/routes/api/notes.js
@@ -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);
-
- // 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))
- .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));
+ const notes = await repository.getEntities(`SELECT * FROM notes WHERE isDeleted = 0 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
+ }; }));
+
+ for (const relationDefinition of await note.getRelationDefinitions()) {
+ if (relationDefinition.value.mirrorRelation) {
+ resp.mirrorRelations[relationDefinition.name] = relationDefinition.value.mirrorRelation;
+ }
+ }
+ }
return resp;
}