notes editor - clear on open

This commit is contained in:
Azgaar 2021-10-07 13:34:08 +03:00
parent 648c0ac0c9
commit e2ffb446dd
2 changed files with 8 additions and 5 deletions

View file

@ -8,6 +8,8 @@ function editMarker(markerI) {
elSelected = d3.select(element).raise().call(d3.drag().on("start", dragMarker)).classed("draggable", true);
if (document.getElementById("notesEditor").offsetParent) editNotes(element.id, element.id);
// dom elements
const markerType = document.getElementById("markerType");
const markerIcon = document.getElementById("markerIcon");

View file

@ -1,4 +1,5 @@
"use strict";
function editNotes(id, name) {
// update list of objects
const select = document.getElementById("notesSelect");
@ -8,11 +9,12 @@ function editNotes(id, name) {
}
// initiate pell (html editor)
const notesText = document.getElementById("notesText");
notesText.innerHTML = "";
const editor = Pell.init({
element: document.getElementById("notesText"),
element: notesText,
onChange: html => {
const id = document.getElementById("notesSelect").value;
const note = notes.find(note => note.id === id);
const note = notes.find(note => note.id === select.value);
if (!note) return;
note.legend = html;
showNote(note);
@ -43,8 +45,7 @@ function editNotes(id, name) {
title: "Notes Editor",
minWidth: "40em",
width: "50vw",
position: {my: "center", at: "center", of: "svg"},
close: () => (notesText.innerHTML = "")
position: {my: "center", at: "center", of: "svg"}
});
if (modules.editNotes) return;