mirror of
https://github.com/cloudreve/frontend.git
synced 2025-12-26 04:02:47 +00:00
feat: invoke system share API after share link is created
This commit is contained in:
parent
1c42a03e4b
commit
ff992a8afd
|
|
@ -1,17 +1,15 @@
|
|||
import React, { useCallback } from "react";
|
||||
import {
|
||||
Checkbox,
|
||||
FormControl,
|
||||
makeStyles,
|
||||
TextField,
|
||||
} from "@material-ui/core";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
CircularProgress,
|
||||
Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
CircularProgress,
|
||||
FormControl,
|
||||
makeStyles,
|
||||
TextField,
|
||||
} from "@material-ui/core";
|
||||
import { toggleSnackbar } from "../../redux/explorer";
|
||||
import { useDispatch } from "react-redux";
|
||||
|
|
@ -38,7 +36,6 @@ import OutlinedInput from "@material-ui/core/OutlinedInput";
|
|||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import EyeIcon from "@material-ui/icons/RemoveRedEye";
|
||||
import ToggleIcon from "material-ui-toggle-icon";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
|
|
@ -184,6 +181,18 @@ export default function CreatShare(props) {
|
|||
}, 500);
|
||||
};
|
||||
|
||||
const senLink = () => {
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
title: props.selected[0].name,
|
||||
url: shareURL,
|
||||
});
|
||||
} else if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(shareURL);
|
||||
ToggleSnackbar("top", "right", "分享链接已复制", "info");
|
||||
}
|
||||
};
|
||||
|
||||
const submitShare = (e) => {
|
||||
e.preventDefault();
|
||||
props.setModalsLoading(true);
|
||||
|
|
@ -436,6 +445,13 @@ export default function CreatShare(props) {
|
|||
)}
|
||||
|
||||
<DialogActions>
|
||||
{shareURL !== "" && (
|
||||
<div className={classes.wrapper}>
|
||||
<Button onClick={senLink} color="secondary">
|
||||
发送链接
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<Button onClick={onClose}>关闭</Button>
|
||||
|
||||
{shareURL === "" && (
|
||||
|
|
|
|||
|
|
@ -200,10 +200,12 @@ const styles = (theme) => ({
|
|||
},
|
||||
upDrawer: {
|
||||
overflowX: "hidden",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
height: "100%",
|
||||
justifyContent: "space-between",
|
||||
[theme.breakpoints.up("sm")]: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
height: "100%",
|
||||
justifyContent: "space-between",
|
||||
},
|
||||
},
|
||||
drawerOpen: {
|
||||
width: drawerWidth,
|
||||
|
|
|
|||
|
|
@ -65,8 +65,17 @@ export default function WebDAV() {
|
|||
);
|
||||
|
||||
const copyToClipboard = (text) => {
|
||||
navigator.clipboard.writeText(text);
|
||||
ToggleSnackbar("top", "center", "已复制到剪切板", "success");
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(text);
|
||||
ToggleSnackbar("top", "center", "已复制到剪切板", "success");
|
||||
} else {
|
||||
ToggleSnackbar(
|
||||
"top",
|
||||
"center",
|
||||
"当前浏览器不支持,请手动复制",
|
||||
"warning"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const loadList = () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue