@ -174,6 +174,7 @@ import {
viewportCoordsToSceneCoords ,
viewportCoordsToSceneCoords ,
withBatchedUpdates ,
withBatchedUpdates ,
} from "../utils" ;
} from "../utils" ;
import { isMobile } from "../is-mobile" ;
import ContextMenu from "./ContextMenu" ;
import ContextMenu from "./ContextMenu" ;
import LayerUI from "./LayerUI" ;
import LayerUI from "./LayerUI" ;
import { Stats } from "./Stats" ;
import { Stats } from "./Stats" ;
@ -3625,11 +3626,14 @@ class App extends React.Component<ExcalidrawProps, AppState> {
const separator = "separator" ;
const separator = "separator" ;
const _isMobile = isMobile ( ) ;
const elements = this . scene . getElements ( ) ;
const elements = this . scene . getElements ( ) ;
const element = this . getElementAtPosition ( x , y ) ;
const element = this . getElementAtPosition ( x , y ) ;
if ( ! element ) {
if ( ! element ) {
ContextMenu . push ( {
ContextMenu . push ( {
options : [
options : [
_isMobile &&
navigator . clipboard && {
navigator . clipboard && {
name : "paste" ,
name : "paste" ,
perform : ( elements , appStates ) = > {
perform : ( elements , appStates ) = > {
@ -3640,7 +3644,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
} ,
} ,
contextItemLabel : "labels.paste" ,
contextItemLabel : "labels.paste" ,
} ,
} ,
separator,
_isMobile && navigator . clipboard && separator,
probablySupportsClipboardBlob &&
probablySupportsClipboardBlob &&
elements . length > 0 &&
elements . length > 0 &&
actionCopyAsPng ,
actionCopyAsPng ,
@ -3669,8 +3673,9 @@ class App extends React.Component<ExcalidrawProps, AppState> {
ContextMenu . push ( {
ContextMenu . push ( {
options : [
options : [
actionCut ,
_isMobile && actionCut ,
navigator . clipboard && actionCopy ,
_isMobile && navigator . clipboard && actionCopy ,
_isMobile &&
navigator . clipboard && {
navigator . clipboard && {
name : "paste" ,
name : "paste" ,
perform : ( elements , appStates ) = > {
perform : ( elements , appStates ) = > {
@ -3681,7 +3686,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
} ,
} ,
contextItemLabel : "labels.paste" ,
contextItemLabel : "labels.paste" ,
} ,
} ,
separator,
_isMobile && separator,
probablySupportsClipboardBlob && actionCopyAsPng ,
probablySupportsClipboardBlob && actionCopyAsPng ,
probablySupportsClipboardWriteText && actionCopyAsSvg ,
probablySupportsClipboardWriteText && actionCopyAsSvg ,
separator ,
separator ,