mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-21 05:18:51 +01:00
Ignore cmd/ctrl/shift/alt keys + middle clicks
This commit is contained in:
parent
674c99a05d
commit
7e01b4a33a
1 changed files with 6 additions and 0 deletions
|
@ -6,6 +6,12 @@ function handleContentLinks(opts) {
|
||||||
let { target } = e;
|
let { target } = e;
|
||||||
target = target.closest('a');
|
target = target.closest('a');
|
||||||
if (!target) return;
|
if (!target) return;
|
||||||
|
|
||||||
|
// If cmd/ctrl/shift/alt key is pressed or middle-click, let the browser handle it
|
||||||
|
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.which === 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const prevText = target.previousSibling?.textContent;
|
const prevText = target.previousSibling?.textContent;
|
||||||
const textBeforeLinkIsAt = prevText?.endsWith('@');
|
const textBeforeLinkIsAt = prevText?.endsWith('@');
|
||||||
const textStartsWithAt = target.innerText.startsWith('@');
|
const textStartsWithAt = target.innerText.startsWith('@');
|
||||||
|
|
Loading…
Reference in a new issue