Skip to content

Commit

Permalink
Fix extra container with map error
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasAapro committed Nov 17, 2023
1 parent 66ad5ba commit 8da08c6
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions app/packs/src/decidim/locations/map/integration/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,19 @@ export default () => {
ctrl.setEventHandler("markeradd", (marker, ev) => {
const markerId = marker.options.id;

if (mapConfig && mapConfig === "single" && (ev === "typeEv" || ev === "clickEv")) {
const oldMarker = markerFieldContainer.querySelector(".marker-field");
if (oldMarker) {
ctrl.deleteMarker(oldMarker.dataset.markerId);
markerFieldContainer.querySelector(`[data-marker-id="${oldMarker.dataset.markerId}"]`).remove();
if (ev !== "editEv") {
if (mapConfig && mapConfig === "single" && (ev === "typeEv" || ev === "clickEv")) {
const oldMarker = markerFieldContainer.querySelector(".marker-field");
if (oldMarker) {
ctrl.deleteMarker(oldMarker.dataset.markerId);
markerFieldContainer.querySelector(`[data-marker-id="${oldMarker.dataset.markerId}"]`).remove();
};
};
addMarkerField(markerFieldContainer, markerId);
if (ev === "clickEv") {
ctrl.bindPopUp(markerId);
$(mapEl).trigger("geocoder-reverse.decidim", [marker.getLatLng(), { markerId }]);
};
};
addMarkerField(markerFieldContainer, markerId);
if (ev === "clickEv") {
ctrl.bindPopUp(markerId);
$(mapEl).trigger("geocoder-reverse.decidim", [marker.getLatLng(), { markerId }]);
};

marker.on("click", () => {
Expand Down

0 comments on commit 8da08c6

Please sign in to comment.