Add Markdown chapter content

This commit is contained in:
rueeggeandre committed 2026-06-01 10:23:33 +02:00
1 parent 7626417c46
commit 4de130e608
9 files changed
+236 -39

No files matched your search

+11 -7
View File
@@ -138,6 +138,12 @@
});
}
function updateMarkerMarkdownPreview(markdown) {
const preview = document.getElementById("marker-markdown-preview");
if (!preview) return;
preview.innerHTML = renderMarkdown(markdown || "") || '<p class="markdown-empty">Nothing to preview yet.</p>';
}
async function uploadMarkerImages(files) {
if (!files.length) return [];
@@ -166,8 +172,7 @@
content.date || "";
document.getElementById("marker-text").value =
content.description || "";
document.getElementById("video-url").value =
content.videoUrl || "";
updateMarkerMarkdownPreview(content.description || "");
document.getElementById("marker-images").value = "";
renderMarkerImages(content.images || []);
document.getElementById("marker-coords").value =
@@ -189,7 +194,6 @@
const title = document.getElementById("marker-title").value || "Untitled";
const date = document.getElementById("marker-date").value;
const description = document.getElementById("marker-text").value;
const videoUrl = document.getElementById("video-url").value;
const imageInput = document.getElementById("marker-images");
const existingImages = activeMarker._content?.images || [];
let images = existingImages;
@@ -207,7 +211,7 @@
activeMarker.setPopupContent(`<strong>${title}</strong>`);
// Store content for saving
activeMarker._content = { title, date, description, videoUrl, images };
activeMarker._content = { title, date, description, images };
// Update the list item in the sidebar
const latlng = activeMarker.getLatLng();
@@ -353,7 +357,6 @@
title: content.title || "",
date: content.date || "",
description: content.description || "",
videoUrl: content.videoUrl || "",
images: content.images || [],
};
});
@@ -436,7 +439,6 @@
title: m.title,
date: m.date,
description: m.description,
videoUrl: m.videoUrl,
images: m.images || [],
});
marker._content = { ...m };
@@ -469,7 +471,6 @@
title: displayTitle,
date: m.date,
description: m.description,
videoUrl: m.videoUrl,
images: m.images || [],
});
marker._content = {
@@ -652,6 +653,9 @@
setMode("create");
showToast("Click on the map to add a marker");
});
document
.getElementById("marker-text")
.addEventListener("input", (e) => updateMarkerMarkdownPreview(e.target.value));
}
// Expose functions globally (optional)