minor relation map fixes

This commit is contained in:
azivner 2018-11-18 23:57:39 +01:00
parent 4f23f2515a
commit 2e76de5f34
2 changed files with 12 additions and 5 deletions

View File

@ -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();
}

View File

@ -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,