link map fixes

This commit is contained in:
zadam
2019-08-27 22:47:10 +02:00
parent a4acbf3aea
commit ff1d312a43
5 changed files with 22 additions and 37 deletions

View File

@@ -4,21 +4,24 @@ import noteDetailService from "../services/note_detail.js";
const $linkMapContainer = $("#link-map-container");
const LINK_TYPES = [ "hyper", "image", "relation", "relation-map" ];
const $dialog = $("#link-map-dialog");
const $maxNotesInput = $("#link-map-max-notes");
let linkMapService;
function getOptions() {
return {
maxNotes: $maxNotesInput.val()
};
}
export async function showDialog() {
utils.closeActiveDialog();
glob.activeDialog = $dialog;
// set default settings
$maxNotesInput.val(10);
LINK_TYPES.forEach(lt => $("#link-map-" + lt).prop('checked', true));
$maxNotesInput.val(20);
const note = noteDetailService.getActiveNote();
@@ -28,12 +31,11 @@ export async function showDialog() {
$linkMapContainer.css("height", $("body").height() - 150);
linkMapService = new LinkMapService(note, $linkMapContainer);
linkMapService = new LinkMapService(note, $linkMapContainer, getOptions());
linkMapService.render();
$dialog.modal();
}
$(".link-map-settings").change(() => linkMapService.loadNotesAndRelations());
$maxNotesInput.on("input", () => linkMapService.loadNotesAndRelations());
$maxNotesInput.on("input", () => linkMapService.loadNotesAndRelations(getOptions()));