mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	refactoring, tab switching handling shouldn't be on the widget level
This commit is contained in:
		| @@ -1388,7 +1388,7 @@ larger amounts of data and generally not accessible to the user.</div> | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="becca_entities_battachment.js.html">becca/entities/battachment.js</a>, <a href="becca_entities_battachment.js.html#line134">line 134</a> |         <a href="becca_entities_battachment.js.html">becca/entities/battachment.js</a>, <a href="becca_entities_battachment.js.html#line139">line 139</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1770,7 +1770,7 @@ larger amounts of data and generally not accessible to the user.</div> | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="becca_entities_battachment.js.html">becca/entities/battachment.js</a>, <a href="becca_entities_battachment.js.html#line119">line 119</a> |         <a href="becca_entities_battachment.js.html">becca/entities/battachment.js</a>, <a href="becca_entities_battachment.js.html#line124">line 124</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2815,7 +2815,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and ' | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <dd class="tag-source"><ul class="dummy"><li> | ||||||
|         <a href="becca_entities_battachment.js.html">becca/entities/battachment.js</a>, <a href="becca_entities_battachment.js.html#line129">line 129</a> |         <a href="becca_entities_battachment.js.html">becca/entities/battachment.js</a>, <a href="becca_entities_battachment.js.html#line134">line 134</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
|   | |||||||
| @@ -132,7 +132,12 @@ class BAttachment extends AbstractBeccaEntity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     decrypt() { |     decrypt() { | ||||||
|         if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) { |         if (!this.isProtected || !this.attachmentId) { | ||||||
|  |             this.isDecrypted = true; | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (!this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) { | ||||||
|             try { |             try { | ||||||
|                 this.title = protectedSessionService.decryptString(this.title); |                 this.title = protectedSessionService.decryptString(this.title); | ||||||
|                 this.isDecrypted = true; |                 this.isDecrypted = true; | ||||||
|   | |||||||
| @@ -1738,7 +1738,7 @@ See <a href="https://day.js.org">https://day.js.org</a> for documentation | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line490">line 490</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line514">line 514</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2469,7 +2469,7 @@ See <a href="https://day.js.org">https://day.js.org</a> for documentation | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line534">line 534</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line558">line 558</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2624,7 +2624,7 @@ See <a href="https://day.js.org">https://day.js.org</a> for documentation | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line526">line 526</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line550">line 550</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2682,6 +2682,112 @@ See <a href="https://day.js.org">https://day.js.org</a> for documentation | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|  |     <h4 class="name" id="getActiveContext"><span class="type-signature"></span>getActiveContext<span class="signature">()</span><span class="type-signature"> → {NoteContext}</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#line360">line 360</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  | <div class="param-desc"> | ||||||
|  |     - returns active context (split) | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">NoteContext</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|     <h4 class="name" id="getActiveContextCodeEditor"><span class="type-signature"></span>getActiveContextCodeEditor<span class="signature">()</span><span class="type-signature"> → {Promise.<CodeMirror>}</span></h4> |     <h4 class="name" id="getActiveContextCodeEditor"><span class="type-signature"></span>getActiveContextCodeEditor<span class="signature">()</span><span class="type-signature"> → {Promise.<CodeMirror>}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2734,7 +2840,7 @@ See <a href="https://day.js.org">https://day.js.org</a> for documentation | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line370">line 370</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line394">line 394</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2869,7 +2975,7 @@ See <a href="https://day.js.org">https://day.js.org</a> for documentation | |||||||
|  |  | ||||||
|          |          | ||||||
| <div class="param-desc"> | <div class="param-desc"> | ||||||
|     active note (loaded into right pane) |     active note (loaded into center pane) | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -2946,7 +3052,7 @@ See <a href="https://day.js.org">https://day.js.org</a> for documentation | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line385">line 385</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line409">line 409</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3056,7 +3162,7 @@ See <a href="https://day.js.org">https://day.js.org</a> for documentation | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line362">line 362</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line386">line 386</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3114,6 +3220,112 @@ See <a href="https://day.js.org">https://day.js.org</a> for documentation | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|  |     <h4 class="name" id="getActiveMainContext"><span class="type-signature"></span>getActiveMainContext<span class="signature">()</span><span class="type-signature"> → {NoteContext}</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#line366">line 366</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  | <div class="param-desc"> | ||||||
|  |     - returns active main context (first split in a tab, represents the tab as a whole) | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">NoteContext</span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|     <h4 class="name" id="getActiveNoteDetailWidget"><span class="type-signature"></span>getActiveNoteDetailWidget<span class="signature">()</span><span class="type-signature"> → {Promise.<NoteDetailWidget>}</span></h4> |     <h4 class="name" id="getActiveNoteDetailWidget"><span class="type-signature"></span>getActiveNoteDetailWidget<span class="signature">()</span><span class="type-signature"> → {Promise.<NoteDetailWidget>}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3167,7 +3379,7 @@ implementation of actual widget type. | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line379">line 379</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line403">line 403</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3322,7 +3534,7 @@ implementation of actual widget type. | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line394">line 394</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line418">line 418</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3477,7 +3689,7 @@ implementation of actual widget type. | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line438">line 438</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> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3638,6 +3850,112 @@ if some action needs to happen on only one specific instance. | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|  |     <h4 class="name" id="getMainNoteContexts"><span class="type-signature"></span>getMainNoteContexts<span class="signature">()</span><span class="type-signature"> → {Array.<NoteContext>}</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#line378">line 378</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  | <div class="param-desc"> | ||||||
|  |     - returns all main contexts representing tabs | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">Array.<NoteContext></span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|     <h4 class="name" id="getMonthNote"><span class="type-signature"></span>getMonthNote<span class="signature">(month)</span><span class="type-signature"> → {Promise.<<a href="FNote.html">FNote</a>>}</span></h4> |     <h4 class="name" id="getMonthNote"><span class="type-signature"></span>getMonthNote<span class="signature">(month)</span><span class="type-signature"> → {Promise.<<a href="FNote.html">FNote</a>>}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3739,7 +4057,7 @@ if some action needs to happen on only one specific instance. | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line456">line 456</a> |         <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> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3949,6 +4267,112 @@ if some action needs to happen on only one specific instance. | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|  |     <h4 class="name" id="getNoteContexts"><span class="type-signature"></span>getNoteContexts<span class="signature">()</span><span class="type-signature"> → {Array.<NoteContext>}</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#line372">line 372</a> | ||||||
|  |     </li></ul></dd> | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h5>Returns:</h5> | ||||||
|  |  | ||||||
|  |          | ||||||
|  | <div class="param-desc"> | ||||||
|  |     - returns all note contexts (splits) in all tabs | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <dl> | ||||||
|  |     <dt> | ||||||
|  |         Type | ||||||
|  |     </dt> | ||||||
|  |     <dd> | ||||||
|  |          | ||||||
|  | <span class="param-type">Array.<NoteContext></span> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </dd> | ||||||
|  | </dl> | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          | ||||||
|  |              | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |      | ||||||
|     <h4 class="name" id="getNotes"><span class="type-signature"></span>getNotes<span class="signature">(noteIds, silentNotFoundError<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<Array.<<a href="FNote.html">FNote</a>>>}</span></h4> |     <h4 class="name" id="getNotes"><span class="type-signature"></span>getNotes<span class="signature">(noteIds, silentNotFoundError<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<Array.<<a href="FNote.html">FNote</a>>>}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4202,7 +4626,7 @@ otherwise (by e.g. createLink()) | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line429">line 429</a> |         <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> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4357,7 +4781,7 @@ otherwise (by e.g. createLink()) | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line447">line 447</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> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4512,7 +4936,7 @@ otherwise (by e.g. createLink()) | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line465">line 465</a> |         <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> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4662,7 +5086,7 @@ otherwise (by e.g. createLink()) | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line545">line 545</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line569">line 569</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -5347,7 +5771,7 @@ otherwise (by e.g. createLink()) | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line409">line 409</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line433">line 433</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -5521,7 +5945,7 @@ otherwise (by e.g. createLink()) | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line419">line 419</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line443">line 443</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -5676,7 +6100,7 @@ otherwise (by e.g. createLink()) | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line519">line 519</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line543">line 543</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -5830,7 +6254,7 @@ otherwise (by e.g. createLink()) | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line510">line 510</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line534">line 534</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -6620,7 +7044,7 @@ Internally this serializes the anonymous function into string and sends it to ba | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line474">line 474</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line498">line 498</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -6771,7 +7195,7 @@ Internally this serializes the anonymous function into string and sends it to ba | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line401">line 401</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line425">line 425</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -7475,7 +7899,7 @@ Typical use case is when a new note has been created, we should wait until it is | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line526">line 526</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
|   | |||||||
| @@ -377,10 +377,34 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @returns {FNote} active note (loaded into right pane) |      * @returns {FNote} active note (loaded into center pane) | ||||||
|      */ |      */ | ||||||
|     this.getActiveContextNote = () => appContext.tabManager.getActiveContextNote(); |     this.getActiveContextNote = () => appContext.tabManager.getActiveContextNote(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @method | ||||||
|  |      * @returns {NoteContext} - returns active context (split) | ||||||
|  |      */ | ||||||
|  |     this.getActiveContext = () => appContext.tabManager.getActiveContext(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @method | ||||||
|  |      * @returns {NoteContext} - returns active main context (first split in a tab, represents the tab as a whole) | ||||||
|  |      */ | ||||||
|  |     this.getActiveMainContext = () => appContext.tabManager.getActiveMainContext(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @method | ||||||
|  |      * @returns {NoteContext[]} - returns all note contexts (splits) in all tabs | ||||||
|  |      */ | ||||||
|  |     this.getNoteContexts = () => appContext.tabManager.getNoteContexts(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @method | ||||||
|  |      * @returns {NoteContext[]} - returns all main contexts representing tabs | ||||||
|  |      */ | ||||||
|  |     this.getMainNoteContexts = () => appContext.tabManager.getMainNoteContexts(); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for documentation on the returned instance. |      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for documentation on the returned instance. | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -105,11 +105,24 @@ class NoteContext extends Component { | |||||||
|         return appContext.tabManager.noteContexts.filter(nc => nc.ntxId === this.ntxId || nc.mainNtxId === this.ntxId); |         return appContext.tabManager.noteContexts.filter(nc => nc.ntxId === this.ntxId || nc.mainNtxId === this.ntxId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * A main context represents a tab and also the first split. Further splits are the children contexts of the main context. | ||||||
|  |      * Imagine you have a tab with 3 splits, each showing notes A, B, C (in this order). | ||||||
|  |      * In such a scenario, A context is the main context (also representing the tab as a whole), and B, C are the children | ||||||
|  |      * of context A. | ||||||
|  |      * | ||||||
|  |      * @returns {boolean} true if the context is main (= tab) | ||||||
|  |      */ | ||||||
|     isMainContext() { |     isMainContext() { | ||||||
|         // if null, then this is a main context |         // if null, then this is a main context | ||||||
|         return !this.mainNtxId; |         return !this.mainNtxId; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * See docs for isMainContext() for better explanation. | ||||||
|  |      * | ||||||
|  |      * @returns {NoteContext} | ||||||
|  |      */ | ||||||
|     getMainContext() { |     getMainContext() { | ||||||
|         if (this.mainNtxId) { |         if (this.mainNtxId) { | ||||||
|             try { |             try { | ||||||
|   | |||||||
| @@ -154,4 +154,24 @@ export default class RootCommandExecutor extends Component { | |||||||
|             }); |             }); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     firstTabCommand() {this.#goToTab(1);} | ||||||
|  |     secondTabCommand() {this.#goToTab(2);} | ||||||
|  |     thirdTabCommand() {this.#goToTab(3);} | ||||||
|  |     fourthTabCommand() {this.#goToTab(4);} | ||||||
|  |     fifthTabCommand() {this.#goToTab(5);} | ||||||
|  |     sixthTabCommand() {this.#goToTab(6);} | ||||||
|  |     seventhTabCommand() {this.#goToTab(7);} | ||||||
|  |     eigthTabCommand() {this.#goToTab(8);} | ||||||
|  |     ninthTabCommand() {this.#goToTab(9);} | ||||||
|  |     lastTabCommand() {this.#goToTab(Number.POSITIVE_INFINITY);} | ||||||
|  |  | ||||||
|  |     #goToTab(tabNumber) { | ||||||
|  |         const mainNoteContexts = appContext.tabManager.getMainNoteContexts(); | ||||||
|  |  | ||||||
|  |         const index = tabNumber === Number.POSITIVE_INFINITY ? mainNoteContexts.length - 1 : tabNumber - 1; | ||||||
|  |         const tab = mainNoteContexts[index]; | ||||||
|  |  | ||||||
|  |         appContext.tabManager.activateNoteContext(tab.ntxId); | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -173,7 +173,10 @@ export default class TabManager extends Component { | |||||||
|         return this.noteContexts; |         return this.noteContexts; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @returns {NoteContext[]} */ |     /** | ||||||
|  |      * Main context is essentially a tab (children are splits), so this returns tabs. | ||||||
|  |      * @returns {NoteContext[]} | ||||||
|  |      */ | ||||||
|     getMainNoteContexts() { |     getMainNoteContexts() { | ||||||
|         return this.noteContexts.filter(nc => nc.isMainContext()); |         return this.noteContexts.filter(nc => nc.isMainContext()); | ||||||
|     } |     } | ||||||
| @@ -189,14 +192,22 @@ export default class TabManager extends Component { | |||||||
|         return noteContext; |         return noteContext; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @returns {NoteContext} */ |     /** | ||||||
|  |      * Get active context which represents the visible split with focus. Active context can, but doesn't have to be "main". | ||||||
|  |      * | ||||||
|  |      * @returns {NoteContext} | ||||||
|  |      */ | ||||||
|     getActiveContext() { |     getActiveContext() { | ||||||
|         return this.activeNtxId |         return this.activeNtxId | ||||||
|             ? this.getNoteContextById(this.activeNtxId) |             ? this.getNoteContextById(this.activeNtxId) | ||||||
|             : null; |             : null; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @returns {NoteContext} */ |     /** | ||||||
|  |      * Get active main context which corresponds to the active tab. | ||||||
|  |      * | ||||||
|  |      * @returns {NoteContext} | ||||||
|  |      */ | ||||||
|     getActiveMainContext() { |     getActiveMainContext() { | ||||||
|         return this.activeNtxId |         return this.activeNtxId | ||||||
|             ? this.getNoteContextById(this.activeNtxId).getMainContext() |             ? this.getNoteContextById(this.activeNtxId).getMainContext() | ||||||
|   | |||||||
| @@ -349,10 +349,34 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @returns {FNote} active note (loaded into right pane) |      * @returns {FNote} active note (loaded into center pane) | ||||||
|      */ |      */ | ||||||
|     this.getActiveContextNote = () => appContext.tabManager.getActiveContextNote(); |     this.getActiveContextNote = () => appContext.tabManager.getActiveContextNote(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @method | ||||||
|  |      * @returns {NoteContext} - returns active context (split) | ||||||
|  |      */ | ||||||
|  |     this.getActiveContext = () => appContext.tabManager.getActiveContext(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @method | ||||||
|  |      * @returns {NoteContext} - returns active main context (first split in a tab, represents the tab as a whole) | ||||||
|  |      */ | ||||||
|  |     this.getActiveMainContext = () => appContext.tabManager.getActiveMainContext(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @method | ||||||
|  |      * @returns {NoteContext[]} - returns all note contexts (splits) in all tabs | ||||||
|  |      */ | ||||||
|  |     this.getNoteContexts = () => appContext.tabManager.getNoteContexts(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * @method | ||||||
|  |      * @returns {NoteContext[]} - returns all main contexts representing tabs | ||||||
|  |      */ | ||||||
|  |     this.getMainNoteContexts = () => appContext.tabManager.getMainNoteContexts(); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for documentation on the returned instance. |      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for documentation on the returned instance. | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -267,28 +267,8 @@ export default class TabRowWidget extends BasicWidget { | |||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         keyboardActionService.setupActionsForElement('window', $(document), this); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     goToTab(tabNumber) { |  | ||||||
|         const index = tabNumber === Number.POSITIVE_INFINITY ? this.tabEls.length - 1 : tabNumber - 1; |  | ||||||
|         const tab = this.tabEls[index]; |  | ||||||
|         if (!tab) return; |  | ||||||
|         appContext.tabManager.activateNoteContext(tab.getAttribute('data-ntx-id')); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     firstTabCommand() {this.goToTab(1);} |  | ||||||
|     secondTabCommand() {this.goToTab(2);} |  | ||||||
|     thirdTabCommand() {this.goToTab(3);} |  | ||||||
|     fourthTabCommand() {this.goToTab(4);} |  | ||||||
|     fifthTabCommand() {this.goToTab(5);} |  | ||||||
|     sixthTabCommand() {this.goToTab(6);} |  | ||||||
|     seventhTabCommand() {this.goToTab(7);} |  | ||||||
|     eigthTabCommand() {this.goToTab(8);} |  | ||||||
|     ninthTabCommand() {this.goToTab(9);} |  | ||||||
|     lastTabCommand() {this.goToTab(Number.POSITIVE_INFINITY);} |  | ||||||
|  |  | ||||||
|     setupStyle() { |     setupStyle() { | ||||||
|         this.$style = $("<style>"); |         this.$style = $("<style>"); | ||||||
|         this.$widget.append(this.$style); |         this.$widget.append(this.$style); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user