From a247f088022718b59edb8eee80ce564d810ca258 Mon Sep 17 00:00:00 2001 From: Caleb Owens Date: Mon, 19 Feb 2024 23:05:40 +0000 Subject: [PATCH] Add option to copy PR URL to clipboard --- .../lib/components/ActiveBranchStatus.svelte | 22 +++++++++++++++ gitbutler-ui/src/lib/components/Tag.svelte | 1 + .../lib/components/ViewPrContextMenu.svelte | 28 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 gitbutler-ui/src/lib/components/ViewPrContextMenu.svelte diff --git a/gitbutler-ui/src/lib/components/ActiveBranchStatus.svelte b/gitbutler-ui/src/lib/components/ActiveBranchStatus.svelte index c5588c318..b4eb944dc 100644 --- a/gitbutler-ui/src/lib/components/ActiveBranchStatus.svelte +++ b/gitbutler-ui/src/lib/components/ActiveBranchStatus.svelte @@ -1,7 +1,9 @@ {#if !branch.upstream} @@ -86,6 +104,10 @@ e.preventDefault(); e.stopPropagation(); }} + on:contextmenu={(e) => { + e.preventDefault(); + popupMenu.openByMouse(e, undefined); + }} > View PR diff --git a/gitbutler-ui/src/lib/components/Tag.svelte b/gitbutler-ui/src/lib/components/Tag.svelte index b33138cc8..323ec03f4 100644 --- a/gitbutler-ui/src/lib/components/Tag.svelte +++ b/gitbutler-ui/src/lib/components/Tag.svelte @@ -45,6 +45,7 @@ class:verticalOrientation class:not-button={!clickable} on:click + on:contextmenu role={clickable ? 'button' : undefined} class:clickable use:tooltip={help} diff --git a/gitbutler-ui/src/lib/components/ViewPrContextMenu.svelte b/gitbutler-ui/src/lib/components/ViewPrContextMenu.svelte new file mode 100644 index 000000000..8510b15ac --- /dev/null +++ b/gitbutler-ui/src/lib/components/ViewPrContextMenu.svelte @@ -0,0 +1,28 @@ + + + + + + { + copyToClipboard(prUrl); + dismiss(); + }} + /> + + +