mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-21 22:50:59 -05:00
fix: don't open new tab to download attachment (#614)
This commit is contained in:
parent
4f48e3d176
commit
7345172271
2 changed files with 7 additions and 5 deletions
|
@ -4,6 +4,7 @@ import {
|
||||||
Download,
|
Download,
|
||||||
} from "@styled-icons/boxicons-regular";
|
} from "@styled-icons/boxicons-regular";
|
||||||
import { File, Video } from "@styled-icons/boxicons-solid";
|
import { File, Video } from "@styled-icons/boxicons-solid";
|
||||||
|
import { isFirefox } from "react-device-detect";
|
||||||
import { API } from "revolt.js";
|
import { API } from "revolt.js";
|
||||||
|
|
||||||
import styles from "./AttachmentActions.module.scss";
|
import styles from "./AttachmentActions.module.scss";
|
||||||
|
@ -51,7 +52,7 @@ export default function AttachmentActions({ attachment }: Props) {
|
||||||
href={download_url}
|
href={download_url}
|
||||||
className={styles.downloadIcon}
|
className={styles.downloadIcon}
|
||||||
download
|
download
|
||||||
target="_blank"
|
target={isFirefox ? "_blank" : "_self"}
|
||||||
rel="noreferrer">
|
rel="noreferrer">
|
||||||
<IconButton>
|
<IconButton>
|
||||||
<Download size={24} />
|
<Download size={24} />
|
||||||
|
@ -69,7 +70,7 @@ export default function AttachmentActions({ attachment }: Props) {
|
||||||
href={download_url}
|
href={download_url}
|
||||||
className={styles.downloadIcon}
|
className={styles.downloadIcon}
|
||||||
download
|
download
|
||||||
target="_blank"
|
target={isFirefox ? "_blank" : "_self"}
|
||||||
rel="noreferrer">
|
rel="noreferrer">
|
||||||
<IconButton>
|
<IconButton>
|
||||||
<Download size={24} />
|
<Download size={24} />
|
||||||
|
@ -89,7 +90,7 @@ export default function AttachmentActions({ attachment }: Props) {
|
||||||
href={download_url}
|
href={download_url}
|
||||||
className={styles.downloadIcon}
|
className={styles.downloadIcon}
|
||||||
download
|
download
|
||||||
target="_blank"
|
target={isFirefox ? "_blank" : "_self"}
|
||||||
rel="noreferrer">
|
rel="noreferrer">
|
||||||
<IconButton>
|
<IconButton>
|
||||||
<Download size={24} />
|
<Download size={24} />
|
||||||
|
@ -118,7 +119,7 @@ export default function AttachmentActions({ attachment }: Props) {
|
||||||
href={download_url}
|
href={download_url}
|
||||||
className={styles.downloadIcon}
|
className={styles.downloadIcon}
|
||||||
download
|
download
|
||||||
target="_blank"
|
target={isFirefox ? "_blank" : "_self"}
|
||||||
rel="noreferrer">
|
rel="noreferrer">
|
||||||
<IconButton>
|
<IconButton>
|
||||||
<Download size={24} />
|
<Download size={24} />
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
Trash,
|
Trash,
|
||||||
} from "@styled-icons/boxicons-regular";
|
} from "@styled-icons/boxicons-regular";
|
||||||
import { Cog, UserVoice } from "@styled-icons/boxicons-solid";
|
import { Cog, UserVoice } from "@styled-icons/boxicons-solid";
|
||||||
|
import { isFirefox } from "react-device-detect";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import { Channel, Message, Server, User, API } from "revolt.js";
|
import { Channel, Message, Server, User, API } from "revolt.js";
|
||||||
import { Permission, UserPermission } from "revolt.js";
|
import { Permission, UserPermission } from "revolt.js";
|
||||||
|
@ -286,7 +287,7 @@ export default function ContextMenus() {
|
||||||
"attachments",
|
"attachments",
|
||||||
"attachments/download",
|
"attachments/download",
|
||||||
),
|
),
|
||||||
"_blank",
|
isFirefox ? "_blank" : "_self",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue