Просмотр исходного кода

reintroduce copy/paste on Apple devices and on touch screens

zsviczian 2 лет назад
Родитель
Сommit
56d1653d97
1 измененных файлов с 11 добавлено и 6 удалено
  1. 11 6
      src/components/App.tsx

+ 11 - 6
src/components/App.tsx

@@ -169,6 +169,7 @@ import {
   isArrowKey,
   isArrowKey,
   KEYS,
   KEYS,
   isAndroid,
   isAndroid,
+  isDarwin,
 } from "../keys";
 } from "../keys";
 import { distance2d, getGridPoint, isPathALoop } from "../math";
 import { distance2d, getGridPoint, isPathALoop } from "../math";
 import { renderScene } from "../renderer/renderScene";
 import { renderScene } from "../renderer/renderScene";
@@ -5978,7 +5979,7 @@ class App extends React.Component<AppProps, AppState> {
       } else {
       } else {
         ContextMenu.push({
         ContextMenu.push({
           options: [
           options: [
-            this.device.isMobile &&
+            (this.device.isTouchScreen || isDarwin) &&
               navigator.clipboard && {
               navigator.clipboard && {
                 trackEvent: false,
                 trackEvent: false,
                 name: "paste",
                 name: "paste",
@@ -5990,7 +5991,9 @@ class App extends React.Component<AppProps, AppState> {
                 },
                 },
                 contextItemLabel: "labels.paste",
                 contextItemLabel: "labels.paste",
               },
               },
-            this.device.isMobile && navigator.clipboard && separator,
+            (this.device.isTouchScreen || isDarwin) &&
+              navigator.clipboard &&
+              separator,
             probablySupportsClipboardBlob &&
             probablySupportsClipboardBlob &&
               elements.length > 0 &&
               elements.length > 0 &&
               actionCopyAsPng,
               actionCopyAsPng,
@@ -6035,9 +6038,11 @@ class App extends React.Component<AppProps, AppState> {
       } else {
       } else {
         ContextMenu.push({
         ContextMenu.push({
           options: [
           options: [
-            this.device.isMobile && actionCut,
-            this.device.isMobile && navigator.clipboard && actionCopy,
-            this.device.isMobile &&
+            (this.device.isTouchScreen || isDarwin) && actionCut,
+            (this.device.isTouchScreen || isDarwin) &&
+              navigator.clipboard &&
+              actionCopy,
+            (this.device.isTouchScreen || isDarwin) &&
               navigator.clipboard && {
               navigator.clipboard && {
                 name: "paste",
                 name: "paste",
                 trackEvent: false,
                 trackEvent: false,
@@ -6049,7 +6054,7 @@ class App extends React.Component<AppProps, AppState> {
                 },
                 },
                 contextItemLabel: "labels.paste",
                 contextItemLabel: "labels.paste",
               },
               },
-            this.device.isMobile && separator,
+            (this.device.isTouchScreen || isDarwin) && separator,
             ...options,
             ...options,
             separator,
             separator,
             actionCopyStyles,
             actionCopyStyles,