From c2cb07ed085668a8eda33213e3ad88678058bab6 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 21 Jan 2025 20:40:19 +0200 Subject: [PATCH] feat(geomap): dismiss creation if dialog is dismissed --- src/public/app/widgets/type_widgets/geo_map.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/public/app/widgets/type_widgets/geo_map.ts b/src/public/app/widgets/type_widgets/geo_map.ts index 0815f1da9..4376dcb4f 100644 --- a/src/public/app/widgets/type_widgets/geo_map.ts +++ b/src/public/app/widgets/type_widgets/geo_map.ts @@ -213,18 +213,16 @@ export default class GeoMapTypeWidget extends TypeWidget { const title = await dialogService.prompt({ message: t("relation_map.enter_title_of_new_note"), defaultValue: t("relation_map.default_new_note_title") }); - if (!title?.trim()) { - return; + if (title?.trim()) { + const { note } = await server.post(`notes/${this.noteId}/children?target=into`, { + title, + content: "", + type: "text" + }); + attributes.setLabel(note.noteId, "iconClass", CHILD_NOTE_ICON); + this.moveMarker(note.noteId, e.latlng); } - const { note } = await server.post(`notes/${this.noteId}/children?target=into`, { - title, - content: "", - type: "text" - }); - attributes.setLabel(note.noteId, "iconClass", CHILD_NOTE_ICON); - this.moveMarker(note.noteId, e.latlng); - this.state = State.Normal; this.#adjustCursor(); }