From 1fb84a5aa8154b4eefc237a09eb8ea38d3235b58 Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Mon, 20 Nov 2023 20:27:29 +0000 Subject: [PATCH] update --- app/PreviewShape/PreviewShape.tsx | 38 ++--------------------------- app/components/UrlLinkButton.tsx | 40 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 36 deletions(-) create mode 100644 app/components/UrlLinkButton.tsx diff --git a/app/PreviewShape/PreviewShape.tsx b/app/PreviewShape/PreviewShape.tsx index b537088..c9e5b16 100644 --- a/app/PreviewShape/PreviewShape.tsx +++ b/app/PreviewShape/PreviewShape.tsx @@ -12,6 +12,7 @@ import { Vec2d, useValue, } from '@tldraw/tldraw' +import { UrlLinkButton } from '../components/UrlLinkButton' export type PreviewShape = TLBaseShape< 'preview', @@ -127,42 +128,7 @@ export class PreviewShapeUtil extends BaseBoxShapeUtil { )} - {htmlToUse && ( - - )} + {htmlToUse && } {htmlToUse && (
{ + if (navigator && navigator.clipboard) { + navigator.clipboard.writeText(`${window.location.origin}/link/${shape.id.split(':')[1]}`) + toast.addToast({ + icon: 'code', + title: 'Copied url to clipboard', + }) + } + }} + onPointerDown={stopEventPropagation} + title="Copy url to clipboard" + > + + + ) +}