Skip to content

Commit 0b8f4b8

Browse files
authored
Merge pull request #3 from VgHost-26/fix-unix-os-copy
fix: copying issue on unix systems
2 parents 0e0a794 + 765bdd1 commit 0b8f4b8

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/plugins/copy-event-plugin.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ export class CopyEventPlugin {
6464
* Handles right-clicks on events to start the copy-drag.
6565
*/
6666
private handleContextMenu = (e: MouseEvent): void => {
67+
if (this.draggedElement) {
68+
e.preventDefault();
69+
this.abortDrag();
70+
return;
71+
}
72+
6773
const eventElement = (e.target as HTMLElement).closest(".sx__event") as HTMLElement;
6874

6975
if ((e.target as HTMLElement).closest(".sx__date-grid")) {
@@ -89,7 +95,9 @@ export class CopyEventPlugin {
8995
}
9096

9197
if (eventData) {
92-
this.startDrag(eventElement, eventData, e);
98+
setTimeout(() => {
99+
this.startDrag(eventElement, eventData, e);
100+
}, 10);
93101
}
94102
};
95103

@@ -144,12 +152,11 @@ export class CopyEventPlugin {
144152
return;
145153
}
146154

147-
if ((e.target as HTMLElement).closest(".sx__calendar-header")) {
155+
if (e.button !== 0) {
148156
return;
149157
}
150158

151-
if (e.button === 2) {
152-
this.abortDrag();
159+
if ((e.target as HTMLElement).closest(".sx__calendar-header")) {
153160
return;
154161
}
155162

0 commit comments

Comments
 (0)