Skip to content

Commit 319e2e5

Browse files
better link handling / "LINEAR" display by default
1 parent 796d7b9 commit 319e2e5

2 files changed

Lines changed: 24 additions & 14 deletions

File tree

others/vuejs-frontend/src/components/Pages/Lesson.vue

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -342,27 +342,37 @@ export default {
342342
},
343343
// prevents page reloading on internal URL's
344344
onHtmlClick(event) {
345+
const target = event.target;
346+
const tagName = target.tagName.toLowerCase();
345347
346-
// Si c'est un lien interne avec une ancre (#), on laisse le comportement par défaut
347-
if (event.target.parentNode.tagName.toLowerCase() === 'a' && event.target.parentNode.getAttribute('href').startsWith('#')) {
348-
navigator.clipboard.writeText(event.target.parentNode.href);
349-
return;
350-
}
351-
if (event.target.tagName.toLowerCase() === 'a') {
352-
if (event.target.hasAttribute('download')) {
348+
// Handle anchor tags
349+
if (tagName === 'a' || (tagName === 'span' && target.parentNode.tagName.toLowerCase() === 'a')) {
350+
const link = tagName === 'a' ? target : target.parentNode;
351+
352+
// Handle internal anchor links
353+
if (link.getAttribute('href')?.startsWith('#')) {
354+
navigator.clipboard.writeText(link.href);
353355
return;
354356
}
355-
// Si le lien est sur le même domaine
356-
if (event.target.href.includes(window.location.origin)) {
357+
358+
// Skip processing for TOC links and download links
359+
if (link.closest('.toc') || link.hasAttribute('download')) {
360+
return;
361+
}
362+
363+
// Handle internal navigation
364+
if (link.href?.includes(window.location.origin)) {
357365
event.stopPropagation();
358366
event.preventDefault();
359-
let path = event.target.hasAttribute('href') ? event.target.getAttribute('href') : event.target.pathname;
367+
const path = link.getAttribute('href') || link.pathname;
360368
this.$router.push(path);
361369
}
370+
return;
362371
}
363-
// display image in lightbox when clicked
364-
if (event.target.tagName.toLowerCase() === 'img') {
365-
this.uiStore.displayLightBox(event.target.src);
372+
373+
// Handle images
374+
if (tagName === 'img') {
375+
this.uiStore.displayLightBox(target.src);
366376
}
367377
},
368378
async getVideoUrl() {

src/com/simplicite/commons/Training/TrnFsSyncTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ private JSONObject getLsnData(File dir) throws IOException {
967967
if (!lsnJson.has("ANY"))
968968
lsnJson.put("ANY", new JSONObject());
969969
lsn.put("published", lsnJson.optBoolean("published", true));
970-
lsn.put("viz", lsnJson.optString("display", "TUTO"));
970+
lsn.put("viz", lsnJson.optString("display", "LINEAR"));
971971
lsn.put("tags", lsnJson.optJSONArray("tags"));
972972
lsn.put("page", lsnJson.optBoolean("page", false));
973973

0 commit comments

Comments
 (0)