mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 03:51:23 +01:00
Fixed note-editor bug that would raise error on edit when no notes are present
This commit is contained in:
parent
4bef159546
commit
1dbb6ca677
1 changed files with 4 additions and 5 deletions
|
|
@ -6,7 +6,7 @@ function editNotes(id, name) {
|
|||
for (const note of notes) {select.options.add(new Option(note.id, note.id));}
|
||||
|
||||
// select an object
|
||||
if (notes.length) {
|
||||
if (notes.length || id) {
|
||||
if (!id) id = notes[0].id;
|
||||
let note = notes.find(note => note.id === id);
|
||||
if (note === undefined) {
|
||||
|
|
@ -19,10 +19,9 @@ function editNotes(id, name) {
|
|||
notesName.value = note.name;
|
||||
notesText.value = note.legend;
|
||||
} else {
|
||||
if (!notes.length) {
|
||||
const value = "There are no added notes. Click on element (e.g. label) and add a free text note";
|
||||
document.getElementById("notesText").value = value;
|
||||
}
|
||||
const value = "There are no added notes. Click on element (e.g. label) and add a free text note";
|
||||
document.getElementById("notesText").value = value;
|
||||
document.getElementById("notesName").value = "";
|
||||
}
|
||||
|
||||
// open a dialog
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue