Render open-location syntax as link
Some checks failed
DokuWiki Default Tasks / all (push) Has been cancelled

This commit is contained in:
2026-01-07 11:42:40 +01:00
parent 6a396ce511
commit c5f4bcc1c5
7 changed files with 156 additions and 16 deletions

View File

@@ -119,9 +119,23 @@
return path;
}
function findOpenElement(target) {
var el = target;
while (el && el !== document) {
if (el.classList && el.classList.contains('luxtools-open')) return el;
el = el.parentNode;
}
return null;
}
function onClick(event) {
var el = event.target;
if (!el || !el.classList || !el.classList.contains('luxtools-open')) return;
var el = findOpenElement(event.target);
if (!el) return;
// {{open>...}} renders as a link; avoid jumping to '#'.
if (el.tagName && el.tagName.toLowerCase() === 'a') {
event.preventDefault();
}
var raw = el.getAttribute('data-path') || '';
if (!raw) return;