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
basic infrastructure for "relation map" note type
azivnere487dc1df719
diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.jsindex 6cae0511fd..cef41bec05 100644--- a/src/public/javascripts/services/note_detail.js+++ b/src/public/javascripts/services/note_detail.js@@ -15,6 +15,7 @@ import noteDetailText from './note_detail_text.js';import noteDetailFile from './note_detail_file.js';import noteDetailSearch from './note_detail_search.js';import noteDetailRender from './note_detail_render.js';+import noteDetailRelationMap from './note_detail_relation_map.js';import bundleService from "./bundle.js";import noteAutocompleteService from "./note_autocomplete.js";@@ -45,7 +46,8 @@ const components = {'text': noteDetailText,'file': noteDetailFile,'search': noteDetailSearch,- 'render': noteDetailRender+ 'render': noteDetailRender,+ 'relation-map': noteDetailRelationMap};function getComponent(type) {diff --git a/src/public/javascripts/services/note_detail_relation_map.js b/src/public/javascripts/services/note_detail_relation_map.jsnew file mode 100644index 0000000000..56d8c1ab5a--- /dev/null+++ b/src/public/javascripts/services/note_detail_relation_map.js@@ -0,0 +1,15 @@+import server from "./server.js";+import noteDetailService from "./note_detail.js";++const $noteDetailRelationMap = $("#note-detail-relation-map");++async function render() {+ $noteDetailRelationMap.show();+}++export default {+ show: render,+ getContent: () => "",+ focus: () => null,+ onNoteChange: () => null+}\ No newline at end of filediff --git a/src/public/javascripts/services/note_type.js b/src/public/javascripts/services/note_type.jsindex 6a9d2c08b0..176d16ffc5 100644--- a/src/public/javascripts/services/note_type.js+++ b/src/public/javascripts/services/note_type.js@@ -77,6 +77,9 @@ function NoteTypeModel() {else if (type === 'file') {return 'File';}+ else if (type === 'relation-map') {+ return 'Relation Map';+ }else if (type === 'search') {// ignore and do nothing, "type" will be hidden since it's not possible to switch to and from search}@@ -118,6 +121,13 @@ function NoteTypeModel() {save();};+ this.selectRelationMap = function() {+ self.type('relation-map');+ self.mime('application/json');++ save();+ };+this.selectCode = function() {self.type('code');self.mime('');diff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.jsindex 44abe110dc..448c2bfc33 100644--- a/src/services/consistency_checks.js+++ b/src/services/consistency_checks.js@@ -203,7 +203,7 @@ async function runAllChecks() {FROMnotesWHERE- type != 'text' AND type != 'code' AND type != 'render' AND type != 'file' AND type != 'search'`,+ type != 'text' AND type != 'code' AND type != 'render' AND type != 'file' AND type != 'search' AND type != 'relation-map'`,"Note has invalid type", errorList);await runCheck(`diff --git a/src/views/index.ejs b/src/views/index.ejsindex 57b6b0d55f..04305b8db6 100644--- a/src/views/index.ejs+++ b/src/views/index.ejs@@ -148,6 +148,8 @@<ul id="note-type-dropdown" class="dropdown-menu dropdown-menu-right"><li data-bind="click: selectText, css: { selected: type() == 'text' }"><span class="check">✓</span> <strong>Text</strong></li><li role="separator" class="divider"></li>+ <li data-bind="click: selectRelationMap, css: { selected: type() == 'relation-map' && mime() == '' }"><span class="check">✓</span> <strong>Relation Map</strong></li>+ <li role="separator" class="divider"></li><li data-bind="click: selectRender, css: { selected: type() == 'render' && mime() == '' }"><span class="check">✓</span> <strong>Render HTML note</strong></li><li role="separator" class="divider"></li><li data-bind="click: selectCode, css: { selected: type() == 'code' && mime() == '' }"><span class="check">✓</span> <strong>Code</strong></li>@@ -259,6 +261,10 @@</div><input type="file" id="file-upload" style="display: none" />++ <div id="note-detail-relation-map" class="note-detail-component">+ relation map+ </div></div><div id="children-overview"></div>