From 55cf19aa2eb891f557dcba70410f69a5476714f7 Mon Sep 17 00:00:00 2001 From: Athurg Gooth Date: Thu, 1 Jun 2023 08:53:40 +0800 Subject: [PATCH] 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: Athurg Feng --- web/src/components/MemoList.tsx | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/web/src/components/MemoList.tsx b/web/src/components/MemoList.tsx index 8cf2c90a..4e5799f1 100644 --- a/web/src/components/MemoList.tsx +++ b/web/src/components/MemoList.tsx @@ -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 (
{sortedMemos.map((memo) => (