mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-24 22:52:09 -05:00
Fix: Prevent context menu on images in settings.
Revert mobile change. Messages: Add channel id matching.
This commit is contained in:
parent
4f6d2de75f
commit
3351674c21
5 changed files with 41 additions and 33 deletions
|
@ -82,6 +82,9 @@ md.renderer.rules.emoji = function (token, idx) {
|
||||||
|
|
||||||
const RE_TWEMOJI = /:(\w+):/g;
|
const RE_TWEMOJI = /:(\w+):/g;
|
||||||
|
|
||||||
|
// ! FIXME: Move to library
|
||||||
|
const RE_CHANNELS = /<#([A-z0-9]{26})>/g;
|
||||||
|
|
||||||
export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
|
export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
|
||||||
const client = useContext(AppContext);
|
const client = useContext(AppContext);
|
||||||
if (typeof content === "undefined") return null;
|
if (typeof content === "undefined") return null;
|
||||||
|
@ -99,6 +102,18 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
|
||||||
return `[@${user.username}](/@${id})`;
|
return `[@${user.username}](/@${id})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return sub;
|
||||||
|
},
|
||||||
|
).replace(
|
||||||
|
RE_CHANNELS,
|
||||||
|
(sub: string, ...args: any[]) => {
|
||||||
|
const id = args[0],
|
||||||
|
channel = client.channels.get(id);
|
||||||
|
|
||||||
|
if (channel?.channel_type === 'TextChannel') {
|
||||||
|
return `[#${channel.name}](/server/${channel.server}/channel/${id})`;
|
||||||
|
}
|
||||||
|
|
||||||
return sub;
|
return sub;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -233,14 +233,6 @@ export function ServerListSidebar({ unreads, lastOpened }: Props) {
|
||||||
to={lastOpened.home ? `/channel/${lastOpened.home}` : "/"}>
|
to={lastOpened.home ? `/channel/${lastOpened.home}` : "/"}>
|
||||||
<ServerEntry home active={homeActive}>
|
<ServerEntry home active={homeActive}>
|
||||||
<Swoosh />
|
<Swoosh />
|
||||||
{isTouchscreenDevice ? (
|
|
||||||
<Icon size={42} unread={homeUnread}>
|
|
||||||
<img
|
|
||||||
style={{ width: 32, height: 32 }}
|
|
||||||
src={logoSVG}
|
|
||||||
/>
|
|
||||||
</Icon>
|
|
||||||
) : (
|
|
||||||
<div
|
<div
|
||||||
onContextMenu={attachContextMenu("Status")}
|
onContextMenu={attachContextMenu("Status")}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
|
@ -256,7 +248,6 @@ export function ServerListSidebar({ unreads, lastOpened }: Props) {
|
||||||
</Icon>
|
</Icon>
|
||||||
</UserHover>
|
</UserHover>
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</ServerEntry>
|
</ServerEntry>
|
||||||
</ConditionalLink>
|
</ConditionalLink>
|
||||||
<LineDivider />
|
<LineDivider />
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @ts-ignore
|
|
||||||
import { Reset, Import } from "@styled-icons/boxicons-regular";
|
import { Reset, Import } from "@styled-icons/boxicons-regular";
|
||||||
import { Pencil } from "@styled-icons/boxicons-solid";
|
import { Pencil } from "@styled-icons/boxicons-solid";
|
||||||
|
// @ts-ignore
|
||||||
import pSBC from "shade-blend-color";
|
import pSBC from "shade-blend-color";
|
||||||
|
|
||||||
import styles from "./Panes.module.scss";
|
import styles from "./Panes.module.scss";
|
||||||
|
@ -103,6 +103,7 @@ export function Component(props: Props) {
|
||||||
selected !== "light" &&
|
selected !== "light" &&
|
||||||
setTheme({ preset: "light" })
|
setTheme({ preset: "light" })
|
||||||
}
|
}
|
||||||
|
onContextMenu={e => e.preventDefault()}
|
||||||
/>
|
/>
|
||||||
<h4>
|
<h4>
|
||||||
<Text id="app.settings.pages.appearance.color.light" />
|
<Text id="app.settings.pages.appearance.color.light" />
|
||||||
|
@ -116,6 +117,7 @@ export function Component(props: Props) {
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
selected !== "dark" && setTheme({ preset: "dark" })
|
selected !== "dark" && setTheme({ preset: "dark" })
|
||||||
}
|
}
|
||||||
|
onContextMenu={e => e.preventDefault()}
|
||||||
/>
|
/>
|
||||||
<h4>
|
<h4>
|
||||||
<Text id="app.settings.pages.appearance.color.dark" />
|
<Text id="app.settings.pages.appearance.color.dark" />
|
||||||
|
@ -199,7 +201,7 @@ export function Component(props: Props) {
|
||||||
className={styles.button}
|
className={styles.button}
|
||||||
onClick={() => setEmojiPack("mutant")}
|
onClick={() => setEmojiPack("mutant")}
|
||||||
data-active={emojiPack === "mutant"}>
|
data-active={emojiPack === "mutant"}>
|
||||||
<img src={mutantSVG} draggable={false} />
|
<img src={mutantSVG} draggable={false} onContextMenu={e => e.preventDefault()} />
|
||||||
</div>
|
</div>
|
||||||
<h4>
|
<h4>
|
||||||
Mutant Remix{" "}
|
Mutant Remix{" "}
|
||||||
|
@ -216,7 +218,7 @@ export function Component(props: Props) {
|
||||||
className={styles.button}
|
className={styles.button}
|
||||||
onClick={() => setEmojiPack("twemoji")}
|
onClick={() => setEmojiPack("twemoji")}
|
||||||
data-active={emojiPack === "twemoji"}>
|
data-active={emojiPack === "twemoji"}>
|
||||||
<img src={twemojiSVG} draggable={false} />
|
<img src={twemojiSVG} draggable={false} onContextMenu={e => e.preventDefault()} />
|
||||||
</div>
|
</div>
|
||||||
<h4>Twemoji</h4>
|
<h4>Twemoji</h4>
|
||||||
</div>
|
</div>
|
||||||
|
@ -227,7 +229,7 @@ export function Component(props: Props) {
|
||||||
className={styles.button}
|
className={styles.button}
|
||||||
onClick={() => setEmojiPack("openmoji")}
|
onClick={() => setEmojiPack("openmoji")}
|
||||||
data-active={emojiPack === "openmoji"}>
|
data-active={emojiPack === "openmoji"}>
|
||||||
<img src={openmojiSVG} draggable={false} />
|
<img src={openmojiSVG} draggable={false} onContextMenu={e => e.preventDefault()} />
|
||||||
</div>
|
</div>
|
||||||
<h4>Openmoji</h4>
|
<h4>Openmoji</h4>
|
||||||
</div>
|
</div>
|
||||||
|
@ -236,7 +238,7 @@ export function Component(props: Props) {
|
||||||
className={styles.button}
|
className={styles.button}
|
||||||
onClick={() => setEmojiPack("noto")}
|
onClick={() => setEmojiPack("noto")}
|
||||||
data-active={emojiPack === "noto"}>
|
data-active={emojiPack === "noto"}>
|
||||||
<img src={notoSVG} draggable={false} />
|
<img src={notoSVG} draggable={false} onContextMenu={e => e.preventDefault()} />
|
||||||
</div>
|
</div>
|
||||||
<h4>Noto Emoji</h4>
|
<h4>Noto Emoji</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -500,12 +500,12 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.experiments { /* TOFIX: Center the "No new experiments available at this time" text without having a scrollbar */
|
.experiments {
|
||||||
height: 100%;
|
height: calc(100% - 40px);
|
||||||
|
|
||||||
.empty {
|
.empty {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100%;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
export type Experiments = "search";
|
export type Experiments = "search";
|
||||||
export const AVAILABLE_EXPERIMENTS: Experiments[] = ["search"];
|
export const AVAILABLE_EXPERIMENTS: Experiments[] = ['search'];
|
||||||
export const EXPERIMENTS: {
|
export const EXPERIMENTS: {
|
||||||
[key in Experiments]: { title: string; description: string };
|
[key in Experiments]: { title: string; description: string };
|
||||||
} = {
|
} = {
|
||||||
|
|
Loading…
Reference in a new issue