Fix package build

This commit is contained in:
Arun Kumar 2021-02-16 20:12:34 +05:30
parent 4d75a2c795
commit 7bf4a0aac1
2 changed files with 11 additions and 10 deletions

View file

@ -283,6 +283,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
unmounted: boolean = false;
actionManager: ActionManager;
private excalidrawContainerRef = React.createRef<HTMLDivElement>();
_isMobile: boolean;
public static defaultProps: Partial<ExcalidrawProps> = {
width: window.innerWidth,
@ -350,6 +351,8 @@ class App extends React.Component<ExcalidrawProps, AppState> {
this.actionManager.registerAction(createUndoAction(history));
this.actionManager.registerAction(createRedoAction(history));
this._isMobile = isMobile();
}
private renderCanvas() {
@ -972,6 +975,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
},
{
renderOptimizations: true,
renderScrollbars: !this._isMobile,
},
);
if (scrollBars) {
@ -3693,8 +3697,6 @@ class App extends React.Component<ExcalidrawProps, AppState> {
const separator = "separator";
const _isMobile = isMobile();
const elements = this.scene.getElements();
const element = this.getElementAtPosition(x, y);
const options: ContextMenuOption[] = [];
@ -3730,7 +3732,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
ContextMenu.push({
options: [
_isMobile &&
this._isMobile &&
navigator.clipboard && {
name: "paste",
perform: (elements, appStates) => {
@ -3741,7 +3743,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
},
contextItemLabel: "labels.paste",
},
_isMobile && navigator.clipboard && separator,
this._isMobile && navigator.clipboard && separator,
probablySupportsClipboardBlob &&
elements.length > 0 &&
actionCopyAsPng,
@ -3786,9 +3788,9 @@ class App extends React.Component<ExcalidrawProps, AppState> {
ContextMenu.push({
options: [
_isMobile && actionCut,
_isMobile && navigator.clipboard && actionCopy,
_isMobile &&
this._isMobile && actionCut,
this._isMobile && navigator.clipboard && actionCopy,
this._isMobile &&
navigator.clipboard && {
name: "paste",
perform: (elements, appStates) => {
@ -3799,7 +3801,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
},
contextItemLabel: "labels.paste",
},
_isMobile && separator,
this._isMobile && separator,
...options,
separator,
actionCopyStyles,

View file

@ -49,7 +49,6 @@ import {
} from "../element/transformHandles";
import { viewportCoordsToSceneCoords, supportsEmoji } from "../utils";
import { UserIdleState } from "../excalidraw-app/collab/types";
import { isMobile } from "../is-mobile";
const hasEmojiSupport = supportsEmoji();
@ -187,7 +186,7 @@ export const renderScene = (
sceneState: SceneState,
// extra options, currently passed by export helper
{
renderScrollbars = !isMobile(),
renderScrollbars = true,
renderSelection = true,
// Whether to employ render optimizations to improve performance.
// Should not be turned on for export operations and similar, because it