|
|
@ -1,7 +1,7 @@
|
|
|
|
import React, { useContext } from "react";
|
|
|
|
import React, { useContext } from "react";
|
|
|
|
import { flushSync } from "react-dom";
|
|
|
|
import { flushSync } from "react-dom";
|
|
|
|
|
|
|
|
|
|
|
|
import { RoughCanvas } from "roughjs/bin/canvas";
|
|
|
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
|
|
import rough from "roughjs/bin/rough";
|
|
|
|
import rough from "roughjs/bin/rough";
|
|
|
|
import clsx from "clsx";
|
|
|
|
import clsx from "clsx";
|
|
|
|
import { nanoid } from "nanoid";
|
|
|
|
import { nanoid } from "nanoid";
|
|
|
@ -39,18 +39,16 @@ import {
|
|
|
|
import { createRedoAction, createUndoAction } from "../actions/actionHistory";
|
|
|
|
import { createRedoAction, createUndoAction } from "../actions/actionHistory";
|
|
|
|
import { ActionManager } from "../actions/manager";
|
|
|
|
import { ActionManager } from "../actions/manager";
|
|
|
|
import { actions } from "../actions/register";
|
|
|
|
import { actions } from "../actions/register";
|
|
|
|
import { Action, ActionResult } from "../actions/types";
|
|
|
|
import type { Action, ActionResult } from "../actions/types";
|
|
|
|
import { trackEvent } from "../analytics";
|
|
|
|
import { trackEvent } from "../analytics";
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
getDefaultAppState,
|
|
|
|
getDefaultAppState,
|
|
|
|
isEraserActive,
|
|
|
|
isEraserActive,
|
|
|
|
isHandToolActive,
|
|
|
|
isHandToolActive,
|
|
|
|
} from "../appState";
|
|
|
|
} from "../appState";
|
|
|
|
import {
|
|
|
|
import type { PastedMixedContent } from "../clipboard";
|
|
|
|
PastedMixedContent,
|
|
|
|
import { copyTextToSystemClipboard, parseClipboard } from "../clipboard";
|
|
|
|
copyTextToSystemClipboard,
|
|
|
|
import type { EXPORT_IMAGE_TYPES } from "../constants";
|
|
|
|
parseClipboard,
|
|
|
|
|
|
|
|
} from "../clipboard";
|
|
|
|
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
APP_NAME,
|
|
|
|
APP_NAME,
|
|
|
|
CURSOR_TYPE,
|
|
|
|
CURSOR_TYPE,
|
|
|
@ -62,7 +60,6 @@ import {
|
|
|
|
ENV,
|
|
|
|
ENV,
|
|
|
|
EVENT,
|
|
|
|
EVENT,
|
|
|
|
FRAME_STYLE,
|
|
|
|
FRAME_STYLE,
|
|
|
|
EXPORT_IMAGE_TYPES,
|
|
|
|
|
|
|
|
GRID_SIZE,
|
|
|
|
GRID_SIZE,
|
|
|
|
IMAGE_MIME_TYPES,
|
|
|
|
IMAGE_MIME_TYPES,
|
|
|
|
IMAGE_RENDER_TIMEOUT,
|
|
|
|
IMAGE_RENDER_TIMEOUT,
|
|
|
@ -92,7 +89,8 @@ import {
|
|
|
|
supportsResizeObserver,
|
|
|
|
supportsResizeObserver,
|
|
|
|
DEFAULT_COLLISION_THRESHOLD,
|
|
|
|
DEFAULT_COLLISION_THRESHOLD,
|
|
|
|
} from "../constants";
|
|
|
|
} from "../constants";
|
|
|
|
import { ExportedElements, exportCanvas, loadFromBlob } from "../data";
|
|
|
|
import type { ExportedElements } from "../data";
|
|
|
|
|
|
|
|
import { exportCanvas, loadFromBlob } from "../data";
|
|
|
|
import Library, { distributeLibraryItemsOnSquareGrid } from "../data/library";
|
|
|
|
import Library, { distributeLibraryItemsOnSquareGrid } from "../data/library";
|
|
|
|
import { restore, restoreElements } from "../data/restore";
|
|
|
|
import { restore, restoreElements } from "../data/restore";
|
|
|
|
import {
|
|
|
|
import {
|
|
|
@ -163,7 +161,7 @@ import {
|
|
|
|
isMagicFrameElement,
|
|
|
|
isMagicFrameElement,
|
|
|
|
isTextBindableContainer,
|
|
|
|
isTextBindableContainer,
|
|
|
|
} from "../element/typeChecks";
|
|
|
|
} from "../element/typeChecks";
|
|
|
|
import {
|
|
|
|
import type {
|
|
|
|
ExcalidrawBindableElement,
|
|
|
|
ExcalidrawBindableElement,
|
|
|
|
ExcalidrawElement,
|
|
|
|
ExcalidrawElement,
|
|
|
|
ExcalidrawFreeDrawElement,
|
|
|
|
ExcalidrawFreeDrawElement,
|
|
|
@ -220,20 +218,23 @@ import {
|
|
|
|
isSomeElementSelected,
|
|
|
|
isSomeElementSelected,
|
|
|
|
} from "../scene";
|
|
|
|
} from "../scene";
|
|
|
|
import Scene from "../scene/Scene";
|
|
|
|
import Scene from "../scene/Scene";
|
|
|
|
import { RenderInteractiveSceneCallback, ScrollBars } from "../scene/types";
|
|
|
|
import type {
|
|
|
|
|
|
|
|
RenderInteractiveSceneCallback,
|
|
|
|
|
|
|
|
ScrollBars,
|
|
|
|
|
|
|
|
} from "../scene/types";
|
|
|
|
import { getStateForZoom } from "../scene/zoom";
|
|
|
|
import { getStateForZoom } from "../scene/zoom";
|
|
|
|
import { findShapeByKey } from "../shapes";
|
|
|
|
import { findShapeByKey } from "../shapes";
|
|
|
|
|
|
|
|
import type { GeometricShape } from "@excalidraw/utils";
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
GeometricShape,
|
|
|
|
|
|
|
|
getClosedCurveShape,
|
|
|
|
getClosedCurveShape,
|
|
|
|
getCurveShape,
|
|
|
|
getCurveShape,
|
|
|
|
getEllipseShape,
|
|
|
|
getEllipseShape,
|
|
|
|
getFreedrawShape,
|
|
|
|
getFreedrawShape,
|
|
|
|
getPolygonShape,
|
|
|
|
getPolygonShape,
|
|
|
|
getSelectionBoxShape,
|
|
|
|
getSelectionBoxShape,
|
|
|
|
|
|
|
|
isPointInShape,
|
|
|
|
} from "@excalidraw/utils";
|
|
|
|
} from "@excalidraw/utils";
|
|
|
|
import { isPointInShape } from "@excalidraw/utils";
|
|
|
|
import type {
|
|
|
|
import {
|
|
|
|
|
|
|
|
AppClassProperties,
|
|
|
|
AppClassProperties,
|
|
|
|
AppProps,
|
|
|
|
AppProps,
|
|
|
|
AppState,
|
|
|
|
AppState,
|
|
|
@ -291,11 +292,8 @@ import {
|
|
|
|
maybeParseEmbedSrc,
|
|
|
|
maybeParseEmbedSrc,
|
|
|
|
getEmbedLink,
|
|
|
|
getEmbedLink,
|
|
|
|
} from "../element/embeddable";
|
|
|
|
} from "../element/embeddable";
|
|
|
|
import {
|
|
|
|
import type { ContextMenuItems } from "./ContextMenu";
|
|
|
|
ContextMenu,
|
|
|
|
import { ContextMenu, CONTEXT_MENU_SEPARATOR } from "./ContextMenu";
|
|
|
|
ContextMenuItems,
|
|
|
|
|
|
|
|
CONTEXT_MENU_SEPARATOR,
|
|
|
|
|
|
|
|
} from "./ContextMenu";
|
|
|
|
|
|
|
|
import LayerUI from "./LayerUI";
|
|
|
|
import LayerUI from "./LayerUI";
|
|
|
|
import { Toast } from "./Toast";
|
|
|
|
import { Toast } from "./Toast";
|
|
|
|
import { actionToggleViewMode } from "../actions/actionToggleViewMode";
|
|
|
|
import { actionToggleViewMode } from "../actions/actionToggleViewMode";
|
|
|
@ -320,7 +318,8 @@ import {
|
|
|
|
updateImageCache as _updateImageCache,
|
|
|
|
updateImageCache as _updateImageCache,
|
|
|
|
} from "../element/image";
|
|
|
|
} from "../element/image";
|
|
|
|
import throttle from "lodash.throttle";
|
|
|
|
import throttle from "lodash.throttle";
|
|
|
|
import { fileOpen, FileSystemHandle } from "../data/filesystem";
|
|
|
|
import type { FileSystemHandle } from "../data/filesystem";
|
|
|
|
|
|
|
|
import { fileOpen } from "../data/filesystem";
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
bindTextToShapeAfterDuplication,
|
|
|
|
bindTextToShapeAfterDuplication,
|
|
|
|
getApproxMinLineHeight,
|
|
|
|
getApproxMinLineHeight,
|
|
|
@ -386,11 +385,9 @@ import {
|
|
|
|
import { actionWrapTextInContainer } from "../actions/actionBoundText";
|
|
|
|
import { actionWrapTextInContainer } from "../actions/actionBoundText";
|
|
|
|
import BraveMeasureTextError from "./BraveMeasureTextError";
|
|
|
|
import BraveMeasureTextError from "./BraveMeasureTextError";
|
|
|
|
import { activeEyeDropperAtom } from "./EyeDropper";
|
|
|
|
import { activeEyeDropperAtom } from "./EyeDropper";
|
|
|
|
import {
|
|
|
|
import type { ExcalidrawElementSkeleton } from "../data/transform";
|
|
|
|
ExcalidrawElementSkeleton,
|
|
|
|
import { convertToExcalidrawElements } from "../data/transform";
|
|
|
|
convertToExcalidrawElements,
|
|
|
|
import type { ValueOf } from "../utility-types";
|
|
|
|
} from "../data/transform";
|
|
|
|
|
|
|
|
import { ValueOf } from "../utility-types";
|
|
|
|
|
|
|
|
import { isSidebarDockedAtom } from "./Sidebar/Sidebar";
|
|
|
|
import { isSidebarDockedAtom } from "./Sidebar/Sidebar";
|
|
|
|
import { StaticCanvas, InteractiveCanvas } from "./canvases";
|
|
|
|
import { StaticCanvas, InteractiveCanvas } from "./canvases";
|
|
|
|
import { Renderer } from "../scene/Renderer";
|
|
|
|
import { Renderer } from "../scene/Renderer";
|
|
|
@ -404,7 +401,8 @@ import {
|
|
|
|
} from "../cursor";
|
|
|
|
} from "../cursor";
|
|
|
|
import { Emitter } from "../emitter";
|
|
|
|
import { Emitter } from "../emitter";
|
|
|
|
import { ElementCanvasButtons } from "../element/ElementCanvasButtons";
|
|
|
|
import { ElementCanvasButtons } from "../element/ElementCanvasButtons";
|
|
|
|
import { MagicCacheData, diagramToHTML } from "../data/magic";
|
|
|
|
import type { MagicCacheData } from "../data/magic";
|
|
|
|
|
|
|
|
import { diagramToHTML } from "../data/magic";
|
|
|
|
import { exportToBlob } from "@excalidraw/utils";
|
|
|
|
import { exportToBlob } from "@excalidraw/utils";
|
|
|
|
import { COLOR_PALETTE } from "../colors";
|
|
|
|
import { COLOR_PALETTE } from "../colors";
|
|
|
|
import { ElementCanvasButton } from "./MagicButton";
|
|
|
|
import { ElementCanvasButton } from "./MagicButton";
|
|
|
|