mirror of
https://github.com/cloudreve/frontend.git
synced 2025-12-25 19:52:48 +00:00
fix(share): use unified copy handling for share card context menu (cloudreve/cloudreve#2811)
This commit is contained in:
parent
3b9bef5ca9
commit
63c7abf214
|
|
@ -23,6 +23,7 @@ import { useAppDispatch } from "../../../redux/hooks.ts";
|
|||
import { confirmOperation } from "../../../redux/thunks/dialog.ts";
|
||||
import { openShareEditByID } from "../../../redux/thunks/share.ts";
|
||||
import SessionManager from "../../../session";
|
||||
import { copyToClipboard } from "../../../util/index.ts";
|
||||
import { DefaultCloseAction } from "../../Common/Snackbar/snackbar.tsx";
|
||||
import { NoWrapBox, NoWrapTypography } from "../../Common/StyledComponents.tsx";
|
||||
import TimeBadge from "../../Common/TimeBadge.tsx";
|
||||
|
|
@ -79,14 +80,9 @@ const ActionMenu = ({ share, onShareDeleted, onClose, ...rest }: ActionMenuProps
|
|||
}, [share, onClose]);
|
||||
|
||||
const copyLink = useCallback(() => {
|
||||
navigator.clipboard.writeText(share.url);
|
||||
enqueueSnackbar({
|
||||
message: t("modals.linkCopied"),
|
||||
variant: "success",
|
||||
action: DefaultCloseAction,
|
||||
});
|
||||
copyToClipboard(share.url);
|
||||
onClose && onClose({}, "backdropClick");
|
||||
}, [share, onClose, enqueueSnackbar, t]);
|
||||
}, [share, onClose, t]);
|
||||
|
||||
return (
|
||||
<Menu
|
||||
|
|
|
|||
Loading…
Reference in New Issue