Docs: clicking anywhere in an article's box opens it
Before, only the title text was clickable. The copy-link button keeps its own action, and ctrl/cmd/shift-click on the box opens a new tab.
This commit is contained in:
2 files changed
+9
-1
No files matched your search
@@ -137,6 +137,14 @@
|
||||
document.addEventListener('click', e => {
|
||||
const a = e.target.closest('#docList a[data-doc]');
|
||||
if (a && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.button === 0) { e.preventDefault(); openDoc(a.dataset.doc); return; }
|
||||
// Anywhere else in the highlighted box (except the copy-link button) opens it too
|
||||
const item = !a && !e.target.closest('.kb-copy') && e.target.closest('#docList .kb-item');
|
||||
const itemLink = item && item.querySelector('a[data-doc]');
|
||||
if (itemLink && e.button === 0) {
|
||||
if (e.ctrlKey || e.metaKey || e.shiftKey) window.open(itemLink.href, '_blank', 'noopener');
|
||||
else openDoc(itemLink.dataset.doc);
|
||||
return;
|
||||
}
|
||||
// Links between articles (/docs/Title or the older ?doc=Title) open in place
|
||||
const link = e.target.closest('#docContent a[href]');
|
||||
if (link && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.button === 0 && link.target !== '_blank') {
|
||||
|
||||
Reference in new issue
Block a user