mirror of
https://github.com/usememos/memos.git
synced 2024-12-19 17:12:02 +03:00
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 <athurg@gooth.org>
This commit is contained in:
parent
dd8c10743d
commit
55cf19aa2e
@ -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) => (
|
||||
|
Loading…
Reference in New Issue
Block a user