mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
basic infrastructure for "relation map" note type
This commit is contained in:
parent
04af8a3a96
commit
e487dc1df7
@ -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) {
|
||||
|
15
src/public/javascripts/services/note_detail_relation_map.js
Normal file
15
src/public/javascripts/services/note_detail_relation_map.js
Normal file
@ -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
|
||||
}
|
@ -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('');
|
||||
|
@ -203,7 +203,7 @@ async function runAllChecks() {
|
||||
FROM
|
||||
notes
|
||||
WHERE
|
||||
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(`
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user