Skip to content

Build your personal knowledge base with Trilium Notes

feat(geomap): dismiss creation if dialog is dismissed

Elian Doranc2cb07ed0856
diff --git a/src/public/app/widgets/type_widgets/geo_map.ts b/src/public/app/widgets/type_widgets/geo_map.ts
index 0815f1da99..4376dcb4fb 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<CreateChildResponse>(`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<CreateChildResponse>(`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();
}