mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-26 00:50:56 -05:00
Add shift+click
to link to a channel in the textarea
This commit is contained in:
parent
2966e77917
commit
dd9b486dab
2 changed files with 13 additions and 1 deletions
|
@ -22,6 +22,7 @@ import { mapChannelWithUnread, useUnreads } from "./common";
|
||||||
|
|
||||||
import { ChannelButton } from "../items/ButtonItem";
|
import { ChannelButton } from "../items/ButtonItem";
|
||||||
import ConnectionStatus from "../items/ConnectionStatus";
|
import ConnectionStatus from "../items/ConnectionStatus";
|
||||||
|
import { internalEmit } from "../../../lib/eventEmitter";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
unreads: Unreads;
|
unreads: Unreads;
|
||||||
|
@ -86,6 +87,17 @@ const ServerSidebar = observer((props: Props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConditionalLink
|
<ConditionalLink
|
||||||
|
onClick={e => {
|
||||||
|
if (e.shiftKey) {
|
||||||
|
internalEmit(
|
||||||
|
"MessageBox",
|
||||||
|
"append",
|
||||||
|
`<#${entry._id}>`,
|
||||||
|
"mention",
|
||||||
|
);
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
|
}}
|
||||||
key={entry._id}
|
key={entry._id}
|
||||||
active={active}
|
active={active}
|
||||||
to={`/server/${server!._id}/channel/${entry._id}`}>
|
to={`/server/${server!._id}/channel/${entry._id}`}>
|
||||||
|
|
|
@ -9,7 +9,7 @@ export default function ConditionalLink(props: Props) {
|
||||||
const { active, ...linkProps } = props;
|
const { active, ...linkProps } = props;
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
return <a>{props.children}</a>;
|
return <a onClick={linkProps.onClick}>{props.children}</a>;
|
||||||
}
|
}
|
||||||
return <Link {...linkProps} />;
|
return <Link {...linkProps} />;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue