fix: copy behaviour
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { useCopyFeedback, type Position } from "./shared";
|
||||
import { buildShortHighlightUrl } from "@/lib/text-highlight";
|
||||
import { Bookmark, FolderPlus, AtSign, Link2, Check } from "lucide-react";
|
||||
import { Bookmark, FolderPlus, AtSign } from "lucide-react";
|
||||
import {
|
||||
Drawer,
|
||||
DrawerClose,
|
||||
@@ -34,18 +33,6 @@ export function MorePopover({
|
||||
}) {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const { copied, copy } = useCopyFeedback();
|
||||
const [generatingLink, setGeneratingLink] = useState(false);
|
||||
|
||||
async function handleCopyLink() {
|
||||
if (generatingLink) return;
|
||||
setGeneratingLink(true);
|
||||
try {
|
||||
const url = await buildShortHighlightUrl(selectedText);
|
||||
await copy(url);
|
||||
} finally {
|
||||
setGeneratingLink(false);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!open || isMobile) return;
|
||||
@@ -80,17 +67,6 @@ export function MorePopover({
|
||||
icon: <FolderPlus className="size-5" />,
|
||||
onClick: onSaveToCollection,
|
||||
},
|
||||
{
|
||||
key: "copy-link",
|
||||
label: copied
|
||||
? "Link Copied!"
|
||||
: generatingLink
|
||||
? "Generating link…"
|
||||
: "Copy Link",
|
||||
description: "Copy a shareable link to this quote",
|
||||
icon: copied ? <Check className="size-5" /> : <Link2 className="size-5" />,
|
||||
onClick: handleCopyLink,
|
||||
},
|
||||
{
|
||||
key: "mention",
|
||||
label: "Mention",
|
||||
|
||||
Reference in New Issue
Block a user