Skip to content

Build your personal knowledge base with Trilium Notes

minor relation map fixes

azivner2e76de5f34dc
diff --git a/src/public/javascripts/services/note_detail_relation_map.js b/src/public/javascripts/services/note_detail_relation_map.js
index 3c24150e00..2c13b8b899 100644
--- a/src/public/javascripts/services/note_detail_relation_map.js
+++ b/src/public/javascripts/services/note_detail_relation_map.js
@@ -215,10 +215,17 @@ function initPanZoom() {
mapData.notes.push({ noteId: clipboard.noteId, x, y });
+ saveData();
+
clipboard = null;
}
return true;
+ },
+ 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;
}
});
@@ -315,8 +322,6 @@ function connectionContextMenuHandler(connection, event) {
async function connectionCreatedHandler(info, originalEvent) {
const connection = info.connection;
- const isRelation = relations.some(rel => rel.attributeId === connection.id);
-
connection.bind("contextmenu", (obj, event) => {
if (connection.getType().includes("link")) {
// don't create context menu if it's a link since there's nothing to do with link from relation map
@@ -365,9 +370,7 @@ async function connectionCreatedHandler(info, originalEvent) {
return;
}
- const attribute = await server.put(`notes/${sourceNoteId}/relations/${name}/to/${targetNoteId}`);
-
- relations.push({ attributeId: attribute.attributeId , targetNoteId, sourceNoteId, name });
+ await server.put(`notes/${sourceNoteId}/relations/${name}/to/${targetNoteId}`);
await refresh();
}
diff --git a/src/services/notes.js b/src/services/notes.js
index 60db6e40eb..c7a7f24620 100644
--- a/src/services/notes.js
+++ b/src/services/notes.js
@@ -68,6 +68,10 @@ async function createNewNote(parentNoteId, noteData) {
noteData.type = noteData.type || parentNote.type;
noteData.mime = noteData.mime || parentNote.mime;
+ if (noteData.type === 'text' || noteData.type === 'code') {
+ noteData.content = noteData.content || "";
+ }
+
const note = await new Note({
noteId: noteData.noteId, // optionally can force specific noteId
title: noteData.title,