fix: ui fixes
This commit is contained in:
@@ -12,10 +12,7 @@ import {
|
||||
} from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
import { formatCopyText, getSourceReference } from "@/lib/source-reference";
|
||||
import {
|
||||
buildHighlightUrl,
|
||||
buildShortHighlightUrl,
|
||||
} from "@/lib/text-highlight";
|
||||
import { buildHighlightUrl } from "@/lib/text-highlight";
|
||||
import { bookmarks, SocialError } from "@/lib/social";
|
||||
import {
|
||||
KautilyaIcon,
|
||||
@@ -393,8 +390,12 @@ export function TextSelectionToolbar() {
|
||||
}
|
||||
|
||||
async function onCopyLink() {
|
||||
const url = await buildShortHighlightUrl(selectedText);
|
||||
await copy(url);
|
||||
// Hand copy() the long ?hl= URL synchronously — it shortens it to the
|
||||
// /share/<code> form inside the ClipboardItem promise, which keeps the
|
||||
// click's transient activation alive so the short link copies in one go.
|
||||
// (Pre-awaiting buildShortHighlightUrl here would burn the gesture and
|
||||
// require a second click, the way "copy caption" via onCopyText doesn't.)
|
||||
await copy(buildHighlightUrl(selectedText));
|
||||
toast.success("Link copied", { duration: 1500 });
|
||||
finishAction();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user