Unverified Commit 55cf19aa authored by Athurg Gooth's avatar Athurg Gooth Committed by GitHub

fix: copy-to-clipboard not works well in Safari (#1779)

* Fix copy-to-clipboard not works well in Safari

* Fix typescript type check failure

* Remove global copy inject in home page

---------
Co-authored-by: 's avatarAthurg Feng <athurg@gooth.org>
parent dd8c1074
......@@ -9,7 +9,6 @@ import { checkShouldShowMemoWithFilters } from "@/helpers/filter";
import Memo from "./Memo";
import "@/less/memo-list.less";
import { PLAIN_LINK_REG } from "@/labs/marked/parser";
import copy from "copy-to-clipboard";
const MemoList = () => {
const { t } = useTranslation();
......@@ -151,21 +150,6 @@ const MemoList = () => {
}
};
useEffect(() => {
window.addEventListener("copy", handleCopy);
return () => {
window.removeEventListener("copy", handleCopy);
};
}, []);
const handleCopy = (event: ClipboardEvent) => {
event.preventDefault();
const rawStr = document.getSelection()?.toString();
if (rawStr !== undefined) {
copy(rawStr.split("\n\n").join("\n"));
}
};
return (
<div className="memo-list-container">
{sortedMemos.map((memo) => (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment