mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-25 00:20:57 -05:00
Add shift+click
to mention mentions
This commit is contained in:
parent
b166b06321
commit
a308e6ecb8
1 changed files with 18 additions and 2 deletions
|
@ -44,7 +44,7 @@ if (typeof window !== "undefined") {
|
||||||
if (code) {
|
if (code) {
|
||||||
navigator.clipboard.writeText(code.textContent?.trim() ?? "");
|
navigator.clipboard.writeText(code.textContent?.trim() ?? "");
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) { }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,18 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
|
||||||
(ev: MouseEvent) => {
|
(ev: MouseEvent) => {
|
||||||
if (ev.currentTarget) {
|
if (ev.currentTarget) {
|
||||||
const element = ev.currentTarget as HTMLAnchorElement;
|
const element = ev.currentTarget as HTMLAnchorElement;
|
||||||
if (openLink(element.href)) ev.preventDefault();
|
if (element.dataset.type === 'mention' && ev.shiftKey) {
|
||||||
|
internalEmit(
|
||||||
|
"MessageBox",
|
||||||
|
"append",
|
||||||
|
`<@${element.dataset.mentionId}>`,
|
||||||
|
"mention",
|
||||||
|
);
|
||||||
|
|
||||||
|
ev.preventDefault()
|
||||||
|
} else if (openLink(element.href)) {
|
||||||
|
ev.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[openLink],
|
[openLink],
|
||||||
|
@ -162,6 +173,7 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
|
||||||
element.removeEventListener("click", handleLink);
|
element.removeEventListener("click", handleLink);
|
||||||
element.addEventListener("click", handleLink);
|
element.addEventListener("click", handleLink);
|
||||||
element.removeAttribute("data-type");
|
element.removeAttribute("data-type");
|
||||||
|
element.removeAttribute("data-mention-id");
|
||||||
element.removeAttribute("target");
|
element.removeAttribute("target");
|
||||||
|
|
||||||
const link = determineLink(element.href);
|
const link = determineLink(element.href);
|
||||||
|
@ -171,6 +183,10 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
|
||||||
"data-type",
|
"data-type",
|
||||||
"mention",
|
"mention",
|
||||||
);
|
);
|
||||||
|
element.setAttribute(
|
||||||
|
"data-mention-id",
|
||||||
|
link.id
|
||||||
|
)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "external": {
|
case "external": {
|
||||||
|
|
Loading…
Reference in a new issue