Skip to content

Commit bf5c1a8

Browse files
committed
feat(position): pre-fill title and desc for landmark save
1 parent b9995f9 commit bf5c1a8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/js/position.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,17 @@ class Position {
289289
let target = document.getElementById("landmarkLocation");
290290
target.dataset.coordinates = "[" + coordinates.lon + "," + coordinates.lat + "]";
291291
target.value = this.name;
292+
if (type !== "myposition" && this.#getTrueHeader() !== "Repère placé") {
293+
let landmarkTitle = document.getElementById("landmark-title");
294+
landmarkTitle.value = this.#getTrueHeader().split("\n")[0];
295+
if (this.additionalHtml.beforeButtons) {
296+
let landmarkDesc = document.getElementById("landmark-description");
297+
let tempDomElem = domUtils.stringToHTML(this.additionalHtml.beforeButtons);
298+
document.body.appendChild(tempDomElem);
299+
landmarkDesc.value = tempDomElem.innerText;
300+
document.body.removeChild(tempDomElem);
301+
}
302+
}
292303
}
293304
});
294305
}
@@ -423,7 +434,7 @@ class Position {
423434
*/
424435
async compute(options = {}) {
425436
const lngLat = options.lngLat || false;
426-
const text = options.text || "Repère placé";
437+
const text = options.text || "Repère placé";
427438
let html = options.html || "";
428439
const html2 = options.html2 || "";
429440
const hideCallback = options.hideCallback || null;

0 commit comments

Comments
 (0)