Skip to content

Commit aace8de

Browse files
committed
fix: not handelling ctrl + c if user has some text selected
1 parent fa82795 commit aace8de

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

components/diffActionBar.vue

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
<template>
22
<section
3-
class="
4-
flex
5-
items-center
6-
justify-between
7-
px-4
8-
py-2
9-
mb-4
10-
sticky
11-
top-[70px]
12-
dark:bg-gray-700
13-
bg-gray-300
14-
dark:bg-opacity-50
15-
bg-opacity-50
16-
backdrop-blur-sm
17-
rounded-md
18-
shadow-lg
19-
border border-gray-500
20-
w-full
21-
z-10
22-
"
3+
class="flex items-center justify-between px-4 py-2 mb-4 sticky top-[70px] dark:bg-gray-700 bg-gray-300 dark:bg-opacity-50 bg-opacity-50 backdrop-blur-sm rounded-md shadow-lg border border-gray-500 w-full z-10"
234
>
245
<div class="flex gap-4">
256
<ToggleInSync />
@@ -92,7 +73,11 @@ export default Vue.extend({
9273
methods: {
9374
handleCtrlC(event: KeyboardEvent) {
9475
const { metaKey, ctrlKey, key } = event
95-
if ((metaKey || ctrlKey) && key === 'c') {
76+
if (
77+
(metaKey || ctrlKey) &&
78+
key === 'c' &&
79+
!window?.getSelection()?.toString()
80+
) {
9681
const button: HTMLButtonElement = document.getElementById(
9782
'copyLinkButton'
9883
) as HTMLButtonElement

0 commit comments

Comments
 (0)