This commit is contained in:
zadam
2023-07-15 12:07:45 +02:00
parent 9d24499fef
commit 48f03f7a1b
18 changed files with 377 additions and 197 deletions

View File

@@ -490,7 +490,7 @@ and relation (representing named relationship between source and target note)</d
<h4 class="name" id="position"><span class="type-signature"></span>position<span class="type-signature"> :integer</span></h4>
<h4 class="name" id="position"><span class="type-signature"></span>position<span class="type-signature"> :int</span></h4>
@@ -501,7 +501,7 @@ and relation (representing named relationship between source and target note)</d
<ul>
<li>
<span class="param-type">integer</span>
<span class="param-type">int</span>
</li>

View File

@@ -549,7 +549,7 @@ of deletion should not act as a clone.
<h4 class="name" id="notePosition"><span class="type-signature"></span>notePosition<span class="type-signature"> :integer</span></h4>
<h4 class="name" id="notePosition"><span class="type-signature"></span>notePosition<span class="type-signature"> :int</span></h4>
@@ -560,7 +560,7 @@ of deletion should not act as a clone.
<ul>
<li>
<span class="param-type">integer</span>
<span class="param-type">int</span>
</li>

View File

@@ -30,7 +30,7 @@
<h2><span class="attribs"><span class="type-signature"></span></span>BNote<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">Trilium's main entity which can represent text note, image, code note, file attachment etc.</div>
<div class="class-description">Trilium's main entity, which can represent text note, image, code note, file attachment etc.</div>
</header>
@@ -1588,7 +1588,7 @@ See addLabel, addRelation for more specific methods.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1302">line 1302</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1303">line 1303</a>
</li></ul></dd>
@@ -1924,7 +1924,7 @@ See addLabel, addRelation for more specific methods.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1323">line 1323</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1324">line 1324</a>
</li></ul></dd>
@@ -2170,7 +2170,7 @@ returned.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1336">line 1336</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1337">line 1337</a>
</li></ul></dd>
@@ -2405,7 +2405,7 @@ returned.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1421">line 1421</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1422">line 1422</a>
</li></ul></dd>
@@ -2472,12 +2472,12 @@ returned.
- it has a relation from its parent note
- it has no children
- it has no clones
- parent is of type text
- the parent is of type text
- both notes are either unprotected or user is in protected session
Currently, works only for image notes.
In future this functionality might get more generic and some of the requirements relaxed.
In the future, this functionality might get more generic and some of the requirements relaxed.
</div>
@@ -2521,7 +2521,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1471">line 1471</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1474">line 1474</a>
</li></ul></dd>
@@ -2742,7 +2742,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1506">line 1506</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1512">line 1512</a>
</li></ul></dd>
@@ -3008,7 +3008,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1143">line 1143</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1144">line 1144</a>
</li></ul></dd>
@@ -3114,7 +3114,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1031">line 1031</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1032">line 1032</a>
</li></ul></dd>
@@ -3216,7 +3216,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1005">line 1005</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1006">line 1006</a>
</li></ul></dd>
@@ -3318,7 +3318,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1112">line 1112</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1113">line 1113</a>
</li></ul></dd>
@@ -3423,7 +3423,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1127">line 1127</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1128">line 1128</a>
</li></ul></dd>
@@ -3525,7 +3525,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1094">line 1094</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1095">line 1095</a>
</li></ul></dd>
@@ -3699,7 +3699,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line571">line 571</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line572">line 572</a>
</li></ul></dd>
@@ -3728,7 +3728,8 @@ In future this functionality might get more generic and some of the requirements
<div class="param-desc">
attribute of given type and name. If there's more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
attribute of the given type and name. If there are more such attributes, first is returned.
Returns null if there's no such attribute belonging to this note.
</div>
@@ -3877,7 +3878,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line582">line 582</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line583">line 583</a>
</li></ul></dd>
@@ -4146,7 +4147,7 @@ In future this functionality might get more generic and some of the requirements
<div class="description">
Returns note path considered to be the "best"
Returns a note path considered to be the "best"
</div>
@@ -4259,7 +4260,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1196">line 1196</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1197">line 1197</a>
</li></ul></dd>
@@ -4325,7 +4326,7 @@ In future this functionality might get more generic and some of the requirements
<div class="description">
Returns note path considered to be the "best"
Returns a note path considered to be the "best"
</div>
@@ -4438,7 +4439,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1206">line 1206</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1207">line 1207</a>
</li></ul></dd>
@@ -5061,7 +5062,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line952">line 952</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line953">line 953</a>
</li></ul></dd>
@@ -5151,7 +5152,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line753">line 753</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line754">line 754</a>
</li></ul></dd>
@@ -5257,7 +5258,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1057">line 1057</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1058">line 1058</a>
</li></ul></dd>
@@ -5843,7 +5844,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line611">line 611</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line612">line 612</a>
</li></ul></dd>
@@ -6010,7 +6011,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line603">line 603</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line604">line 604</a>
</li></ul></dd>
@@ -6116,7 +6117,7 @@ In future this functionality might get more generic and some of the requirements
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line678">line 678</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line679">line 679</a>
</li></ul></dd>
@@ -6296,7 +6297,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line593">line 593</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line594">line 594</a>
</li></ul></dd>
@@ -6561,7 +6562,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line653">line 653</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line654">line 654</a>
</li></ul></dd>
@@ -7044,7 +7045,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line627">line 627</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line628">line 628</a>
</li></ul></dd>
@@ -7211,7 +7212,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line619">line 619</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line620">line 620</a>
</li></ul></dd>
@@ -7694,7 +7695,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line643">line 643</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line644">line 644</a>
</li></ul></dd>
@@ -8470,7 +8471,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line635">line 635</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line636">line 636</a>
</li></ul></dd>
@@ -8576,7 +8577,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1088">line 1088</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1089">line 1089</a>
</li></ul></dd>
@@ -8787,7 +8788,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line863">line 863</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line864">line 864</a>
</li></ul></dd>
@@ -8958,7 +8959,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1165">line 1165</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1166">line 1166</a>
</li></ul></dd>
@@ -9166,7 +9167,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line886">line 886</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line887">line 887</a>
</li></ul></dd>
@@ -9268,7 +9269,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line945">line 945</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line946">line 946</a>
</li></ul></dd>
@@ -9374,7 +9375,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line831">line 831</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line832">line 832</a>
</li></ul></dd>
@@ -9476,7 +9477,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1051">line 1051</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1052">line 1052</a>
</li></ul></dd>
@@ -9667,7 +9668,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1036">line 1036</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1037">line 1037</a>
</li></ul></dd>
@@ -11268,7 +11269,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1237">line 1237</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1238">line 1238</a>
</li></ul></dd>
@@ -11374,7 +11375,7 @@ This method can be significantly faster than the getAttribute()
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1215">line 1215</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1216">line 1216</a>
</li></ul></dd>
@@ -12525,7 +12526,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1281">line 1281</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1282">line 1282</a>
</li></ul></dd>
@@ -12705,7 +12706,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1397">line 1397</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1398">line 1398</a>
</li></ul></dd>
@@ -12749,7 +12750,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<div class="description">
Remove relation name-value pair, if it exists.
Remove the relation name-value pair, if it exists.
</div>
@@ -12885,7 +12886,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1405">line 1405</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1406">line 1406</a>
</li></ul></dd>
@@ -13080,7 +13081,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1609">line 1609</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1619">line 1619</a>
</li></ul></dd>
@@ -13182,7 +13183,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1560">line 1560</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1566">line 1566</a>
</li></ul></dd>
@@ -13414,7 +13415,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1250">line 1250</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1251">line 1251</a>
</li></ul></dd>
@@ -13873,7 +13874,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1381">line 1381</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1382">line 1382</a>
</li></ul></dd>
@@ -14033,7 +14034,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1389">line 1389</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1390">line 1390</a>
</li></ul></dd>
@@ -14077,7 +14078,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<div class="description">
Based on enabled, attribute is either set or removed.
Based on enabled, the attribute is either set or removed.
</div>
@@ -14275,7 +14276,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1348">line 1348</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1349">line 1349</a>
</li></ul></dd>
@@ -14486,7 +14487,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1364">line 1364</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1365">line 1365</a>
</li></ul></dd>
@@ -14697,7 +14698,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1373">line 1373</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1374">line 1374</a>
</li></ul></dd>

View File

@@ -30,7 +30,7 @@
<h2><span class="attribs"><span class="type-signature"></span></span>BOption<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">Option represents name-value pair, either directly configurable by the user or some system property.</div>
<div class="class-description">Option represents a name-value pair, either directly configurable by the user or some system property.</div>
</header>

View File

@@ -423,7 +423,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.
<td class="description last">where script is currently executing. Don't mix this up with concept of active note</td>
<td class="description last">where the script is currently executing. Don't mix this up with the concept of active note</td>
</tr>
@@ -643,7 +643,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.
<td class="description last">whose event triggered this executions</td>
<td class="description last">whose event triggered this execution</td>
</tr>
@@ -863,7 +863,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.
<td class="description last">where script started executing</td>
<td class="description last">where the script started executing</td>
</tr>
@@ -1623,7 +1623,7 @@ JSON MIME type. See also createNewNote() for more options.
<td class="type">
<span class="param-type">integer</span>
<span class="param-type">int</span>
@@ -3360,7 +3360,7 @@ JSON MIME type. See also createNewNote() for more options.
<td class="description last">if branch will be created between note and parent note, set this prefix</td>
<td class="description last">if branch is created between note and parent note, set this prefix</td>
</tr>
@@ -6272,7 +6272,7 @@ if some action needs to happen on only one specific instance.
<td class="type">
<span class="param-type">integer</span>
<span class="param-type">int</span>
@@ -7463,7 +7463,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
<td class="description last">if branch will be created between note and parent note, set this prefix</td>
<td class="description last">if branch is created between note and parent note, set this prefix</td>
</tr>

View File

@@ -79,7 +79,7 @@ class BAttribute extends AbstractBeccaEntity {
this.type = type;
/** @type {string} */
this.name = name;
/** @type {integer} */
/** @type {int} */
this.position = position;
/** @type {string} */
this.value = value || "";

View File

@@ -83,7 +83,7 @@ class BBranch extends AbstractBeccaEntity {
this.parentNoteId = parentNoteId;
/** @type {string|null} */
this.prefix = prefix;
/** @type {integer} */
/** @type {int} */
this.notePosition = notePosition;
/** @type {boolean} */
this.isExpanded = !!isExpanded;

View File

@@ -46,7 +46,7 @@ const LABEL = 'label';
const RELATION = 'relation';
/**
* Trilium's main entity which can represent text note, image, code note, file attachment etc.
* Trilium's main entity, which can represent text note, image, code note, file attachment etc.
*
* @extends AbstractBeccaEntity
*/
@@ -151,7 +151,7 @@ class BNote extends AbstractBeccaEntity {
* @private */
this.__ancestorCache = null;
// following attributes are filled during searching from database
// following attributes are filled during searching in the database
/**
* size of the content in bytes
@@ -594,7 +594,8 @@ class BNote extends AbstractBeccaEntity {
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
* @returns {BAttribute} attribute of given type and name. If there's more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
* @returns {BAttribute} attribute of the given type and name. If there are more such attributes, first is returned.
* Returns null if there's no such attribute belonging to this note.
*/
getAttribute(type, name) {
const attributes = this.getAttributes();
@@ -694,7 +695,7 @@ class BNote extends AbstractBeccaEntity {
return this.ownedAttributes.filter(attr => attr.name === name);
}
else {
return this.ownedAttributes.slice();
return this.ownedAttributes;
}
}
@@ -716,7 +717,7 @@ class BNote extends AbstractBeccaEntity {
areAllNotePathsArchived() {
// there's a slight difference between note being itself archived and all its note paths being archived
// - note is archived when it itself has an archived label or inherits it
// - note does not have or inherit archived label, but each note paths contains a note with (non-inheritable)
// - note does not have or inherit archived label, but each note path contains a note with (non-inheritable)
// archived label
const bestNotePathRecord = this.getSortedNotePathRecords()[0];
@@ -1121,16 +1122,16 @@ class BNote extends AbstractBeccaEntity {
/** @returns {BAttachment[]} */
getAttachments(opts = {}) {
opts.includeContentLength = !!opts.includeContentLength;
// from testing it looks like calculating length does not make a difference in performance even on large-ish DB
// from testing, it looks like calculating length does not make a difference in performance even on large-ish DB
// given that we're always fetching attachments only for a specific note, we might just do it always
const query = opts.includeContentLength
? `SELECT attachments.*, LENGTH(blobs.content) AS contentLength
FROM attachments
JOIN blobs USING (blobId)
WHERE parentId = ? AND isDeleted = 0
WHERE ownerId = ? AND isDeleted = 0
ORDER BY position`
: `SELECT * FROM attachments WHERE parentId = ? AND isDeleted = 0 ORDER BY position`;
: `SELECT * FROM attachments WHERE ownerId = ? AND isDeleted = 0 ORDER BY position`;
return sql.getRows(query, [this.noteId])
.map(row => new BAttachment(row));
@@ -1144,8 +1145,8 @@ class BNote extends AbstractBeccaEntity {
? `SELECT attachments.*, LENGTH(blobs.content) AS contentLength
FROM attachments
JOIN blobs USING (blobId)
WHERE parentId = ? AND attachmentId = ? AND isDeleted = 0`
: `SELECT * FROM attachments WHERE parentId = ? AND attachmentId = ? AND isDeleted = 0`;
WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0`
: `SELECT * FROM attachments WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0`;
return sql.getRows(query, [this.noteId, attachmentId])
.map(row => new BAttachment(row))[0];
@@ -1156,7 +1157,7 @@ class BNote extends AbstractBeccaEntity {
return sql.getRows(`
SELECT attachments.*
FROM attachments
WHERE parentId = ?
WHERE ownerId = ?
AND role = ?
AND isDeleted = 0
ORDER BY position`, [this.noteId, role])
@@ -1176,7 +1177,7 @@ class BNote extends AbstractBeccaEntity {
const parentNotes = this.getParentNotes();
const notePaths = parentNotes.length === 1
? parentNotes[0].getAllNotePaths() // optimization for most common case
? parentNotes[0].getAllNotePaths() // optimization for the most common case
: parentNotes.flatMap(parentNote => parentNote.getAllNotePaths());
for (const notePath of notePaths) {
@@ -1216,7 +1217,7 @@ class BNote extends AbstractBeccaEntity {
}
/**
* Returns note path considered to be the "best"
* Returns a note path considered to be the "best"
*
* @param {string} [hoistedNoteId='root']
* @return {string[]} array of noteIds constituting the particular note path
@@ -1226,7 +1227,7 @@ class BNote extends AbstractBeccaEntity {
}
/**
* Returns note path considered to be the "best"
* Returns a note path considered to be the "best"
*
* @param {string} [hoistedNoteId='root']
* @return {string} serialized note path (e.g. 'root/a1h315/js725h')
@@ -1366,7 +1367,7 @@ class BNote extends AbstractBeccaEntity {
}
/**
* Based on enabled, attribute is either set or removed.
* Based on enabled, the attribute is either set or removed.
*
* @param {string} type - attribute type ('relation', 'label' etc.)
* @param {boolean} enabled - toggle On or Off
@@ -1425,7 +1426,7 @@ class BNote extends AbstractBeccaEntity {
removeLabel(name, value) { return this.removeAttribute(LABEL, name, value); }
/**
* Remove relation name-value pair, if it exists.
* Remove the relation name-value pair, if it exists.
*
* @param {string} name - relation name
* @param {string} [value] - relation value (noteId)
@@ -1454,14 +1455,16 @@ class BNote extends AbstractBeccaEntity {
return cloningService.cloneNoteToBranch(this.noteId, branch.branchId);
}
isEligibleForConversionToAttachment() {
isEligibleForConversionToAttachment(opts = {autoConversion: false}) {
if (this.type !== 'image' || !this.isContentAvailable() || this.hasChildren() || this.getParentBranches().length !== 1) {
return false;
}
const targetRelations = this.getTargetRelations().filter(relation => relation.name === 'imageLink');
if (targetRelations.length > 1) {
if (opts.autoConversion &amp;&amp; targetRelations.length === 0) {
return false;
} else if (targetRelations.length > 1) {
return false;
}
@@ -1483,21 +1486,21 @@ class BNote extends AbstractBeccaEntity {
* - it has a relation from its parent note
* - it has no children
* - it has no clones
* - parent is of type text
* - the parent is of type text
* - both notes are either unprotected or user is in protected session
*
* Currently, works only for image notes.
*
* In future this functionality might get more generic and some of the requirements relaxed.
* In the future, this functionality might get more generic and some of the requirements relaxed.
*
* @params {Object} [opts]
* @params {bolean} [opts.force=false} it is envisioned that user can force the conversion even if some conditions
* are not satisfied (e.g. relation to parent doesn't exist).
* @params {bolean} [opts.autoConversion=false} if true, the action is not triggered by user, but e.g. by migration,
* and only perfect candidates will be migrated
*
* @returns {BAttachment|null} - null if note is not eligible for conversion
*/
convertToParentAttachment(opts = {force: false}) {
if (!this.isEligibleForConversionToAttachment()) {
convertToParentAttachment(opts = {autoConversion: false}) {
if (!this.isEligibleForConversionToAttachment(opts)) {
return null;
}
@@ -1520,6 +1523,9 @@ class BNote extends AbstractBeccaEntity {
parentNote.setContent(fixedContent);
const noteService = require("../../services/notes");
noteService.asyncPostProcessContent(parentNote, fixedContent); // to mark an unused attachment for deletion
this.deleteNote();
return attachment;
@@ -1577,7 +1583,7 @@ class BNote extends AbstractBeccaEntity {
}
get isDeleted() {
// isBeingDeleted is relevant only in the transition period when the deletion process have begun, but not yet
// isBeingDeleted is relevant only in the transition period when the deletion process has begun, but not yet
// finished (note is still in becca)
return !(this.noteId in this.becca.notes) || this.isBeingDeleted;
}
@@ -1617,11 +1623,15 @@ class BNote extends AbstractBeccaEntity {
}
const revisionAttachment = noteAttachment.copy();
revisionAttachment.parentId = revision.revisionId;
revisionAttachment.ownerId = revision.revisionId;
revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true});
// content is rewritten to point to the revision attachments
noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`, `attachments/${revisionAttachment.attachmentId}`);
noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`,
`attachments/${revisionAttachment.attachmentId}`);
noteContent = noteContent.replaceAll(new RegExp(`href="[^"]*attachmentId=${noteAttachment.attachmentId}[^"]*"`, 'gi'),
`href="api/attachments/${revisionAttachment.attachmentId}/download"`);
}
revision.setContent(noteContent, {forceSave: true});
@@ -1641,7 +1651,7 @@ class BNote extends AbstractBeccaEntity {
attachment = this.becca.getAttachmentOrThrow(attachmentId);
} else {
attachment = new BAttachment({
parentId: this.noteId,
ownerId: this.noteId,
title,
role,
mime,

View File

@@ -32,7 +32,7 @@ const dateUtils = require('../../services/date_utils');
const AbstractBeccaEntity = require("./abstract_becca_entity");
/**
* Option represents name-value pair, either directly configurable by the user or some system property.
* Option represents a name-value pair, either directly configurable by the user or some system property.
*
* @extends AbstractBeccaEntity
*/

View File

@@ -55,11 +55,11 @@ const exportService = require("./export/zip");
* @constructor
*/
function BackendScriptApi(currentNote, apiParams) {
/** @property {BNote} note where script started executing */
/** @property {BNote} note where the script started executing */
this.startNote = apiParams.startNote;
/** @property {BNote} note where script is currently executing. Don't mix this up with concept of active note */
/** @property {BNote} note where the script is currently executing. Don't mix this up with the concept of active note */
this.currentNote = currentNote;
/** @property {AbstractBeccaEntity} entity whose event triggered this executions */
/** @property {AbstractBeccaEntity} entity whose event triggered this execution */
this.originEntity = apiParams.originEntity;
for (const key in apiParams) {
@@ -170,7 +170,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @method
* @param {string} noteId
* @param {string} parentNoteId
* @param {string} prefix - if branch will be created between note and parent note, set this prefix
* @param {string} prefix - if branch is created between note and parent note, set this prefix
* @returns {{branch: BBranch|null}}
*/
this.ensureNoteIsPresentInParent = cloningService.ensureNoteIsPresentInParent;
@@ -192,7 +192,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @param {boolean} present - true if we want the branch to exist, false if we want it gone
* @param {string} noteId
* @param {string} parentNoteId
* @param {string} prefix - if branch will be created between note and parent note, set this prefix
* @param {string} prefix - if branch is created between note and parent note, set this prefix
* @returns {void}
*/
this.toggleNoteInParent = cloningService.toggleNoteInParent;
@@ -243,7 +243,7 @@ function BackendScriptApi(currentNote, apiParams) {
* @property {boolean} [params.isProtected=false]
* @property {boolean} [params.isExpanded=false]
* @property {string} [params.prefix='']
* @property {integer} [params.notePosition] - default is last existing notePosition in a parent + 10
* @property {int} [params.notePosition] - default is last existing notePosition in a parent + 10
* @returns {{note: BNote, branch: BBranch}} object contains newly created entities note and branch
*/
this.createNewNote = noteService.createNewNote;
@@ -272,7 +272,7 @@ function BackendScriptApi(currentNote, apiParams) {
const parentNote = becca.getNote(parentNoteId);
// code note type can be inherited, otherwise text is default
// code note type can be inherited, otherwise "text" is the default
extraOptions.type = parentNote.type === 'code' ? 'code' : 'text';
extraOptions.mime = parentNote.type === 'code' ? parentNote.mime : 'text/html';
@@ -440,7 +440,7 @@ function BackendScriptApi(currentNote, apiParams) {
* Return randomly generated string of given length. This random string generation is NOT cryptographically secure.
*
* @method
* @param {integer} length of the string
* @param {int} length of the string
* @returns {string} random string
*/
this.randomString = utils.randomString;