Skip to content

Build your personal knowledge base with Trilium Notes

expose ability to create note revisions in backend API #2890

zadam3cfca27b5423
diff --git a/docs/backend_api/BackendScriptApi.html b/docs/backend_api/BackendScriptApi.html
index d99d0c2196..8e1204851f 100644
--- a/docs/backend_api/BackendScriptApi.html
+++ b/docs/backend_api/BackendScriptApi.html
@@ -131,6 +131,78 @@
+<h4 class="name" id="__private"><span class="type-signature"></span>__private<span class="type-signature"> :Object</span></h4>
+
+
+
+
+<div class="description">
+ This object contains "at your risk" and "no BC guarantees" objects for advanced use cases.
+</div>
+
+
+
+ <h5>Type:</h5>
+ <ul>
+ <li>
+
+<span class="param-type">Object</span>
+
+
+ </li>
+ </ul>
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line435">line 435</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
<h4 class="name" id="axios"><span class="type-signature"></span>axios<span class="type-signature"></span></h4>
diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.html
index c5eea4f2f0..2afe54588c 100644
--- a/docs/backend_api/Note.html
+++ b/docs/backend_api/Note.html
@@ -93,7 +93,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line21">line 21</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line23">line 23</a>
</li></ul></dd>
@@ -204,7 +204,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line92">line 92</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line94">line 94</a>
</li></ul></dd>
@@ -279,7 +279,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line118">line 118</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line120">line 120</a>
</li></ul></dd>
@@ -347,7 +347,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line65">line 65</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line67">line 67</a>
</li></ul></dd>
@@ -415,7 +415,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line67">line 67</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line69">line 69</a>
</li></ul></dd>
@@ -486,7 +486,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line81">line 81</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line83">line 83</a>
</li></ul></dd>
@@ -554,7 +554,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line76">line 76</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line78">line 78</a>
</li></ul></dd>
@@ -622,7 +622,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line59">line 59</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line61">line 61</a>
</li></ul></dd>
@@ -690,7 +690,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line63">line 63</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line65">line 65</a>
</li></ul></dd>
@@ -758,7 +758,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line55">line 55</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line57">line 57</a>
</li></ul></dd>
@@ -833,7 +833,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line123">line 123</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line125">line 125</a>
</li></ul></dd>
@@ -901,7 +901,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line94">line 94</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line96">line 96</a>
</li></ul></dd>
@@ -969,7 +969,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line88">line 88</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line90">line 90</a>
</li></ul></dd>
@@ -1037,7 +1037,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line90">line 90</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line92">line 92</a>
</li></ul></dd>
@@ -1112,7 +1112,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line128">line 128</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line130">line 130</a>
</li></ul></dd>
@@ -1180,7 +1180,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line104">line 104</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line106">line 106</a>
</li></ul></dd>
@@ -1248,7 +1248,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line57">line 57</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line59">line 59</a>
</li></ul></dd>
@@ -1316,7 +1316,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line61">line 61</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line63">line 63</a>
</li></ul></dd>
@@ -1384,7 +1384,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line69">line 69</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line71">line 71</a>
</li></ul></dd>
@@ -1452,7 +1452,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line71">line 71</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line73">line 73</a>
</li></ul></dd>
@@ -1528,7 +1528,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line405">line 405</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line407">line 407</a>
</li></ul></dd>
@@ -1630,7 +1630,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1023">line 1023</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1025">line 1025</a>
</li></ul></dd>
@@ -1830,7 +1830,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1135">line 1135</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1137">line 1137</a>
</li></ul></dd>
@@ -1914,7 +1914,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line945">line 945</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line947">line 947</a>
</li></ul></dd>
@@ -2020,7 +2020,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line865">line 865</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line867">line 867</a>
</li></ul></dd>
@@ -2194,7 +2194,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line523">line 523</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line525">line 525</a>
</li></ul></dd>
@@ -2394,7 +2394,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line336">line 336</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line338">line 338</a>
</li></ul></dd>
@@ -2572,7 +2572,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line534">line 534</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line536">line 536</a>
</li></ul></dd>
@@ -2683,7 +2683,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line150">line 150</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line152">line 152</a>
</li></ul></dd>
@@ -2785,7 +2785,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line170">line 170</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line172">line 172</a>
</li></ul></dd>
@@ -2887,7 +2887,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line160">line 160</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line162">line 162</a>
</li></ul></dd>
@@ -2989,7 +2989,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line184">line 184</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line186">line 186</a>
</li></ul></dd>
@@ -3091,7 +3091,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line218">line 218</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line220">line 220</a>
</li></ul></dd>
@@ -3199,7 +3199,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line660">line 660</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line662">line 662</a>
</li></ul></dd>
@@ -3305,7 +3305,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line229">line 229</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line231">line 231</a>
</li></ul></dd>
@@ -3456,7 +3456,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line465">line 465</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line467">line 467</a>
</li></ul></dd>
@@ -3626,7 +3626,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line555">line 555</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line557">line 557</a>
</li></ul></dd>
@@ -3781,7 +3781,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line489">line 489</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line491">line 491</a>
</li></ul></dd>
@@ -3951,7 +3951,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line563">line 563</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line565">line 565</a>
</li></ul></dd>
@@ -4057,7 +4057,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line629">line 629</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line631">line 631</a>
</li></ul></dd>
@@ -4259,7 +4259,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line604">line 604</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line606">line 606</a>
</li></ul></dd>
@@ -4437,7 +4437,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line545">line 545</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line547">line 547</a>
</li></ul></dd>
@@ -4595,7 +4595,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line471">line 471</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line473">line 473</a>
</li></ul></dd>
@@ -4765,7 +4765,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line571">line 571</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line573">line 573</a>
</li></ul></dd>
@@ -4920,7 +4920,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line495">line 495</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line497">line 497</a>
</li></ul></dd>
@@ -5090,7 +5090,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line579">line 579</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line581">line 581</a>
</li></ul></dd>
@@ -5245,7 +5245,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line483">line 483</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line485">line 485</a>
</li></ul></dd>
@@ -5415,7 +5415,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line595">line 595</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line597">line 597</a>
</li></ul></dd>
@@ -5570,7 +5570,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line507">line 507</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line509">line 509</a>
</li></ul></dd>
@@ -5679,7 +5679,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line142">line 142</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line144">line 144</a>
</li></ul></dd>
@@ -5781,7 +5781,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line155">line 155</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line157">line 157</a>
</li></ul></dd>
@@ -5932,7 +5932,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line477">line 477</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line479">line 479</a>
</li></ul></dd>
@@ -6102,7 +6102,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line587">line 587</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line589">line 589</a>
</li></ul></dd>
@@ -6257,7 +6257,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line501">line 501</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line503">line 503</a>
</li></ul></dd>
@@ -6366,7 +6366,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line315">line 315</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line317">line 317</a>
</li></ul></dd>
@@ -6475,7 +6475,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line808">line 808</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line810">line 810</a>
</li></ul></dd>
@@ -6577,7 +6577,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line787">line 787</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line789">line 789</a>
</li></ul></dd>
@@ -6679,7 +6679,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line756">line 756</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line758">line 758</a>
</li></ul></dd>
@@ -6781,7 +6781,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line907">line 907</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line909">line 909</a>
</li></ul></dd>
@@ -6888,7 +6888,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line891">line 891</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line893">line 893</a>
</li></ul></dd>
@@ -6990,7 +6990,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line165">line 165</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line167">line 167</a>
</li></ul></dd>
@@ -7141,7 +7141,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line441">line 441</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line443">line 443</a>
</li></ul></dd>
@@ -7319,7 +7319,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line514">line 514</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line516">line 516</a>
</li></ul></dd>
@@ -7474,7 +7474,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line447">line 447</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line449">line 449</a>
</li></ul></dd>
@@ -7629,7 +7629,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line459">line 459</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line461">line 461</a>
</li></ul></dd>
@@ -7784,7 +7784,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line453">line 453</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line455">line 455</a>
</li></ul></dd>
@@ -7934,7 +7934,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line966">line 966</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line968">line 968</a>
</li></ul></dd>
@@ -8040,7 +8040,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line304">line 304</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line306">line 306</a>
</li></ul></dd>
@@ -8146,7 +8146,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line296">line 296</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line298">line 298</a>
</li></ul></dd>
@@ -8252,7 +8252,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line291">line 291</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line293">line 293</a>
</li></ul></dd>
@@ -8358,7 +8358,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line286">line 286</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line288">line 288</a>
</li></ul></dd>
@@ -8464,7 +8464,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line310">line 310</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line312">line 312</a>
</li></ul></dd>
@@ -8856,7 +8856,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1010">line 1010</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1012">line 1012</a>
</li></ul></dd>
@@ -9036,7 +9036,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1101">line 1101</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1103">line 1103</a>
</li></ul></dd>
@@ -9216,7 +9216,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1109">line 1109</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1111">line 1111</a>
</li></ul></dd>
@@ -9363,6 +9363,111 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
+ <h4 class="name" id="saveNoteRevision"><span class="type-signature"></span>saveNoteRevision<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="NoteRevision.html">NoteRevision</a>|null}</span></h4>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1172">line 1172</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type"><a href="NoteRevision.html">NoteRevision</a></span>
+|
+
+<span class="param-type">null</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
<h4 class="name" id="setAttribute"><span class="type-signature"></span>setAttribute<span class="signature">(type, name, value<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
@@ -9538,7 +9643,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line979">line 979</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line981">line 981</a>
</li></ul></dd>
@@ -9718,7 +9823,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1085">line 1085</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1087">line 1087</a>
</li></ul></dd>
@@ -9878,7 +9983,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1093">line 1093</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1095">line 1095</a>
</li></ul></dd>
@@ -10120,7 +10225,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1052">line 1052</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1054">line 1054</a>
</li></ul></dd>
@@ -10331,7 +10436,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1068">line 1068</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1070">line 1070</a>
</li></ul></dd>
@@ -10542,7 +10647,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_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1077">line 1077</a>
+ <a href="becca_entities_note.js.html">becca/entities/note.js</a>, <a href="becca_entities_note.js.html#line1079">line 1079</a>
</li></ul></dd>
diff --git a/docs/backend_api/becca_entities_note.js.html b/docs/backend_api/becca_entities_note.js.html
index 3af1da7106..57d0527e72 100644
--- a/docs/backend_api/becca_entities_note.js.html
+++ b/docs/backend_api/becca_entities_note.js.html
@@ -37,6 +37,8 @@ const entityChangesService = require('../../services/entity_changes');
const AbstractEntity = require("./abstract_entity");
const NoteRevision = require("./note_revision");
const TaskContext = require("../../services/task_context.js");
+const optionService = require("../../services/options.js");
+const noteRevisionService = require("../../services/note_revisions.js");
const LABEL = 'label';
const RELATION = 'relation';
@@ -1192,6 +1194,41 @@ class Note extends AbstractEntity {
return !(this.noteId in this.becca.notes);
}
+ /**
+ * @return {NoteRevision|null}
+ */
+ saveNoteRevision() {
+ const content = this.getContent();
+
+ if (!content || (Buffer.isBuffer(content) &amp;&amp; content.byteLength === 0)) {
+ return null;
+ }
+
+ const contentMetadata = this.getContentMetadata();
+
+ const noteRevision = new NoteRevision({
+ noteId: this.noteId,
+ // title and text should be decrypted now
+ title: this.title,
+ type: this.type,
+ mime: this.mime,
+ isProtected: false, // will be fixed in the protectNoteRevisions() call
+ utcDateLastEdited: this.utcDateModified > contentMetadata.utcDateModified
+ ? this.utcDateModified
+ : contentMetadata.utcDateModified,
+ utcDateCreated: dateUtils.utcNowDateTime(),
+ utcDateModified: dateUtils.utcNowDateTime(),
+ dateLastEdited: this.dateModified > contentMetadata.dateModified
+ ? this.dateModified
+ : contentMetadata.dateModified,
+ dateCreated: dateUtils.localNowDateTime()
+ }).save();
+
+ noteRevision.setContent(content);
+
+ return noteRevision;
+ }
+
beforeSaving() {
super.beforeSaving();
diff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.html
index 3c73eee9f6..23c98b39eb 100644
--- a/docs/backend_api/services_backend_script_api.js.html
+++ b/docs/backend_api/services_backend_script_api.js.html
@@ -454,6 +454,15 @@ function BackendScriptApi(currentNote, apiParams) {
* @return {{syncVersion, appVersion, buildRevision, dbVersion, dataDirectory, buildDate}|*} - object representing basic info about running Trilium version
*/
this.getAppInfo = () => appInfo
+
+ /**
+ * This object contains "at your risk" and "no BC guarantees" objects for advanced use cases.
+ *
+ * @type {{becca: Becca}}
+ */
+ this.__private = {
+ becca
+ }
}
module.exports = BackendScriptApi;
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html
index 9ac977093f..f464ae182c 100644
--- a/docs/frontend_api/FrontendScriptApi.html
+++ b/docs/frontend_api/FrontendScriptApi.html
@@ -1665,6 +1665,143 @@
+
+
+
+
+
+
+ <h4 class="name" id="addTextToActiveContextEditor"><span class="type-signature"></span>addTextToActiveContextEditor<span class="signature">(text)</span><span class="type-signature"></span></h4>
+
+
+
+
+
+
+<div class="description">
+ Adds given text to the editor cursor
+</div>
+
+
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>text</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">string</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">this must be clear text, HTML is not supported.</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line358">line 358</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1760,6 +1897,8 @@
+ <dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>use addTextToActiveContextEditor() instead</li></ul></dd>
+
@@ -1772,7 +1911,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#line345">line 345</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line346">line 346</a>
</li></ul></dd>
@@ -1928,7 +2067,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#line502">line 502</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line549">line 549</a>
</li></ul></dd>
@@ -2479,7 +2618,7 @@
- <h4 class="name" id="getActiveNoteDetailWidget"><span class="type-signature"></span>getActiveNoteDetailWidget<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;NoteDetailWidget>}</span></h4>
+ <h4 class="name" id="getActiveContextCodeEditor"><span class="type-signature"></span>getActiveContextCodeEditor<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;CodeMirror>}</span></h4>
@@ -2487,8 +2626,7 @@
<div class="description">
- Get access to the widget handling note detail. Methods like `getWidgetType()` and `getTypeWidget()` to get to the
-implementation of actual widget type.
+ See https://codemirror.net/doc/manual.html#api
</div>
@@ -2532,7 +2670,7 @@ implementation of actual widget type.
<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#line377">line 377</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line404">line 404</a>
</li></ul></dd>
@@ -2560,6 +2698,10 @@ implementation of actual widget type.
<h5>Returns:</h5>
+<div class="param-desc">
+ instance of CodeMirror
+</div>
+
<dl>
@@ -2568,7 +2710,7 @@ implementation of actual widget type.
</dt>
<dd>
-<span class="param-type">Promise.&lt;NoteDetailWidget></span>
+<span class="param-type">Promise.&lt;CodeMirror></span>
</dd>
@@ -2586,7 +2728,219 @@ implementation of actual widget type.
- <h4 class="name" id="getActiveTabCodeEditor"><span class="type-signature"></span>getActiveTabCodeEditor<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;CodeMirror>}</span></h4>
+ <h4 class="name" id="getActiveContextNote"><span class="type-signature"></span>getActiveContextNote<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="NoteShort.html">NoteShort</a>}</span></h4>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line375">line 375</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ active note (loaded into right pane)
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type"><a href="NoteShort.html">NoteShort</a></span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="getActiveContextNotePath"><span class="type-signature"></span>getActiveContextNotePath<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;(string|null)>}</span></h4>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line430">line 430</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ returns note path of active note or null if there isn't active note
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">Promise.&lt;(string|null)></span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="getActiveContextTextEditor"><span class="type-signature"></span>getActiveContextTextEditor<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;CKEditor>}</span></h4>
@@ -2594,7 +2948,7 @@ implementation of actual widget type.
<div class="description">
- See https://codemirror.net/doc/manual.html#api
+ See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance.
</div>
@@ -2638,7 +2992,7 @@ implementation of actual widget type.
<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#line368">line 368</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line396">line 396</a>
</li></ul></dd>
@@ -2667,7 +3021,7 @@ implementation of actual widget type.
<div class="param-desc">
- instance of CodeMirror
+ instance of CKEditor
</div>
@@ -2678,7 +3032,114 @@ implementation of actual widget type.
</dt>
<dd>
-<span class="param-type">Promise.&lt;CodeMirror></span>
+<span class="param-type">Promise.&lt;CKEditor></span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="getActiveNoteDetailWidget"><span class="type-signature"></span>getActiveNoteDetailWidget<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;NoteDetailWidget>}</span></h4>
+
+
+
+
+
+
+<div class="description">
+ Get access to the widget handling note detail. Methods like `getWidgetType()` and `getTypeWidget()` to get to the
+implementation of actual widget type.
+</div>
+
+
+
+
+
+
+
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line413">line 413</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">Promise.&lt;NoteDetailWidget></span>
</dd>
@@ -2732,6 +3193,8 @@ implementation of actual widget type.
+ <dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>use getActiveContextNote() instead</li></ul></dd>
+
@@ -2744,7 +3207,7 @@ implementation of actual widget type.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line351">line 351</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line365">line 365</a>
</li></ul></dd>
@@ -2838,6 +3301,8 @@ implementation of actual widget type.
+ <dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>use getActiveContextNotePath() instead</li></ul></dd>
+
@@ -2850,7 +3315,7 @@ implementation of actual widget type.
<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#line383">line 383</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line420">line 420</a>
</li></ul></dd>
@@ -2908,7 +3373,7 @@ implementation of actual widget type.
- <h4 class="name" id="getActiveTabTextEditor"><span class="type-signature"></span>getActiveTabTextEditor<span class="signature">(callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;CKEditor>}</span></h4>
+ <h4 class="name" id="getActiveTabTextEditor"><span class="type-signature"></span>getActiveTabTextEditor<span class="signature">(callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
@@ -2975,7 +3440,7 @@ implementation of actual widget type.
- <td class="description last">deprecated (use returned promise): callback receiving "textEditor" instance</td>
+ <td class="description last">callback receiving "textEditor" instance</td>
</tr>
@@ -3004,6 +3469,8 @@ implementation of actual widget type.
+ <dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>use getActiveContextTextEditor()</li></ul></dd>
+
@@ -3016,7 +3483,7 @@ implementation of actual widget type.
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line360">line 360</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line384">line 384</a>
</li></ul></dd>
@@ -3041,28 +3508,6 @@ implementation of actual widget type.
-<h5>Returns:</h5>
-
-
-<div class="param-desc">
- instance of CKEditor
-</div>
-
-
-
-<dl>
- <dt>
- Type
- </dt>
- <dd>
-
-<span class="param-type">Promise.&lt;CKEditor></span>
-
-
- </dd>
-</dl>
-
-
@@ -3175,7 +3620,7 @@ implementation of actual widget type.
<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#line392">line 392</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line439">line 439</a>
</li></ul></dd>
@@ -3332,7 +3777,7 @@ implementation of actual widget type.
<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#line444">line 444</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line491">line 491</a>
</li></ul></dd>
@@ -3487,7 +3932,7 @@ implementation of actual widget type.
<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#line453">line 453</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line500">line 500</a>
</li></ul></dd>
@@ -3749,7 +4194,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#line471">line 471</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line518">line 518</a>
</li></ul></dd>
@@ -4212,7 +4657,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#line434">line 434</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line481">line 481</a>
</li></ul></dd>
@@ -4367,7 +4812,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#line462">line 462</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line509">line 509</a>
</li></ul></dd>
@@ -4522,7 +4967,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#line480">line 480</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line527">line 527</a>
</li></ul></dd>
@@ -4959,7 +5404,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#line404">line 404</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line451">line 451</a>
</li></ul></dd>
@@ -5115,7 +5560,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#line415">line 415</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line462">line 462</a>
</li></ul></dd>
@@ -5271,7 +5716,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#line424">line 424</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line471">line 471</a>
</li></ul></dd>
@@ -5408,7 +5853,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#line529">line 529</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line576">line 576</a>
</li></ul></dd>
@@ -5562,7 +6007,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#line520">line 520</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line567">line 567</a>
</li></ul></dd>
@@ -6503,7 +6948,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#line489">line 489</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line536">line 536</a>
</li></ul></dd>
@@ -6654,7 +7099,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#line398">line 398</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line445">line 445</a>
</li></ul></dd>
@@ -7340,7 +7785,7 @@ Typical use case is when new note has been created, we should wait until it is s
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line513">line 513</a>
+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line560">line 560</a>
</li></ul></dd>
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html
index fe896a1846..0bb38dc24f 100644
--- a/docs/frontend_api/services_frontend_script_api.js.html
+++ b/docs/frontend_api/services_frontend_script_api.js.html
@@ -412,7 +412,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
this.getActiveTabTextEditor = callback => {
console.warn("api.getActiveTabTextEditor() is deprecated, use getActiveContextTextEditor() instead.");
- return appContext.tabManager.getActiveContextTextEditor(callback);
+ return appContext.tabManager.getActiveContext()?.getTextEditor(callback);
};
/**
@@ -421,7 +421,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* @method
* @returns {Promise&lt;CKEditor>} instance of CKEditor
*/
- this.getActiveContextTextEditor = () => appContext.tabManager.getActiveContextTextEditor();
+ this.getActiveContextTextEditor = () => appContext.tabManager.getActiveContext()?.getTextEditor();
/**
* See https://codemirror.net/doc/manual.html#api
@@ -429,7 +429,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* @method
* @returns {Promise&lt;CodeMirror>} instance of CodeMirror
*/
- this.getActiveContextCodeEditor = () => appContext.tabManager.getActiveContextCodeEditor();
+ this.getActiveContextCodeEditor = () => appContext.tabManager.getActiveContext()?.getCodeEditor();
/**
* Get access to the widget handling note detail. Methods like `getWidgetType()` and `getTypeWidget()` to get to the
diff --git a/src/becca/entities/note.js b/src/becca/entities/note.js
index 595e410522..a815df1c3c 100644
--- a/src/becca/entities/note.js
+++ b/src/becca/entities/note.js
@@ -9,6 +9,8 @@ const entityChangesService = require('../../services/entity_changes');
const AbstractEntity = require("./abstract_entity");
const NoteRevision = require("./note_revision");
const TaskContext = require("../../services/task_context.js");
+const optionService = require("../../services/options.js");
+const noteRevisionService = require("../../services/note_revisions.js");
const LABEL = 'label';
const RELATION = 'relation';
@@ -1164,6 +1166,41 @@ class Note extends AbstractEntity {
return !(this.noteId in this.becca.notes);
}
+ /**
+ * @return {NoteRevision|null}
+ */
+ saveNoteRevision() {
+ const content = this.getContent();
+
+ if (!content || (Buffer.isBuffer(content) && content.byteLength === 0)) {
+ return null;
+ }
+
+ const contentMetadata = this.getContentMetadata();
+
+ const noteRevision = new NoteRevision({
+ noteId: this.noteId,
+ // title and text should be decrypted now
+ title: this.title,
+ type: this.type,
+ mime: this.mime,
+ isProtected: false, // will be fixed in the protectNoteRevisions() call
+ utcDateLastEdited: this.utcDateModified > contentMetadata.utcDateModified
+ ? this.utcDateModified
+ : contentMetadata.utcDateModified,
+ utcDateCreated: dateUtils.utcNowDateTime(),
+ utcDateModified: dateUtils.utcNowDateTime(),
+ dateLastEdited: this.dateModified > contentMetadata.dateModified
+ ? this.dateModified
+ : contentMetadata.dateModified,
+ dateCreated: dateUtils.localNowDateTime()
+ }).save();
+
+ noteRevision.setContent(content);
+
+ return noteRevision;
+ }
+
beforeSaving() {
super.beforeSaving();
diff --git a/src/routes/api/notes.js b/src/routes/api/notes.js
index 5f334edc80..272cc88e02 100644
--- a/src/routes/api/notes.js
+++ b/src/routes/api/notes.js
@@ -206,7 +206,7 @@ function changeTitle(req) {
const noteTitleChanged = note.title !== title;
if (noteTitleChanged) {
- noteService.saveNoteRevision(note);
+ noteService.saveNoteRevisionIfNeeded(note);
}
note.title = title;
diff --git a/src/services/note_revisions.js b/src/services/note_revisions.js
index 3ff9b692a6..3759d2d2e7 100644
--- a/src/services/note_revisions.js
+++ b/src/services/note_revisions.js
@@ -30,46 +30,6 @@ function protectNoteRevisions(note) {
}
}
-/**
- * @param {Note} note
- * @return {NoteRevision|null}
- */
-function createNoteRevision(note) {
- if (note.hasLabel("disableVersioning")) {
- return null;
- }
-
- const content = note.getContent();
-
- if (!content || (Buffer.isBuffer(content) && content.byteLength === 0)) {
- return null;
- }
-
- const contentMetadata = note.getContentMetadata();
-
- const noteRevision = new NoteRevision({
- noteId: note.noteId,
- // title and text should be decrypted now
- title: note.title,
- type: note.type,
- mime: note.mime,
- isProtected: false, // will be fixed in the protectNoteRevisions() call
- utcDateLastEdited: note.utcDateModified > contentMetadata.utcDateModified
- ? note.utcDateModified
- : contentMetadata.utcDateModified,
- utcDateCreated: dateUtils.utcNowDateTime(),
- utcDateModified: dateUtils.utcNowDateTime(),
- dateLastEdited: note.dateModified > contentMetadata.dateModified
- ? note.dateModified
- : contentMetadata.dateModified,
- dateCreated: dateUtils.localNowDateTime()
- }).save();
-
- noteRevision.setContent(content);
-
- return noteRevision;
-}
-
function eraseNoteRevisions(noteRevisionIdsToErase) {
if (noteRevisionIdsToErase.length === 0) {
return;
@@ -86,6 +46,5 @@ function eraseNoteRevisions(noteRevisionIdsToErase) {
module.exports = {
protectNoteRevisions,
- createNoteRevision,
eraseNoteRevisions
};
diff --git a/src/services/notes.js b/src/services/notes.js
index 5e36707277..15526e9b65 100644
--- a/src/services/notes.js
+++ b/src/services/notes.js
@@ -491,7 +491,7 @@ function saveLinks(note, content) {
return content;
}
-function saveNoteRevision(note) {
+function saveNoteRevisionIfNeeded(note) {
// files and images are versioned separately
if (note.type === 'file' || note.type === 'image' || note.hasLabel('disableVersioning')) {
return;
@@ -508,7 +508,7 @@ function saveNoteRevision(note) {
const msSinceDateCreated = now.getTime() - dateUtils.parseDateTime(note.utcDateCreated).getTime();
if (!existingNoteRevisionId && msSinceDateCreated >= noteRevisionSnapshotTimeInterval * 1000) {
- noteRevisionService.createNoteRevision(note);
+ note.saveNoteRevision();
}
}
@@ -519,7 +519,7 @@ function updateNote(noteId, noteUpdates) {
throw new Error(`Note '${noteId}' is not available for change!`);
}
- saveNoteRevision(note);
+ saveNoteRevisionIfNeeded(note);
// if protected status changed, then we need to encrypt/decrypt the content anyway
if (['file', 'image'].includes(note.type) && note.isProtected !== noteUpdates.isProtected) {
@@ -910,6 +910,6 @@ module.exports = {
triggerNoteTitleChanged,
eraseDeletedNotesNow,
eraseNotesWithDeleteId,
- saveNoteRevision,
+ saveNoteRevisionIfNeeded,
downloadImages
};