mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-02 19:36:12 +01:00 
			
		
		
		
	Merge branch 'stable'
This commit is contained in:
		@@ -73,6 +73,10 @@ class Branch extends Entity {
 | 
			
		||||
            this.notePosition = maxNotePos === null ? 0 : maxNotePos + 10;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!this.isExpanded) {
 | 
			
		||||
            this.isExpanded = false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!this.isDeleted) {
 | 
			
		||||
            this.isDeleted = false;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -1240,6 +1240,162 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    <h4 class="name" id="bindGlobalShortcut"><span class="type-signature"></span>bindGlobalShortcut<span class="signature">(keyboardShortcut, handler)</span><span class="type-signature"></span></h4>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <h5>Parameters:</h5>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
<table class="params">
 | 
			
		||||
    <thead>
 | 
			
		||||
    <tr>
 | 
			
		||||
        
 | 
			
		||||
        <th>Name</th>
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        <th>Type</th>
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        <th class="last">Description</th>
 | 
			
		||||
    </tr>
 | 
			
		||||
    </thead>
 | 
			
		||||
 | 
			
		||||
    <tbody>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
        <tr>
 | 
			
		||||
            
 | 
			
		||||
                <td class="name"><code>keyboardShortcut</code></td>
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            <td class="type">
 | 
			
		||||
            
 | 
			
		||||
                
 | 
			
		||||
<span class="param-type">string</span>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
            </td>
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            <td class="description last">e.g. "ctrl+shift+a"</td>
 | 
			
		||||
        </tr>
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
        <tr>
 | 
			
		||||
            
 | 
			
		||||
                <td class="name"><code>handler</code></td>
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            <td class="type">
 | 
			
		||||
            
 | 
			
		||||
                
 | 
			
		||||
<span class="param-type">function</span>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
            </td>
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            <td class="description last"></td>
 | 
			
		||||
        </tr>
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    </tbody>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<dl class="details">
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line368">line 368</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
</dl>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
@@ -1390,7 +1546,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#line273">line 273</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line275">line 275</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1523,7 +1679,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#line233">line 233</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line235">line 235</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1629,7 +1785,7 @@
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line279">line 279</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line281">line 281</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1735,7 +1891,7 @@
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line285">line 285</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line287">line 287</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1894,7 +2050,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#line332">line 332</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line334">line 334</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2001,7 +2157,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#line226">line 226</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line228">line 228</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2156,7 +2312,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#line341">line 341</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line343">line 343</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2619,7 +2775,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#line323">line 323</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line325">line 325</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2774,7 +2930,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#line350">line 350</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line352">line 352</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2883,7 +3039,7 @@ note.
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line296">line 296</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line298">line 298</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -3038,7 +3194,7 @@ note.
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line304">line 304</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line306">line 306</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -3171,7 +3327,7 @@ note.
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line240">line 240</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line242">line 242</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -3277,7 +3433,7 @@ note.
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line315">line 315</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line317">line 317</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -3365,7 +3521,7 @@ note.
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line264">line 264</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line266">line 266</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -3426,6 +3582,10 @@ note.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<div class="description">
 | 
			
		||||
    Update frontend tree (note) cache from the backend.
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -3516,7 +3676,7 @@ note.
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line218">line 218</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line220">line 220</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -4148,7 +4308,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#line359">line 359</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line361">line 361</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -4299,7 +4459,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#line310">line 310</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line312">line 312</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -4436,7 +4596,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#line256">line 256</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line258">line 258</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -4573,7 +4733,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#line248">line 248</a>
 | 
			
		||||
        <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line250">line 250</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -281,7 +281,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line35">line 35</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line37">line 37</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -349,7 +349,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line42">line 42</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line44">line 44</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -417,7 +417,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line48">line 48</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line50">line 50</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -475,7 +475,65 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line37">line 37</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line39">line 39</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
</dl>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
            
 | 
			
		||||
<h4 class="name" id="isDeleted"><span class="type-signature"></span>isDeleted<span class="type-signature"></span></h4>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<dl class="details">
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line35">line 35</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -717,7 +775,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line40">line 40</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line42">line 42</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -785,7 +843,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line45">line 45</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line47">line 47</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1049,7 +1107,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line217">line 217</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line220">line 220</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1216,7 +1274,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line157">line 157</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line160">line 160</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1390,7 +1448,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line228">line 228</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line231">line 231</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1496,7 +1554,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line115">line 115</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line117">line 117</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1598,7 +1656,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line127">line 127</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line129">line 129</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1700,7 +1758,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line144">line 144</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line147">line 147</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1802,7 +1860,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line149">line 149</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line152">line 152</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -1953,7 +2011,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line250">line 250</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line253">line 253</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2120,7 +2178,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line183">line 183</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line186">line 186</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2287,7 +2345,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line175">line 175</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line178">line 178</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2442,7 +2500,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line262">line 262</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line265">line 265</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2548,7 +2606,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line134">line 134</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line137">line 137</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2650,7 +2708,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line139">line 139</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line142">line 142</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2801,7 +2859,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line256">line 256</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line259">line 259</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -2968,7 +3026,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line199">line 199</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line202">line 202</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -3135,7 +3193,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line191">line 191</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line194">line 194</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -3290,7 +3348,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line274">line 274</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line277">line 277</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -3460,7 +3518,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line284">line 284</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line287">line 287</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -3611,7 +3669,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line268">line 268</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line271">line 271</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -3721,7 +3779,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line308">line 308</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line311">line 311</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -3895,7 +3953,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line208">line 208</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line211">line 211</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -4001,7 +4059,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line122">line 122</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line124">line 124</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -4152,7 +4210,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line238">line 238</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line241">line 241</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -4307,7 +4365,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div>
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line244">line 244</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line247">line 247</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -4418,7 +4476,7 @@ Cache is note instance scoped.
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line299">line 299</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line302">line 302</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@@ -4502,7 +4560,7 @@ Cache is note instance scoped.
 | 
			
		||||
    
 | 
			
		||||
    <dt class="tag-source">Source:</dt>
 | 
			
		||||
    <dd class="tag-source"><ul class="dummy"><li>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line90">line 90</a>
 | 
			
		||||
        <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line92">line 92</a>
 | 
			
		||||
    </li></ul></dd>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -60,6 +60,8 @@ class NoteShort {
 | 
			
		||||
        /** @param {string} content-type, e.g. "application/json" */
 | 
			
		||||
        this.mime = row.mime;
 | 
			
		||||
        /** @param {boolean} */
 | 
			
		||||
        this.isDeleted = row.isDeleted;
 | 
			
		||||
        /** @param {boolean} */
 | 
			
		||||
        this.archived = row.archived;
 | 
			
		||||
        /** @param {string} */
 | 
			
		||||
        this.cssClass = row.cssClass;
 | 
			
		||||
@@ -108,7 +110,7 @@ class NoteShort {
 | 
			
		||||
        const branchIdPos = {};
 | 
			
		||||
 | 
			
		||||
        for (const branchId of Object.values(this.childToBranch)) {
 | 
			
		||||
            branchIdPos[branchId] = this.treeCache.branches[branchId].notePosition;
 | 
			
		||||
            branchIdPos[branchId] = this.treeCache.getBranch(branchId).notePosition;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.children.sort((a, b) => branchIdPos[this.childToBranch[a]] < branchIdPos[this.childToBranch[b]] ? -1 : 1);
 | 
			
		||||
@@ -153,7 +155,8 @@ class NoteShort {
 | 
			
		||||
 | 
			
		||||
    /** @returns {Promise<Branch[]>} */
 | 
			
		||||
    async getChildBranches() {
 | 
			
		||||
        const branchIds = Object.values(this.childToBranch);
 | 
			
		||||
        // don't use Object.values() to guarantee order
 | 
			
		||||
        const branchIds = this.children.map(childNoteId => this.childToBranch[childNoteId]);
 | 
			
		||||
 | 
			
		||||
        return this.treeCache.getBranches(branchIds);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -240,6 +240,8 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
 | 
			
		||||
    this.getNotes = async (noteIds, silentNotFoundError = false) => await treeCache.getNotes(noteIds, silentNotFoundError);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Update frontend tree (note) cache from the backend.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string[]} noteIds
 | 
			
		||||
     * @method
 | 
			
		||||
     */
 | 
			
		||||
@@ -385,6 +387,13 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
 | 
			
		||||
     * @return {Promise}
 | 
			
		||||
     */
 | 
			
		||||
    this.setHoistedNoteId = hoistedNoteService.setHoistedNoteId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @method
 | 
			
		||||
     * @param {string} keyboardShortcut - e.g. "ctrl+shift+a"
 | 
			
		||||
     * @param {function} handler
 | 
			
		||||
     */
 | 
			
		||||
    this.bindGlobalShortcut = utils.bindGlobalShortcut;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default FrontendScriptApi;</code></pre>
 | 
			
		||||
 
 | 
			
		||||
@@ -191,7 +191,7 @@
 | 
			
		||||
			this.addNodes.apply(this, json['nodes']);
 | 
			
		||||
			this.addEdges.apply(this, json['edges']);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	// find the edges from node1 to node2
 | 
			
		||||
@@ -479,51 +479,35 @@
 | 
			
		||||
		return energy;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; // stolen from coffeescript, thanks jashkenas! ;-)
 | 
			
		||||
 | 
			
		||||
	Springy.requestAnimationFrame = __bind(this.requestAnimationFrame ||
 | 
			
		||||
		this.webkitRequestAnimationFrame ||
 | 
			
		||||
		this.mozRequestAnimationFrame ||
 | 
			
		||||
		this.oRequestAnimationFrame ||
 | 
			
		||||
		this.msRequestAnimationFrame ||
 | 
			
		||||
		(function(callback, element) {
 | 
			
		||||
			this.setTimeout(callback, 10);
 | 
			
		||||
		}), this);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Start simulation if it's not running already.
 | 
			
		||||
	 * In case it's running then the call is ignored, and none of the callbacks passed is ever executed.
 | 
			
		||||
	 */
 | 
			
		||||
	Layout.ForceDirected.prototype.start = function(render, onRenderStop, onRenderStart) {
 | 
			
		||||
	Layout.ForceDirected.prototype.start = function(onRenderStop) {
 | 
			
		||||
		var t = this;
 | 
			
		||||
 | 
			
		||||
		if (this._started) return;
 | 
			
		||||
		this._started = true;
 | 
			
		||||
		this._stop = false;
 | 
			
		||||
 | 
			
		||||
		if (onRenderStart !== undefined) { onRenderStart(); }
 | 
			
		||||
 | 
			
		||||
		Springy.requestAnimationFrame(function step() {
 | 
			
		||||
		function step() {
 | 
			
		||||
			t.tick(0.03);
 | 
			
		||||
 | 
			
		||||
			if (!t._stop && render !== undefined) {
 | 
			
		||||
				render();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// stop simulation when energy of the system goes below a threshold
 | 
			
		||||
			if (t._stop || t.totalEnergy() < t.minEnergyThreshold) {
 | 
			
		||||
				t._started = false;
 | 
			
		||||
				if (onRenderStop !== undefined) { onRenderStop(); }
 | 
			
		||||
				onRenderStop();
 | 
			
		||||
			} else {
 | 
			
		||||
				Springy.requestAnimationFrame(step);
 | 
			
		||||
				setImmediate(step);
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		step();
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	Layout.ForceDirected.prototype.stop = function() {
 | 
			
		||||
		this._stop = true;
 | 
			
		||||
	}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	Layout.ForceDirected.prototype.tick = function(timestep) {
 | 
			
		||||
		this.applyCoulombsLaw();
 | 
			
		||||
@@ -644,85 +628,35 @@
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Renderer handles the layout rendering loop
 | 
			
		||||
	 * @param onRenderStop optional callback function that gets executed whenever rendering stops.
 | 
			
		||||
	 * @param onRenderStart optional callback function that gets executed whenever rendering starts.
 | 
			
		||||
	 * @param onRenderFrame optional callback function that gets executed after each frame is rendered.
 | 
			
		||||
	 */
 | 
			
		||||
	var Renderer = Springy.Renderer = function(layout, clear, drawEdge, drawNode, onRenderStop, onRenderStart, onRenderFrame) {
 | 
			
		||||
	var Renderer = Springy.Renderer = function(layout, onRenderStop) {
 | 
			
		||||
		this.layout = layout;
 | 
			
		||||
		this.clear = clear;
 | 
			
		||||
		this.drawEdge = drawEdge;
 | 
			
		||||
		this.drawNode = drawNode;
 | 
			
		||||
		this.onRenderStop = onRenderStop;
 | 
			
		||||
		this.onRenderStart = onRenderStart;
 | 
			
		||||
		this.onRenderFrame = onRenderFrame;
 | 
			
		||||
 | 
			
		||||
		this.layout.graph.addGraphListener(this);
 | 
			
		||||
	}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	Renderer.prototype.graphChanged = function(e) {
 | 
			
		||||
	Renderer.prototype.graphChanged = function() {
 | 
			
		||||
		this.start();
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Starts the simulation of the layout in use.
 | 
			
		||||
	 *
 | 
			
		||||
	 * Note that in case the algorithm is still or already running then the layout that's in use
 | 
			
		||||
	 * might silently ignore the call, and your optional <code>done</code> callback is never executed.
 | 
			
		||||
	 * At least the built-in ForceDirected layout behaves in this way.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param done An optional callback function that gets executed when the springy algorithm stops,
 | 
			
		||||
	 * either because it ended or because stop() was called.
 | 
			
		||||
	 */
 | 
			
		||||
	Renderer.prototype.start = function(done) {
 | 
			
		||||
		var t = this;
 | 
			
		||||
		this.layout.start(function render() {
 | 
			
		||||
			t.clear();
 | 
			
		||||
	Renderer.prototype.start = function(maxTime) {
 | 
			
		||||
		if (maxTime) {
 | 
			
		||||
			setTimeout(() => this.stop(), maxTime);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
			t.layout.eachEdge(function(edge, spring) {
 | 
			
		||||
				t.drawEdge(edge, spring.point1.p, spring.point2.p);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			t.layout.eachNode(function(node, point) {
 | 
			
		||||
				t.drawNode(node, point.p);
 | 
			
		||||
			});
 | 
			
		||||
			
 | 
			
		||||
			if (t.onRenderFrame !== undefined) { t.onRenderFrame(); }
 | 
			
		||||
		}, this.onRenderStop, this.onRenderStart);
 | 
			
		||||
		return new Promise((res, rej) => {
 | 
			
		||||
			this.layout.start(res);
 | 
			
		||||
		});
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	Renderer.prototype.stop = function() {
 | 
			
		||||
		this.layout.stop();
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	// Array.forEach implementation for IE support..
 | 
			
		||||
	//https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/forEach
 | 
			
		||||
	if ( !Array.prototype.forEach ) {
 | 
			
		||||
		Array.prototype.forEach = function( callback, thisArg ) {
 | 
			
		||||
			var T, k;
 | 
			
		||||
			if ( this == null ) {
 | 
			
		||||
				throw new TypeError( " this is null or not defined" );
 | 
			
		||||
			}
 | 
			
		||||
			var O = Object(this);
 | 
			
		||||
			var len = O.length >>> 0; // Hack to convert O.length to a UInt32
 | 
			
		||||
			if ( {}.toString.call(callback) != "[object Function]" ) {
 | 
			
		||||
				throw new TypeError( callback + " is not a function" );
 | 
			
		||||
			}
 | 
			
		||||
			if ( thisArg ) {
 | 
			
		||||
				T = thisArg;
 | 
			
		||||
			}
 | 
			
		||||
			k = 0;
 | 
			
		||||
			while( k < len ) {
 | 
			
		||||
				var kValue;
 | 
			
		||||
				if ( k in O ) {
 | 
			
		||||
					kValue = O[ k ];
 | 
			
		||||
					callback.call( T, kValue, k, O );
 | 
			
		||||
				}
 | 
			
		||||
				k++;
 | 
			
		||||
			}
 | 
			
		||||
		};
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var isEmpty = function(obj) {
 | 
			
		||||
		for (var k in obj) {
 | 
			
		||||
			if (obj.hasOwnProperty(k)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
  "name": "trilium",
 | 
			
		||||
  "productName": "Trilium Notes",
 | 
			
		||||
  "description": "Trilium Notes",
 | 
			
		||||
  "version": "0.36.2",
 | 
			
		||||
  "version": "0.36.3",
 | 
			
		||||
  "license": "AGPL-3.0-only",
 | 
			
		||||
  "main": "electron.js",
 | 
			
		||||
  "bin": {
 | 
			
		||||
 
 | 
			
		||||
@@ -23,19 +23,18 @@ export async function showDialog() {
 | 
			
		||||
    // set default settings
 | 
			
		||||
    $maxNotesInput.val(20);
 | 
			
		||||
 | 
			
		||||
    const note = noteDetailService.getActiveTabNote();
 | 
			
		||||
 | 
			
		||||
    if (!note) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $linkMapContainer.css("height", $("body").height() - 150);
 | 
			
		||||
 | 
			
		||||
    linkMapService = new LinkMapService(note, $linkMapContainer, getOptions());
 | 
			
		||||
 | 
			
		||||
    linkMapService.render();
 | 
			
		||||
    $linkMapContainer.empty();
 | 
			
		||||
 | 
			
		||||
    $dialog.modal();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$dialog.on('shown.bs.modal', () => {
 | 
			
		||||
    const note = noteDetailService.getActiveTabNote();
 | 
			
		||||
 | 
			
		||||
    linkMapService = new LinkMapService(note, $linkMapContainer, getOptions());
 | 
			
		||||
    linkMapService.render();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
$maxNotesInput.on("input", () => linkMapService.loadNotesAndRelations(getOptions()));
 | 
			
		||||
 
 | 
			
		||||
@@ -26,9 +26,7 @@ async function moveBeforeNode(nodesToMove, beforeNode) {
 | 
			
		||||
 | 
			
		||||
        await changeNode(
 | 
			
		||||
            node => node.moveTo(beforeNode, 'before'),
 | 
			
		||||
            nodeToMove,
 | 
			
		||||
            beforeNode.data.noteId,
 | 
			
		||||
            null);
 | 
			
		||||
            nodeToMove);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -52,9 +50,7 @@ async function moveAfterNode(nodesToMove, afterNode) {
 | 
			
		||||
 | 
			
		||||
        await changeNode(
 | 
			
		||||
            node => node.moveTo(afterNode, 'after'),
 | 
			
		||||
            nodeToMove,
 | 
			
		||||
            null,
 | 
			
		||||
            afterNode.data.noteId);
 | 
			
		||||
            nodeToMove);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -62,6 +58,11 @@ async function moveToNode(nodesToMove, toNode) {
 | 
			
		||||
    nodesToMove = await filterRootNote(nodesToMove);
 | 
			
		||||
 | 
			
		||||
    for (const nodeToMove of nodesToMove) {
 | 
			
		||||
        if (nodeToMove.data.noteId === await hoistedNoteService.getHoistedNoteId()
 | 
			
		||||
            || nodeToMove.getParent().data.noteType === 'search') {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const resp = await server.put('branches/' + nodeToMove.data.branchId + '/move-to/' + toNode.data.noteId);
 | 
			
		||||
 | 
			
		||||
        if (!resp.success) {
 | 
			
		||||
@@ -156,7 +157,9 @@ async function deleteNodes(nodes) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function moveNodeUpInHierarchy(node) {
 | 
			
		||||
    if (await hoistedNoteService.isRootNode(node) || await hoistedNoteService.isTopLevelNode(node)) {
 | 
			
		||||
    if (await hoistedNoteService.isRootNode(node)
 | 
			
		||||
        || await hoistedNoteService.isTopLevelNode(node)
 | 
			
		||||
        || node.getParent().data.noteType === 'search') {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -177,7 +180,7 @@ async function moveNodeUpInHierarchy(node) {
 | 
			
		||||
        node);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function changeNode(func, node, beforeNoteId = null, afterNoteId = null) {
 | 
			
		||||
async function changeNode(func, node) {
 | 
			
		||||
    utils.assertArguments(func, node);
 | 
			
		||||
 | 
			
		||||
    const childNoteId = node.data.noteId;
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ import treeUtils from "./tree_utils.js";
 | 
			
		||||
import treeChangesService from "./branches.js";
 | 
			
		||||
import cloningService from "./cloning.js";
 | 
			
		||||
import toastService from "./toast.js";
 | 
			
		||||
import hoistedNoteService from "./hoisted_note.js";
 | 
			
		||||
 | 
			
		||||
let clipboardIds = [];
 | 
			
		||||
let clipboardMode = null;
 | 
			
		||||
@@ -66,10 +67,16 @@ function copy(nodes) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function cut(nodes) {
 | 
			
		||||
    clipboardIds = nodes.map(node => node.key);
 | 
			
		||||
    clipboardMode = 'cut';
 | 
			
		||||
    clipboardIds = nodes
 | 
			
		||||
        .filter(node => node.data.noteId !== hoistedNoteService.getHoistedNoteNoPromise())
 | 
			
		||||
        .filter(node => node.getParent().data.noteType !== 'search')
 | 
			
		||||
        .map(node => node.data.noteId);
 | 
			
		||||
 | 
			
		||||
    toastService.showMessage("Note(s) have been cut into clipboard.");
 | 
			
		||||
    if (clipboardIds.length > 0) {
 | 
			
		||||
        clipboardMode = 'cut';
 | 
			
		||||
 | 
			
		||||
        toastService.showMessage("Note(s) have been cut into clipboard.");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function isEmpty() {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,13 @@
 | 
			
		||||
import treeService from './tree.js';
 | 
			
		||||
import treeChangesService from './branches.js';
 | 
			
		||||
import hoistedNoteService from './hoisted_note.js';
 | 
			
		||||
 | 
			
		||||
const dragAndDropSetup = {
 | 
			
		||||
    autoExpandMS: 600,
 | 
			
		||||
    dragStart: (node, data) => {
 | 
			
		||||
        // don't allow dragging root node
 | 
			
		||||
        if (node.data.noteId === 'root') {
 | 
			
		||||
        if (node.data.noteId === hoistedNoteService.getHoistedNoteNoPromise()
 | 
			
		||||
            || node.getParent().data.noteType === 'search') {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -25,6 +27,17 @@ const dragAndDropSetup = {
 | 
			
		||||
    dragEnter: (node, data) => true, // allow drop on any node
 | 
			
		||||
    dragOver: (node, data) => true,
 | 
			
		||||
    dragDrop: async (node, data) => {
 | 
			
		||||
        if ((data.hitMode === 'over' && node.data.noteType === 'search') ||
 | 
			
		||||
            (['after', 'before'].includes(data.hitMode)
 | 
			
		||||
                && (node.data.noteId === hoistedNoteService.getHoistedNoteNoPromise() || node.getParent().data.noteType === 'search'))) {
 | 
			
		||||
 | 
			
		||||
            const infoDialog = await import('../dialogs/info.js');
 | 
			
		||||
 | 
			
		||||
            await infoDialog.info("Dropping notes into this location is not allowed.");
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const dataTransfer = data.dataTransfer;
 | 
			
		||||
 | 
			
		||||
        if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
 | 
			
		||||
 
 | 
			
		||||
@@ -359,6 +359,13 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
 | 
			
		||||
     * @return {Promise}
 | 
			
		||||
     */
 | 
			
		||||
    this.setHoistedNoteId = hoistedNoteService.setHoistedNoteId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @method
 | 
			
		||||
     * @param {string} keyboardShortcut - e.g. "ctrl+shift+a"
 | 
			
		||||
     * @param {function} handler
 | 
			
		||||
     */
 | 
			
		||||
    this.bindGlobalShortcut = utils.bindGlobalShortcut;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default FrontendScriptApi;
 | 
			
		||||
@@ -3,12 +3,16 @@ import server from "./server.js";
 | 
			
		||||
import tree from "./tree.js";
 | 
			
		||||
import noteDetailService from "./note_detail.js";
 | 
			
		||||
 | 
			
		||||
let hoistedNoteId;
 | 
			
		||||
let hoistedNoteId = 'root';
 | 
			
		||||
 | 
			
		||||
optionsService.waitForOptions().then(options => {
 | 
			
		||||
    hoistedNoteId = options.get('hoistedNoteId');
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function getHoistedNoteNoPromise() {
 | 
			
		||||
    return hoistedNoteId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function getHoistedNoteId() {
 | 
			
		||||
    await optionsService.waitForOptions();
 | 
			
		||||
 | 
			
		||||
@@ -49,6 +53,7 @@ async function isRootNode(node) {
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
    getHoistedNoteId,
 | 
			
		||||
    getHoistedNoteNoPromise,
 | 
			
		||||
    setHoistedNoteId,
 | 
			
		||||
    unhoist,
 | 
			
		||||
    isTopLevelNode,
 | 
			
		||||
 
 | 
			
		||||
@@ -119,60 +119,54 @@ export default class LinkMap {
 | 
			
		||||
                stop: params => {}
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            return $noteBox;
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        this.renderer = new Springy.Renderer(
 | 
			
		||||
            layout,
 | 
			
		||||
            () => {},
 | 
			
		||||
            (edge, p1, p2) => {
 | 
			
		||||
                const connectionId = this.linkMapContainerId + '-' + edge.source.id + '-' + edge.target.id;
 | 
			
		||||
        this.renderer = new Springy.Renderer(layout);
 | 
			
		||||
        await this.renderer.start(500);
 | 
			
		||||
 | 
			
		||||
                if ($("#" + connectionId).length > 0) {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
        layout.eachNode((node, point) => {
 | 
			
		||||
            const $noteBox = getNoteBox(node.id);
 | 
			
		||||
            const middleW = this.$linkMapContainer.width() / 2;
 | 
			
		||||
            const middleH = this.$linkMapContainer.height() / 2;
 | 
			
		||||
 | 
			
		||||
                getNoteBox(edge.source.id);
 | 
			
		||||
                getNoteBox(edge.target.id);
 | 
			
		||||
            $noteBox
 | 
			
		||||
                .css("left", (middleW + point.p.x * 100) + "px")
 | 
			
		||||
                .css("top", (middleH + point.p.y * 100) + "px");
 | 
			
		||||
 | 
			
		||||
                const connection = this.jsPlumbInstance.connect({
 | 
			
		||||
                    source: this.noteIdToId(edge.source.id),
 | 
			
		||||
                    target: this.noteIdToId(edge.target.id),
 | 
			
		||||
                    type: 'link'
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
                if (connection) {
 | 
			
		||||
                    $(connection.canvas)
 | 
			
		||||
                        .prop("id", connectionId)
 | 
			
		||||
                        .addClass('link-' + edge.source.id)
 | 
			
		||||
                        .addClass('link-' + edge.target.id);
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    console.log(`connection not created for`, edge);
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            (node, p) => {
 | 
			
		||||
                const $noteBox = getNoteBox(node.id);
 | 
			
		||||
                const middleW = this.$linkMapContainer.width() / 2;
 | 
			
		||||
                const middleH = this.$linkMapContainer.height() / 2;
 | 
			
		||||
 | 
			
		||||
                $noteBox
 | 
			
		||||
                    .css("left", (middleW + p.x * 100) + "px")
 | 
			
		||||
                    .css("top", (middleH + p.y * 100) + "px");
 | 
			
		||||
 | 
			
		||||
                if ($noteBox.hasClass("link-map-active-note")) {
 | 
			
		||||
                    this.moveToCenterOfElement($noteBox[0]);
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            () => {},
 | 
			
		||||
            () => {},
 | 
			
		||||
            () => {
 | 
			
		||||
                this.jsPlumbInstance.repaintEverything();
 | 
			
		||||
            if ($noteBox.hasClass("link-map-active-note")) {
 | 
			
		||||
                this.moveToCenterOfElement($noteBox[0]);
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        this.renderer.start();
 | 
			
		||||
        layout.eachEdge(edge => {
 | 
			
		||||
            const connectionId = this.linkMapContainerId + '-' + edge.source.id + '-' + edge.target.id;
 | 
			
		||||
 | 
			
		||||
            if ($("#" + connectionId).length > 0) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            getNoteBox(edge.source.id);
 | 
			
		||||
            getNoteBox(edge.target.id);
 | 
			
		||||
 | 
			
		||||
            const connection = this.jsPlumbInstance.connect({
 | 
			
		||||
                source: this.noteIdToId(edge.source.id),
 | 
			
		||||
                target: this.noteIdToId(edge.target.id),
 | 
			
		||||
                type: 'link'
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            if (connection) {
 | 
			
		||||
                $(connection.canvas)
 | 
			
		||||
                    .prop("id", connectionId)
 | 
			
		||||
                    .addClass('link-' + edge.source.id)
 | 
			
		||||
                    .addClass('link-' + edge.target.id);
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                console.log(`connection not created for`, edge);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        this.jsPlumbInstance.repaintEverything();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    moveToCenterOfElement(element) {
 | 
			
		||||
 
 | 
			
		||||
@@ -676,6 +676,7 @@ async function createNote(node, parentNoteId, target, extraOptions = {}) {
 | 
			
		||||
        refKey: branchEntity.noteId,
 | 
			
		||||
        branchId: branchEntity.branchId,
 | 
			
		||||
        isProtected: extraOptions.isProtected,
 | 
			
		||||
        type: noteEntity.type,
 | 
			
		||||
        extraClasses: await treeBuilder.getExtraClasses(noteEntity),
 | 
			
		||||
        icon: await treeBuilder.getIcon(noteEntity),
 | 
			
		||||
        folder: extraOptions.type === 'search',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,4 @@
 | 
			
		||||
import utils from "./utils.js";
 | 
			
		||||
import Branch from "../entities/branch.js";
 | 
			
		||||
import server from "./server.js";
 | 
			
		||||
import treeCache from "./tree_cache.js";
 | 
			
		||||
import ws from "./ws.js";
 | 
			
		||||
import hoistedNoteService from "./hoisted_note.js";
 | 
			
		||||
@@ -72,6 +70,7 @@ async function prepareNode(branch) {
 | 
			
		||||
        parentNoteId: branch.parentNoteId,
 | 
			
		||||
        branchId: branch.branchId,
 | 
			
		||||
        isProtected: note.isProtected,
 | 
			
		||||
        noteType: note.type,
 | 
			
		||||
        title: utils.escapeHtml(title),
 | 
			
		||||
        extraClasses: await getExtraClasses(note),
 | 
			
		||||
        icon: await getIcon(note),
 | 
			
		||||
@@ -110,24 +109,8 @@ async function prepareRealBranch(parentNote) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function prepareSearchBranch(note) {
 | 
			
		||||
    const results = await server.get('search-note/' + note.noteId);
 | 
			
		||||
    await treeCache.reloadNotes([note.noteId]);
 | 
			
		||||
 | 
			
		||||
    // force to load all the notes at once instead of one by one
 | 
			
		||||
    await treeCache.getNotes(results.map(res => res.noteId));
 | 
			
		||||
 | 
			
		||||
    const {notes, branches} = await server.post('tree/load', { noteIds: [note.noteId] });
 | 
			
		||||
 | 
			
		||||
    results.forEach((result, index) => branches.push({
 | 
			
		||||
        branchId: "virt" + utils.randomString(10),
 | 
			
		||||
        noteId: result.noteId,
 | 
			
		||||
        parentNoteId: note.noteId,
 | 
			
		||||
        prefix: treeCache.getBranch(result.branchId).prefix,
 | 
			
		||||
        notePosition: (index + 1) * 10
 | 
			
		||||
    }));
 | 
			
		||||
 | 
			
		||||
    treeCache.addResp(notes, branches);
 | 
			
		||||
 | 
			
		||||
    // note in cache changed
 | 
			
		||||
    const newNote = await treeCache.getNote(note.noteId);
 | 
			
		||||
 | 
			
		||||
    return await prepareRealBranch(newNote);
 | 
			
		||||
 
 | 
			
		||||
@@ -102,6 +102,29 @@ class TreeCache {
 | 
			
		||||
        const resp = await server.post('tree/load', { noteIds });
 | 
			
		||||
 | 
			
		||||
        this.addResp(resp.notes, resp.branches);
 | 
			
		||||
 | 
			
		||||
        for (const note of resp.notes) {
 | 
			
		||||
            if (note.type === 'search') {
 | 
			
		||||
                const searchResults = await server.get('search-note/' + note.noteId);
 | 
			
		||||
 | 
			
		||||
                // force to load all the notes at once instead of one by one
 | 
			
		||||
                await treeCache.getNotes(searchResults.map(res => res.noteId));
 | 
			
		||||
 | 
			
		||||
                const branches = resp.branches.filter(b => b.noteId === note.noteId || b.parentNoteId === note.noteId);
 | 
			
		||||
 | 
			
		||||
                searchResults.forEach((result, index) => branches.push({
 | 
			
		||||
                    // branchId should be repeatable since sometimes we reload some notes without rerendering the tree
 | 
			
		||||
                    branchId: "virt" + result.noteId + '-' + note.noteId,
 | 
			
		||||
                    noteId: result.noteId,
 | 
			
		||||
                    parentNoteId: note.noteId,
 | 
			
		||||
                    prefix: treeCache.getBranch(result.branchId).prefix,
 | 
			
		||||
                    notePosition: (index + 1) * 10
 | 
			
		||||
                }));
 | 
			
		||||
 | 
			
		||||
                // update this note with standard (parent) branches + virtual (children) branches
 | 
			
		||||
                treeCache.addResp([note], branches);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** @return {Promise<NoteShort[]>} */
 | 
			
		||||
@@ -109,9 +132,7 @@ class TreeCache {
 | 
			
		||||
        const missingNoteIds = noteIds.filter(noteId => this.notes[noteId] === undefined);
 | 
			
		||||
 | 
			
		||||
        if (missingNoteIds.length > 0) {
 | 
			
		||||
            const resp = await server.post('tree/load', { noteIds: missingNoteIds });
 | 
			
		||||
 | 
			
		||||
            this.addResp(resp.notes, resp.branches);
 | 
			
		||||
            await this.reloadNotes(missingNoteIds);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return noteIds.map(noteId => {
 | 
			
		||||
 
 | 
			
		||||
@@ -26,8 +26,8 @@ class TreeContextMenu {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async getContextMenuItems() {
 | 
			
		||||
        const branch = treeCache.getBranch(this.node.data.branchId);
 | 
			
		||||
        const note = await treeCache.getNote(this.node.data.noteId);
 | 
			
		||||
        const branch = treeCache.getBranch(this.node.data.branchId);
 | 
			
		||||
        const parentNote = await treeCache.getNote(branch.parentNoteId);
 | 
			
		||||
        const isNotRoot = note.noteId !== 'root';
 | 
			
		||||
        const isHoisted = note.noteId === await hoistedNoteService.getHoistedNoteId();
 | 
			
		||||
@@ -39,8 +39,9 @@ class TreeContextMenu {
 | 
			
		||||
        const noSelectedNotes = selNodes.length === 0
 | 
			
		||||
                || (selNodes.length === 1 && selNodes[0] === this.node);
 | 
			
		||||
 | 
			
		||||
        const insertNoteAfterEnabled = isNotRoot && !isHoisted && parentNote.type !== 'search';
 | 
			
		||||
        const insertChildNoteEnabled = note.type !== 'search';
 | 
			
		||||
        const notSearch = note.type !== 'search';
 | 
			
		||||
        const parentNotSearch = parentNote.type !== 'search';
 | 
			
		||||
        const insertNoteAfterEnabled = isNotRoot && !isHoisted && parentNotSearch;
 | 
			
		||||
 | 
			
		||||
        return [
 | 
			
		||||
            { title: "Open in new tab", cmd: "openInTab", uiIcon: "empty", enabled: noSelectedNotes },
 | 
			
		||||
@@ -48,15 +49,15 @@ class TreeContextMenu {
 | 
			
		||||
                items: insertNoteAfterEnabled ? this.getNoteTypeItems("insertNoteAfter") : null,
 | 
			
		||||
                enabled: insertNoteAfterEnabled && noSelectedNotes },
 | 
			
		||||
            { title: "Insert child note <kbd>Ctrl+P</kbd>", cmd: "insertChildNote", uiIcon: "plus",
 | 
			
		||||
                items: insertChildNoteEnabled ? this.getNoteTypeItems("insertChildNote") : null,
 | 
			
		||||
                enabled: insertChildNoteEnabled && noSelectedNotes },
 | 
			
		||||
                items: notSearch ? this.getNoteTypeItems("insertChildNote") : null,
 | 
			
		||||
                enabled: notSearch && noSelectedNotes },
 | 
			
		||||
            { title: "Delete <kbd>Delete</kbd>", cmd: "delete", uiIcon: "trash",
 | 
			
		||||
                enabled: isNotRoot && !isHoisted && parentNote.type !== 'search' },
 | 
			
		||||
                enabled: isNotRoot && !isHoisted && parentNotSearch },
 | 
			
		||||
            { title: "----" },
 | 
			
		||||
            isHoisted ? null : { title: "Hoist note <kbd>Ctrl-H</kbd>", cmd: "hoist", uiIcon: "empty", enabled: noSelectedNotes },
 | 
			
		||||
            isHoisted ? null : { title: "Hoist note <kbd>Ctrl-H</kbd>", cmd: "hoist", uiIcon: "empty", enabled: noSelectedNotes && notSearch },
 | 
			
		||||
            !isHoisted || !isNotRoot ? null : { title: "Unhoist note <kbd>Ctrl-H</kbd>", cmd: "unhoist", uiIcon: "arrow-up" },
 | 
			
		||||
            { title: "Edit branch prefix <kbd>F2</kbd>", cmd: "editBranchPrefix", uiIcon: "empty",
 | 
			
		||||
                enabled: isNotRoot && parentNote.type !== 'search' && noSelectedNotes},
 | 
			
		||||
                enabled: isNotRoot && parentNotSearch && noSelectedNotes},
 | 
			
		||||
            { title: "----" },
 | 
			
		||||
            { title: "Protect subtree", cmd: "protectSubtree", uiIcon: "shield-check", enabled: noSelectedNotes },
 | 
			
		||||
            { title: "Unprotect subtree", cmd: "unprotectSubtree", uiIcon: "shield-close", enabled: noSelectedNotes },
 | 
			
		||||
@@ -64,22 +65,22 @@ class TreeContextMenu {
 | 
			
		||||
            { title: "Copy / clone <kbd>Ctrl+C</kbd>", cmd: "copy", uiIcon: "files",
 | 
			
		||||
                enabled: isNotRoot },
 | 
			
		||||
            { title: "Cut <kbd>Ctrl+X</kbd>", cmd: "cut", uiIcon: "scissors",
 | 
			
		||||
                enabled: isNotRoot },
 | 
			
		||||
                enabled: isNotRoot && !isHoisted && parentNotSearch },
 | 
			
		||||
            { title: "Paste into <kbd>Ctrl+V</kbd>", cmd: "pasteInto", uiIcon: "clipboard",
 | 
			
		||||
                enabled: !clipboard.isEmpty() && note.type !== 'search' && noSelectedNotes },
 | 
			
		||||
                enabled: !clipboard.isEmpty() && notSearch && noSelectedNotes },
 | 
			
		||||
            { title: "Paste after", cmd: "pasteAfter", uiIcon: "clipboard",
 | 
			
		||||
                enabled: !clipboard.isEmpty() && isNotRoot && parentNote.type !== 'search' && noSelectedNotes },
 | 
			
		||||
                enabled: !clipboard.isEmpty() && isNotRoot && parentNotSearch && noSelectedNotes },
 | 
			
		||||
            { title: "Duplicate note here", cmd: "duplicateNote", uiIcon: "empty",
 | 
			
		||||
                enabled: noSelectedNotes && (!note.isProtected || protectedSessionHolder.isProtectedSessionAvailable()) },
 | 
			
		||||
                enabled: noSelectedNotes && parentNotSearch && (!note.isProtected || protectedSessionHolder.isProtectedSessionAvailable()) },
 | 
			
		||||
            { title: "----" },
 | 
			
		||||
            { title: "Export", cmd: "export", uiIcon: "empty",
 | 
			
		||||
                enabled: note.type !== 'search' && noSelectedNotes },
 | 
			
		||||
                enabled: notSearch && noSelectedNotes },
 | 
			
		||||
            { title: "Import into note", cmd: "importIntoNote", uiIcon: "empty",
 | 
			
		||||
                enabled: note.type !== 'search' && noSelectedNotes },
 | 
			
		||||
                enabled: notSearch && noSelectedNotes },
 | 
			
		||||
            { title: "----" },
 | 
			
		||||
            { title: "Collapse subtree <kbd>Alt+-</kbd>", cmd: "collapseSubtree", uiIcon: "align-justify", enabled: noSelectedNotes },
 | 
			
		||||
            { title: "Force note sync", cmd: "forceNoteSync", uiIcon: "refresh", enabled: noSelectedNotes },
 | 
			
		||||
            { title: "Sort alphabetically <kbd>Alt+S</kbd>", cmd: "sortAlphabetically", uiIcon: "empty", enabled: noSelectedNotes }
 | 
			
		||||
            { title: "Sort alphabetically <kbd>Alt+S</kbd>", cmd: "sortAlphabetically", uiIcon: "empty", enabled: noSelectedNotes && notSearch }
 | 
			
		||||
        ].filter(row => row !== null);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ import treeChangesService from "./branches.js";
 | 
			
		||||
import treeService from "./tree.js";
 | 
			
		||||
import hoistedNoteService from "./hoisted_note.js";
 | 
			
		||||
import clipboard from "./clipboard.js";
 | 
			
		||||
import treeCache from "./tree_cache.js";
 | 
			
		||||
 | 
			
		||||
const keyBindings = {
 | 
			
		||||
    "del": node => {
 | 
			
		||||
@@ -130,12 +131,16 @@ const keyBindings = {
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "ctrl+h": node => {
 | 
			
		||||
        hoistedNoteService.getHoistedNoteId().then(hoistedNoteId => {
 | 
			
		||||
        hoistedNoteService.getHoistedNoteId().then(async hoistedNoteId => {
 | 
			
		||||
            if (node.data.noteId === hoistedNoteId) {
 | 
			
		||||
                hoistedNoteService.unhoist();
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                hoistedNoteService.setHoistedNoteId(node.data.noteId);
 | 
			
		||||
                const note = await treeCache.getNote(node.data.noteId);
 | 
			
		||||
 | 
			
		||||
                if (note.type !== 'search') {
 | 
			
		||||
                    hoistedNoteService.setHoistedNoteId(node.data.noteId);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -29,6 +29,7 @@ class LinkMapWidget extends StandardWidget {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async doRenderBody() {
 | 
			
		||||
        this.$body.css('opacity', 0);
 | 
			
		||||
        this.$body.html(TPL);
 | 
			
		||||
 | 
			
		||||
        const $linkMapContainer = this.$body.find('.link-map-container');
 | 
			
		||||
@@ -43,6 +44,8 @@ class LinkMapWidget extends StandardWidget {
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await this.linkMapService.render();
 | 
			
		||||
 | 
			
		||||
        this.$body.animate({opacity: 1}, 300);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    cleanup() {
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,9 @@ async function update(name, value) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    log.info(`Updating option ${name} to ${value}`);
 | 
			
		||||
    if (name !== 'openTabs') {
 | 
			
		||||
        log.info(`Updating option ${name} to ${value}`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    await optionService.setOption(name, value);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
module.exports = { buildDate:"2019-10-31T22:04:44+01:00", buildRevision: "f1a7fce277d963977b73e3d183d700021781e913" };
 | 
			
		||||
module.exports = { buildDate:"2019-11-05T21:49:16+01:00", buildRevision: "72fda89360d924aedf7a26216fd387346254dfd3" };
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user