mirror of
https://github.com/spacebarchat/client.git
synced 2024-11-25 11:42:30 +01:00
everyone and here mention rendering
This commit is contained in:
parent
b02e31026a
commit
b0e7bb4111
@ -176,6 +176,10 @@ const customRenderer: Partial<ReactRenderer> = {
|
|||||||
<Mention key={i} type="role" id={match} />
|
<Mention key={i} type="role" id={match} />
|
||||||
));
|
));
|
||||||
|
|
||||||
|
replaced = reactStringReplace(replaced, /(@everyone|@here)/, (match, i) => (
|
||||||
|
<Mention key={i} type="text" id={match} />
|
||||||
|
));
|
||||||
|
|
||||||
return replaced;
|
return replaced;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -125,8 +125,16 @@ function RoleMention({ id }: MentionProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CustomMention({ id }: MentionProps) {
|
||||||
|
return (
|
||||||
|
<Container>
|
||||||
|
<span>{id}</span>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
type: "role" | "user" | "channel";
|
type: "role" | "user" | "channel" | "text";
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,6 +142,7 @@ function Mention({ type, id }: Props) {
|
|||||||
if (type === "role") return <RoleMention id={id} />;
|
if (type === "role") return <RoleMention id={id} />;
|
||||||
if (type === "user") return <UserMention id={id} />;
|
if (type === "user") return <UserMention id={id} />;
|
||||||
if (type === "channel") return <ChannelMention id={id} />;
|
if (type === "channel") return <ChannelMention id={id} />;
|
||||||
|
if (type === "text") return <CustomMention id={id} />;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user