Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
removed link remnants
zadam242bea236f51
diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.htmlindex 4ffc94575c..2c8828dbbf 100644--- a/docs/backend_api/Note.html+++ b/docs/backend_api/Note.html@@ -1034,7 +1034,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line665">line 665</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line647">line 647</a></li></ul></dd>@@ -1136,7 +1136,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line693">line 693</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line675">line 675</a></li></ul></dd>@@ -1242,7 +1242,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line679">line 679</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line661">line 661</a></li></ul></dd>@@ -2987,112 +2987,6 @@- <h4 class="name" id="getLinksWithDeleted"><span class="type-signature">(async) </span>getLinksWithDeleted<span class="signature">()</span><span class="type-signature"> → {Promise.<Array.<Link>>}</span></h4>-------<div class="description">- Return all links from this note, including deleted ones.-</div>--------------<dl class="details">--------------------------- <dt class="tag-source">Source:</dt>- <dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line658">line 658</a>- </li></ul></dd>--------</dl>----------------<h5>Returns:</h5>-----<dl>- <dt>- Type- </dt>- <dd>--<span class="param-type">Promise.<Array.<Link>></span>--- </dd>-</dl>-------------<h4 class="name" id="getOwnedAttributes"><span class="type-signature">(async) </span>getOwnedAttributes<span class="signature">()</span><span class="type-signature"> → {Promise.<Array.<<a href="Attribute.html">Attribute</a>>>}</span></h4>@@ -3247,7 +3141,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line705">line 705</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line687">line 687</a></li></ul></dd>@@ -4482,112 +4376,6 @@- <h4 class="name" id="getTargetLinks"><span class="type-signature">(async) </span>getTargetLinks<span class="signature">()</span><span class="type-signature"> → {Promise.<Array.<Link>>}</span></h4>-------<div class="description">- Get list of links targetting this note.-</div>--------------<dl class="details">--------------------------- <dt class="tag-source">Source:</dt>- <dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line649">line 649</a>- </li></ul></dd>--------</dl>----------------<h5>Returns:</h5>-----<dl>- <dt>- Type- </dt>- <dd>--<span class="param-type">Promise.<Array.<Link>></span>--- </dd>-</dl>-------------<h4 class="name" id="getTargetRelations"><span class="type-signature">(async) </span>getTargetRelations<span class="signature">()</span><span class="type-signature"> → {Promise.<Array.<<a href="Attribute.html">Attribute</a>>>}</span></h4>@@ -4920,7 +4708,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line672">line 672</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line654">line 654</a></li></ul></dd>diff --git a/docs/backend_api/entities_note.js.html b/docs/backend_api/entities_note.js.htmlindex 1b350728b9..dcc2418d97 100644--- a/docs/backend_api/entities_note.js.html+++ b/docs/backend_api/entities_note.js.html@@ -669,24 +669,6 @@ class Note extends Entity {name IN ('internal-link', 'image-link', 'relation-map-link')`, [this.noteId]);}- /**- * Get list of links targetting this note.- *- * @returns {Promise<Link[]>}- */- async getTargetLinks() {- return await repository.getEntities("SELECT * FROM links WHERE targetNoteId = ? AND isDeleted = 0", [this.noteId]);- }-- /**- * Return all links from this note, including deleted ones.- *- * @returns {Promise<Link[]>}- */- async getLinksWithDeleted() {- return await repository.getEntities("SELECT * FROM links WHERE noteId = ?", [this.noteId]);- }-/*** @returns {Promise<Branch[]>}*/diff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.htmlindex 8e5438ee3a..9afc0aea4a 100644--- a/docs/backend_api/services_backend_script_api.js.html+++ b/docs/backend_api/services_backend_script_api.js.html@@ -38,7 +38,7 @@ const repository = require('./repository');const axios = require('axios');const dayjs = require('dayjs');const cloningService = require('./cloning');-const messagingService = require('./messaging');+const ws = require('./ws.js');const appInfo = require('./app_info');const searchService = require('./search');@@ -239,7 +239,7 @@ function BackendScriptApi(currentNote, apiParams) {this.createNoteAndRefresh = async function(parentNoteId, title, content, extraOptions) {await noteService.createNote(parentNoteId, title, content, extraOptions);- messagingService.refreshTree();+ ws.refreshTree();};/**@@ -335,7 +335,7 @@ function BackendScriptApi(currentNote, apiParams) {** @returns {Promise<void>}*/- this.refreshTree = messagingService.refreshTree;+ this.refreshTree = ws.refreshTree;/*** @return {{syncVersion, appVersion, buildRevision, dbVersion, dataDirectory, buildDate}|*} - object representing basic info about running Trilium versiondiff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.htmlindex b6a5c68574..58f9fcc866 100644--- a/docs/frontend_api/FrontendScriptApi.html+++ b/docs/frontend_api/FrontendScriptApi.html@@ -81,7 +81,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#line20">line 20</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line19">line 19</a></li></ul></dd>@@ -223,7 +223,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#line26">line 26</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line25">line 25</a></li></ul></dd>@@ -336,7 +336,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#line28">line 28</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line27">line 27</a></li></ul></dd>@@ -442,7 +442,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#line37">line 37</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line36">line 36</a></li></ul></dd>@@ -552,7 +552,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#line24">line 24</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line23">line 23</a></li></ul></dd>@@ -661,7 +661,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#line34">line 34</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line33">line 33</a></li></ul></dd>@@ -790,7 +790,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#line62">line 62</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line61">line 61</a></li></ul></dd>@@ -945,7 +945,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#line46">line 46</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line45">line 45</a></li></ul></dd>@@ -1100,7 +1100,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#line81">line 81</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line80">line 80</a></li></ul></dd>@@ -1280,7 +1280,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#line270">line 270</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line269">line 269</a></li></ul></dd>@@ -1413,7 +1413,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#line230">line 230</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line229">line 229</a></li></ul></dd>@@ -1519,7 +1519,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#line276">line 276</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>@@ -1625,7 +1625,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#line282">line 282</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>@@ -1784,7 +1784,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#line333">line 333</a>+ <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></li></ul></dd>@@ -1891,7 +1891,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#line223">line 223</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line222">line 222</a></li></ul></dd>@@ -2046,7 +2046,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#line342">line 342</a>+ <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></li></ul></dd>@@ -2202,7 +2202,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#line191">line 191</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line190">line 190</a></li></ul></dd>@@ -2403,7 +2403,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#line203">line 203</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line202">line 202</a></li></ul></dd>@@ -2509,7 +2509,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#line324">line 324</a>+ <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></li></ul></dd>@@ -2664,7 +2664,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#line351">line 351</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line350">line 350</a></li></ul></dd>@@ -2773,7 +2773,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#line297">line 297</a>+ <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></li></ul></dd>@@ -2928,7 +2928,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#line305">line 305</a>+ <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></li></ul></dd>@@ -3061,7 +3061,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#line237">line 237</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line236">line 236</a></li></ul></dd>@@ -3167,7 +3167,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#line316">line 316</a>+ <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></li></ul></dd>@@ -3255,7 +3255,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#line261">line 261</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line260">line 260</a></li></ul></dd>@@ -3406,7 +3406,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#line209">line 209</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line208">line 208</a></li></ul></dd>@@ -3539,7 +3539,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#line215">line 215</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line214">line 214</a></li></ul></dd>@@ -3700,7 +3700,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#line131">line 131</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line130">line 130</a></li></ul></dd>@@ -3860,7 +3860,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#line179">line 179</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line178">line 178</a></li></ul></dd>@@ -4016,7 +4016,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#line161">line 161</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line160">line 160</a></li></ul></dd>@@ -4167,7 +4167,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#line311">line 311</a>+ <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></li></ul></dd>@@ -4304,7 +4304,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#line253">line 253</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line252">line 252</a></li></ul></dd>@@ -4441,7 +4441,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#line245">line 245</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line244">line 244</a></li></ul></dd>diff --git a/docs/frontend_api/global.html b/docs/frontend_api/global.htmlindex cb036d1f81..0a422518d4 100644--- a/docs/frontend_api/global.html+++ b/docs/frontend_api/global.html@@ -303,7 +303,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#line68">line 68</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line67">line 67</a></li></ul></dd>diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.htmlindex 40e144f138..74d1bb234a 100644--- a/docs/frontend_api/services_frontend_script_api.js.html+++ b/docs/frontend_api/services_frontend_script_api.js.html@@ -33,7 +33,6 @@ import infoService from './info.js';import linkService from './link.js';import treeCache from './tree_cache.js';import noteDetailService from './note_detail.js';-import noteTypeService from './note_type.js';import noteTooltipService from './note_tooltip.js';import protectedSessionService from './protected_session.js';import dateNotesService from './date_notes.js';diff --git a/src/entities/note.js b/src/entities/note.jsindex 39b3cbe9f0..c7426ecfb8 100644--- a/src/entities/note.js+++ b/src/entities/note.js@@ -641,24 +641,6 @@ class Note extends Entity {name IN ('internal-link', 'image-link', 'relation-map-link')`, [this.noteId]);}- /**- * Get list of links targetting this note.- *- * @returns {Promise<Link[]>}- */- async getTargetLinks() {- return await repository.getEntities("SELECT * FROM links WHERE targetNoteId = ? AND isDeleted = 0", [this.noteId]);- }-- /**- * Return all links from this note, including deleted ones.- *- * @returns {Promise<Link[]>}- */- async getLinksWithDeleted() {- return await repository.getEntities("SELECT * FROM links WHERE noteId = ?", [this.noteId]);- }-/*** @returns {Promise<Branch[]>}*/diff --git a/src/public/javascripts/dialogs/link_map.js b/src/public/javascripts/dialogs/link_map.jsindex 6f0ca6ba41..ffc69d5989 100644--- a/src/public/javascripts/dialogs/link_map.js+++ b/src/public/javascripts/dialogs/link_map.js@@ -1,30 +1,15 @@-import server from '../services/server.js';-import noteDetailService from "../services/note_detail.js";-import libraryLoader from "../services/library_loader.js";-import treeCache from "../services/tree_cache.js";-import linkService from "../services/link.js";import utils from "../services/utils.js";+import LinkMapService from "../services/link_map.js";+import noteDetailService from "../services/note_detail.js";const $linkMapContainer = $("#link-map-container");-const linkOverlays = [- [ "Arrow", {- location: 1,- id: "arrow",- length: 10,- width: 10,- foldback: 0.7- } ]-];-const LINK_TYPES = [ "hyper", "image", "relation", "relation-map" ];const $dialog = $("#link-map-dialog");const $maxNotesInput = $("#link-map-max-notes");-let jsPlumbInstance = null;-let pzInstance = null;-let renderer = null;+let linkMapService;export async function showDialog() {utils.closeActiveDialog();@@ -35,184 +20,18 @@ export async function showDialog() {$maxNotesInput.val(10);LINK_TYPES.forEach(lt => $("#link-map-" + lt).prop('checked', true));- await libraryLoader.requireLibrary(libraryLoader.LINK_MAP);-- jsPlumb.ready(() => {- initJsPlumbInstance();-- initPanZoom();-- loadNotesAndRelations();- });-- $dialog.modal();-}--async function loadNotesAndRelations() {- cleanup();-- const linkTypes = LINK_TYPES.filter(lt => $(`#link-map-${lt}:checked`).length > 0);- const maxNotes = parseInt($maxNotesInput.val());-- const activeNoteId = noteDetailService.getActiveNoteId();-- const links = await server.post(`notes/${activeNoteId}/link-map`, {- linkTypes,- maxNotes- });-- const noteIds = new Set(links.map(l => l.noteId).concat(links.map(l => l.targetNoteId)));-- if (noteIds.size === 0) {- noteIds.add(activeNoteId);- }-- // preload all notes- const notes = await treeCache.getNotes(Array.from(noteIds));-- const graph = new Springy.Graph();- graph.addNodes(...noteIds);- graph.addEdges(...links.map(l => [l.noteId, l.targetNoteId]));-- const layout = new Springy.Layout.ForceDirected(- graph,- 400.0, // Spring stiffness- 400.0, // Node repulsion- 0.5 // Damping- );-- function getNoteBox(noteId) {- const noteBoxId = noteIdToId(noteId);- const $existingNoteBox = $("#" + noteBoxId);-- if ($existingNoteBox.length > 0) {- return $existingNoteBox;- }-- const note = notes.find(n => n.noteId === noteId);-- const $noteBox = $("<div>")- .addClass("note-box")- .prop("id", noteBoxId);-- linkService.createNoteLink(noteId, note.title).then($link => {- $noteBox.append($("<span>").addClass("title").append($link));- });-- if (activeNoteId === noteId) {- $noteBox.addClass("link-map-active-note");- }-- jsPlumbInstance.getContainer().appendChild($noteBox[0]);-- jsPlumbInstance.draggable($noteBox[0], {- start: params => {- renderer.stop();- },- drag: params => {},- stop: params => {}- });--- return $noteBox;- }-- renderer = new Springy.Renderer(- layout,- () => {},- (edge, p1, p2) => {- const connectionId = edge.source.id + '-' + edge.target.id;-- if ($("#" + connectionId).length > 0) {- return;- }-- getNoteBox(edge.source.id);- getNoteBox(edge.target.id);-- const connection = jsPlumbInstance.connect({- source: noteIdToId(edge.source.id),- target: noteIdToId(edge.target.id),- type: 'link'- });-- connection.canvas.id = connectionId;- },- (node, p) => {- const $noteBox = getNoteBox(node.id);- const middleW = $linkMapContainer.width() / 2;- const middleH = $linkMapContainer.height() / 2;-- $noteBox- .css("left", (middleW + p.x * 100) + "px")- .css("top", (middleH + p.y * 100) + "px");- },- () => {},- () => {},- () => {- jsPlumbInstance.repaintEverything();- }- );-- renderer.start();-}--function initPanZoom() {- if (pzInstance) {- return;- }-- pzInstance = panzoom($linkMapContainer[0], {- maxZoom: 2,- minZoom: 0.3,- smoothScroll: false,- filterKey: function (e, dx, dy, dz) {- // if ALT is pressed then panzoom should bubble the event up- // this is to preserve ALT-LEFT, ALT-RIGHT navigation working- return e.altKey;- }- });-}--function cleanup() {- if (renderer) {- renderer.stop();- }-- // delete all endpoints and connections- // this is done at this point (after async operations) to reduce flicker to the minimum- jsPlumbInstance.deleteEveryEndpoint();-- // without this we still end up with note boxes remaining in the canvas- $linkMapContainer.empty();-- // reset zoom/pan- pzInstance.zoomTo(0, 0, 1);- pzInstance.moveTo(0, 0);-}--function initJsPlumbInstance() {- if (jsPlumbInstance) {- cleanup();+ const note = noteDetailService.getActiveNoteId();+ if (!note) {return;}- jsPlumbInstance = jsPlumb.getInstance({- Endpoint: ["Blank", {}],- ConnectionOverlays: linkOverlays,- PaintStyle: { stroke: "var(--muted-text-color)", strokeWidth: 1 },- HoverPaintStyle: { stroke: "var(--main-text-color)", strokeWidth: 1 },- Container: $linkMapContainer.attr("id")- });+ linkMapService = new LinkMapService(note, $linkMapContainer);+ linkMapService.render();- jsPlumbInstance.registerConnectionType("link", { anchor: "Continuous", connector: "Straight", overlays: linkOverlays });-}--function noteIdToId(noteId) {- return "link-map-note-" + noteId;+ $dialog.modal();}-$(".link-map-settings").change(loadNotesAndRelations);+$(".link-map-settings").change(() => linkMapService.loadNotesAndRelations());-$maxNotesInput.on("input", loadNotesAndRelations);+$maxNotesInput.on("input", () => linkMapService.loadNotesAndRelations());diff --git a/src/public/javascripts/services/attributes.js b/src/public/javascripts/services/attributes.jsindex 5a62e60f9e..36c6d95bf9 100644--- a/src/public/javascripts/services/attributes.js+++ b/src/public/javascripts/services/attributes.js@@ -1,9 +1,7 @@import server from "./server.js";-import utils from "./utils.js";import ws from "./ws.js";import treeUtils from "./tree_utils.js";import noteAutocompleteService from "./note_autocomplete.js";-import linkService from "./link.js";class Attributes {/**diff --git a/src/public/javascripts/services/frontend_script_api.js b/src/public/javascripts/services/frontend_script_api.jsindex 846a9471f5..41337f4bc5 100644--- a/src/public/javascripts/services/frontend_script_api.js+++ b/src/public/javascripts/services/frontend_script_api.js@@ -5,7 +5,6 @@ import infoService from './info.js';import linkService from './link.js';import treeCache from './tree_cache.js';import noteDetailService from './note_detail.js';-import noteTypeService from './note_type.js';import noteTooltipService from './note_tooltip.js';import protectedSessionService from './protected_session.js';import dateNotesService from './date_notes.js';diff --git a/src/public/javascripts/services/link_map.js b/src/public/javascripts/services/link_map.jsindex 6f15225164..f74ec8763c 100644--- a/src/public/javascripts/services/link_map.js+++ b/src/public/javascripts/services/link_map.js@@ -55,7 +55,6 @@ export default class LinkMap {const graph = new Springy.Graph();graph.addNodes(...noteIds);- graph.addEdges(...links.map(l => [l.noteId, l.targetNoteId]));const layout = new Springy.Layout.ForceDirected(graph,diff --git a/src/public/javascripts/services/note_detail_relation_map.js b/src/public/javascripts/services/note_detail_relation_map.jsindex fff5b33208..63dfb6d0ad 100644--- a/src/public/javascripts/services/note_detail_relation_map.js+++ b/src/public/javascripts/services/note_detail_relation_map.js@@ -316,14 +316,6 @@ class NoteDetailRelationMap {connection.canvas.setAttribute("data-connection-id", connection.id);}-- for (const link of data.links) {- this.jsPlumbInstance.connect({- source: this.noteIdToId(link.sourceNoteId),- target: this.noteIdToId(link.targetNoteId),- type: 'link'- });- }});}diff --git a/src/routes/api/links.js b/src/routes/api/links.jsdeleted file mode 100644index 04a2bab369..0000000000--- a/src/routes/api/links.js+++ /dev/null@@ -1,28 +0,0 @@-"use strict";--const repository = require('../../services/repository');--async function getLinks(req) {- const note = await repository.getNote(req.params.noteId);-- if (!note) {- return [404, `Note ${req.params.noteId} not found`];- }-- return await note.getLinks();-}--async function getIncomingLinks(req) {- const note = await repository.getNote(req.params.noteId);-- if (!note) {- return [404, `Note ${req.params.noteId} not found`];- }-- note.getTargetRelations()-}--module.exports = {- getLinks,- getIncomingLinks-};\ No newline at end of filediff --git a/src/routes/routes.js b/src/routes/routes.jsindex a5898fbcfa..ce2cf85d35 100644--- a/src/routes/routes.js+++ b/src/routes/routes.js@@ -33,7 +33,6 @@ const filesRoute = require('./api/file_upload');const searchRoute = require('./api/search');const dateNotesRoute = require('./api/date_notes');const linkMapRoute = require('./api/link_map');-const linksRoute = require('./api/links');const clipperRoute = require('./api/clipper');const customCodeMimeTypesRoute = require('./api/custom_code_mime_types.js');@@ -161,8 +160,6 @@ function register(app) {apiRoute(GET, '/api/notes/:noteId/target-relations', attributesRoute.getTargetRelations);apiRoute(POST, '/api/notes/:noteId/link-map', linkMapRoute.getLinkMap);- apiRoute(GET, '/api/notes/:noteId/links', linksRoute.getLinks);- apiRoute(GET, '/api/notes/:noteId/incoming-links', linksRoute.getIncomingLinks);apiRoute(GET, '/api/date-notes/date/:date', dateNotesRoute.getDateNote);apiRoute(GET, '/api/date-notes/month/:month', dateNotesRoute.getMonthNote);diff --git a/src/services/repository.js b/src/services/repository.jsindex ccbebdd302..808ab61853 100644--- a/src/services/repository.js+++ b/src/services/repository.js@@ -72,11 +72,6 @@ async function getOption(name) {return await getEntity("SELECT * FROM options WHERE name = ?", [name]);}-/** @returns {Promise<Link|null>} */-async function getLink(linkId) {- return await getEntity("SELECT * FROM links WHERE linkId = ?", [linkId]);-}-async function updateEntity(entity) {const entityName = entity.constructor.entityName;const primaryKeyName = entity.constructor.primaryKeyName;@@ -144,7 +139,6 @@ module.exports = {getBranch,getAttribute,getOption,- getLink,updateEntity,setEntityConstructor};\ No newline at end of file