mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	Merge branch 'stable'
This commit is contained in:
		| @@ -1240,6 +1240,143 @@ | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="addTextToActiveTabEditor"><span class="type-signature"></span>addTextToActiveTabEditor<span class="signature">(text)</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Adds given text to the editor cursor | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Parameters:</h5> | ||||
|      | ||||
|  | ||||
| <table class="params"> | ||||
|     <thead> | ||||
|     <tr> | ||||
|          | ||||
|         <th>Name</th> | ||||
|          | ||||
|  | ||||
|         <th>Type</th> | ||||
|  | ||||
|          | ||||
|  | ||||
|          | ||||
|  | ||||
|         <th class="last">Description</th> | ||||
|     </tr> | ||||
|     </thead> | ||||
|  | ||||
|     <tbody> | ||||
|      | ||||
|  | ||||
|         <tr> | ||||
|              | ||||
|                 <td class="name"><code>text</code></td> | ||||
|              | ||||
|  | ||||
|             <td class="type"> | ||||
|              | ||||
|                  | ||||
| <span class="param-type">string</span> | ||||
|  | ||||
|  | ||||
|              | ||||
|             </td> | ||||
|  | ||||
|              | ||||
|  | ||||
|              | ||||
|  | ||||
|             <td class="description last"></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#line305">line 305</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
| @@ -1366,7 +1503,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#line390">line 390</a> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line406">line 406</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1785,7 +1922,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#line303">line 303</a> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line311">line 311</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1891,7 +2028,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#line309">line 309</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> | ||||
|      | ||||
|  | ||||
| @@ -1949,6 +2086,119 @@ | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="getActiveTabTextEditor"><span class="type-signature"></span>getActiveTabTextEditor<span class="signature">()</span><span class="type-signature"> → {Editor|null}</span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line319">line 319</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <h5>Returns:</h5> | ||||
|  | ||||
|          | ||||
| <div class="param-desc"> | ||||
|     CKEditor instance or null (e.g. if active note is not a text note) | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl> | ||||
|     <dt> | ||||
|         Type | ||||
|     </dt> | ||||
|     <dd> | ||||
|          | ||||
| <span class="param-type">Editor</span> | ||||
| | | ||||
|  | ||||
| <span class="param-type">null</span> | ||||
|  | ||||
|  | ||||
|     </dd> | ||||
| </dl> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="getDateNote"><span class="type-signature"></span>getDateNote<span class="signature">(date)</span><span class="type-signature"> → {Promise.<<a href="NoteShort.html">NoteShort</a>>}</span></h4> | ||||
|      | ||||
|  | ||||
| @@ -2050,7 +2300,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#line356">line 356</a> | ||||
|         <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> | ||||
|      | ||||
|  | ||||
| @@ -2312,7 +2562,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#line365">line 365</a> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line381">line 381</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -2775,7 +3025,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#line347">line 347</a> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line363">line 363</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -2930,7 +3180,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#line374">line 374</a> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line390">line 390</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -3039,7 +3289,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#line320">line 320</a> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line336">line 336</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -3194,7 +3444,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#line328">line 328</a> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line344">line 344</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -3433,7 +3683,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#line339">line 339</a> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line355">line 355</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -4606,7 +4856,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#line383">line 383</a> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line399">line 399</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -4757,7 +5007,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#line334">line 334</a> | ||||
|         <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> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -5123,7 +5373,7 @@ Typical use case is when new note has been created, we should wait until it is s | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#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#line417">line 417</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|   | ||||
| @@ -324,12 +324,28 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte | ||||
|      */ | ||||
|     this.createNoteLink = linkService.createNoteLink; | ||||
|  | ||||
|     /** | ||||
|      * Adds given text to the editor cursor | ||||
|      * | ||||
|      * @param {string} text | ||||
|      * @method | ||||
|      */ | ||||
|     this.addTextToActiveTabEditor = linkService.addTextToEditor; | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @returns {NoteFull} active note (loaded into right pane) | ||||
|      */ | ||||
|     this.getActiveTabNote = noteDetailService.getActiveTabNote; | ||||
|  | ||||
|     /** | ||||
|      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. | ||||
|      * | ||||
|      * @method | ||||
|      * @returns {Editor|null} CKEditor instance or null (e.g. if active note is not a text note) | ||||
|      */ | ||||
|     this.getActiveTabTextEditor = noteDetailService.getActiveEditor; | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @returns {Promise<string|null>} returns note path of active note or null if there isn't active note | ||||
|   | ||||
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "trilium", | ||||
|   "version": "0.39.3", | ||||
|   "version": "0.39.5", | ||||
|   "lockfileVersion": 1, | ||||
|   "requires": true, | ||||
|   "dependencies": { | ||||
|   | ||||
| @@ -806,7 +806,7 @@ class Note extends Entity { | ||||
|             WHERE noteId = ? AND  | ||||
|                   isDeleted = 0 AND  | ||||
|                   type = 'relation' AND  | ||||
|                   name IN ('internalLink', 'imageLink', 'relationMapLink')`, [this.noteId]); | ||||
|                   name IN ('internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink')`, [this.noteId]); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -6,7 +6,7 @@ const TPL = ` | ||||
| <div> | ||||
|     <h4>Spell check</h4> | ||||
|  | ||||
|     <p>These options apply only for desktop builds, browsers will use their own native spell check.</p> | ||||
|     <p>These options apply only for desktop builds, browsers will use their own native spell check. App restart is required after change.</p> | ||||
|  | ||||
|     <div class="custom-control custom-checkbox"> | ||||
|         <input type="checkbox" class="custom-control-input" id="spell-check-enabled"> | ||||
|   | ||||
| @@ -296,12 +296,28 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte | ||||
|      */ | ||||
|     this.createNoteLink = linkService.createNoteLink; | ||||
|  | ||||
|     /** | ||||
|      * Adds given text to the editor cursor | ||||
|      * | ||||
|      * @param {string} text - this must be clear text, HTML is not supported. | ||||
|      * @method | ||||
|      */ | ||||
|     this.addTextToActiveTabEditor = linkService.addTextToEditor; | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @returns {NoteFull} active note (loaded into right pane) | ||||
|      */ | ||||
|     this.getActiveTabNote = noteDetailService.getActiveTabNote; | ||||
|  | ||||
|     /** | ||||
|      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. | ||||
|      * | ||||
|      * @method | ||||
|      * @returns {Editor|null} CKEditor instance or null (e.g. if active note is not a text note) | ||||
|      */ | ||||
|     this.getActiveTabTextEditor = noteDetailService.getActiveEditor; | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @returns {Promise<string|null>} returns note path of active note or null if there isn't active note | ||||
|   | ||||
| @@ -3,15 +3,16 @@ import optionsService from "./options.js"; | ||||
| export async function initSpellCheck() { | ||||
|     const options = await optionsService.waitForOptions(); | ||||
|  | ||||
|     if (!options.is('spellCheckEnabled')) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     const {SpellCheckHandler, ContextMenuListener, ContextMenuBuilder} = require('electron-spellchecker'); | ||||
|     const {remote, shell} = require('electron'); | ||||
|  | ||||
|     const spellCheckHandler = new SpellCheckHandler(); | ||||
|  | ||||
|     // not fully disabling the spellcheck since we want to preserve the context menu | ||||
|     // this will just get rid of the "red squiggles" | ||||
|     if (options.is('spellCheckEnabled')) { | ||||
|         spellCheckHandler.attachToInput(); | ||||
|     } | ||||
|  | ||||
|     spellCheckHandler.switchLanguage(options.get('spellCheckLanguageCode')); | ||||
|  | ||||
|   | ||||
| @@ -147,7 +147,7 @@ async function importTar(taskContext, fileBuffer, importRootNote) { | ||||
|                 continue; | ||||
|             } | ||||
|  | ||||
|             if (attr.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink'].includes(attr.name)) { | ||||
|             if (attr.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(attr.name)) { | ||||
|                 // these relations are created automatically and as such don't need to be duplicated in the import | ||||
|                 continue; | ||||
|             } | ||||
|   | ||||
| @@ -242,6 +242,20 @@ function findInternalLinks(content, foundLinks) { | ||||
|     return content.replace(/href="[^"]*#root/g, 'href="#root'); | ||||
| } | ||||
|  | ||||
| function findIncludeNoteLinks(content, foundLinks) { | ||||
|     const re = /<section class="include-note" data-note-id="([a-zA-Z0-9]+)">/g; | ||||
|     let match; | ||||
|  | ||||
|     while (match = re.exec(content)) { | ||||
|         foundLinks.push({ | ||||
|             name: 'includeNoteLink', | ||||
|             value: match[1] | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     return content; | ||||
| } | ||||
|  | ||||
| function findRelationMapLinks(content, foundLinks) { | ||||
|     const obj = JSON.parse(content); | ||||
|  | ||||
| @@ -263,10 +277,11 @@ async function saveLinks(note, content) { | ||||
|     } | ||||
|  | ||||
|     const foundLinks = []; | ||||
|  | ||||
| console.log("Scanning", content); | ||||
|     if (note.type === 'text') { | ||||
|         content = findImageLinks(content, foundLinks); | ||||
|         content = findInternalLinks(content, foundLinks); | ||||
|         content = findIncludeNoteLinks(content, foundLinks); | ||||
|     } | ||||
|     else if (note.type === 'relation-map') { | ||||
|         findRelationMapLinks(content, foundLinks); | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|                 </button> | ||||
|             </div> | ||||
|             <div class="modal-body"> | ||||
|                 <table class="table"> | ||||
|                 <table class="table table-borderless"> | ||||
|                     <tr> | ||||
|                         <th>Homepage:</th> | ||||
|                         <td><a href="https://github.com/zadam/trilium" class="external">https://github.com/zadam/trilium</a></td> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user