@myoc/excalidraw 0.19.528 → 0.19.529
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/dist/dev/{chunk-NY5S5VQK.js → chunk-7GX2B2N5.js} +63 -51
- package/dist/dev/{chunk-NY5S5VQK.js.map → chunk-7GX2B2N5.js.map} +2 -2
- package/dist/dev/{chunk-6FFT5HLH.js → chunk-H5L4PT3U.js} +2 -2
- package/dist/dev/data/{image-V7WKCORB.js → image-GYAOLTNI.js} +3 -3
- package/dist/dev/index.js +147 -66
- package/dist/dev/index.js.map +3 -3
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/{chunk-ELA2R5XK.js → chunk-5HMH2742.js} +1 -1
- package/dist/prod/{chunk-JCJ2YNSV.js → chunk-CYZQPYCY.js} +3 -3
- package/dist/prod/data/image-O2O5EGGU.js +1 -0
- package/dist/prod/index.js +13 -13
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/excalidraw/components/App.d.ts +2 -0
- package/dist/types/excalidraw/types.d.ts +18 -0
- package/package.json +4 -4
- package/dist/prod/data/image-OSFJHW22.js +0 -1
- /package/dist/dev/{chunk-6FFT5HLH.js.map → chunk-H5L4PT3U.js.map} +0 -0
- /package/dist/dev/data/{image-V7WKCORB.js.map → image-GYAOLTNI.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// <define:import.meta.env>
|
|
2
|
-
var define_import_meta_env_default = { MODE: "development", VITE_APP_BACKEND_V2_GET_URL: "https://json-dev.excalidraw.com/api/v2/", VITE_APP_BACKEND_V2_POST_URL: "https://json-dev.excalidraw.com/api/v2/post/", VITE_APP_LIBRARY_URL: "https://libraries.excalidraw.com", VITE_APP_LIBRARY_BACKEND: "https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries", VITE_APP_WS_SERVER_URL: "http://localhost:3002", VITE_APP_PLUS_LP: "https://plus.excalidraw.com", VITE_APP_PLUS_APP: "http://localhost:3000", VITE_APP_AI_BACKEND: "http://localhost:3016", VITE_APP_FIREBASE_CONFIG: '{"apiKey":"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8","authDomain":"excalidraw-oss-dev.firebaseapp.com","projectId":"excalidraw-oss-dev","storageBucket":"excalidraw-oss-dev.appspot.com","messagingSenderId":"664559512677","appId":"1:664559512677:web:a385181f2928d328a7aa8c"}', VITE_APP_DEV_DISABLE_LIVE_RELOAD: "", VITE_APP_ENABLE_TRACKING: "true", FAST_REFRESH: "false", VITE_APP_PORT: "3001", VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX: "", VITE_APP_COLLAPSE_OVERLAY: "true", VITE_APP_ENABLE_ESLINT: "true", VITE_APP_ENABLE_PWA: "false", VITE_APP_PLUS_EXPORT_PUBLIC_KEY: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\nHQIDAQAB", VITE_APP_DISABLE_PREVENT_UNLOAD: "", PKG_NAME: "@myoc/excalidraw", PKG_VERSION: "0.19.
|
|
2
|
+
var define_import_meta_env_default = { MODE: "development", VITE_APP_BACKEND_V2_GET_URL: "https://json-dev.excalidraw.com/api/v2/", VITE_APP_BACKEND_V2_POST_URL: "https://json-dev.excalidraw.com/api/v2/post/", VITE_APP_LIBRARY_URL: "https://libraries.excalidraw.com", VITE_APP_LIBRARY_BACKEND: "https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries", VITE_APP_WS_SERVER_URL: "http://localhost:3002", VITE_APP_PLUS_LP: "https://plus.excalidraw.com", VITE_APP_PLUS_APP: "http://localhost:3000", VITE_APP_AI_BACKEND: "http://localhost:3016", VITE_APP_FIREBASE_CONFIG: '{"apiKey":"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8","authDomain":"excalidraw-oss-dev.firebaseapp.com","projectId":"excalidraw-oss-dev","storageBucket":"excalidraw-oss-dev.appspot.com","messagingSenderId":"664559512677","appId":"1:664559512677:web:a385181f2928d328a7aa8c"}', VITE_APP_DEV_DISABLE_LIVE_RELOAD: "", VITE_APP_ENABLE_TRACKING: "true", FAST_REFRESH: "false", VITE_APP_PORT: "3001", VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX: "", VITE_APP_COLLAPSE_OVERLAY: "true", VITE_APP_ENABLE_ESLINT: "true", VITE_APP_ENABLE_PWA: "false", VITE_APP_PLUS_EXPORT_PUBLIC_KEY: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\nHQIDAQAB", VITE_APP_DISABLE_PREVENT_UNLOAD: "", PKG_NAME: "@myoc/excalidraw", PKG_VERSION: "0.19.528", DEV: true };
|
|
3
3
|
|
|
4
4
|
export {
|
|
5
5
|
define_import_meta_env_default
|
|
6
6
|
};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-H5L4PT3U.js.map
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
decodePngMetadata,
|
|
3
3
|
encodePngMetadata,
|
|
4
4
|
getTEXtChunk
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-7GX2B2N5.js";
|
|
6
|
+
import "../chunk-H5L4PT3U.js";
|
|
7
7
|
import "../chunk-XDFCUUT6.js";
|
|
8
8
|
export {
|
|
9
9
|
decodePngMetadata,
|
|
10
10
|
encodePngMetadata,
|
|
11
11
|
getTEXtChunk
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=image-
|
|
13
|
+
//# sourceMappingURL=image-GYAOLTNI.js.map
|
package/dist/dev/index.js
CHANGED
|
@@ -62,10 +62,10 @@ import {
|
|
|
62
62
|
serializeAsJSON,
|
|
63
63
|
strokeRectWithRotation_simple,
|
|
64
64
|
zoomToFitBounds
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-7GX2B2N5.js";
|
|
66
66
|
import {
|
|
67
67
|
define_import_meta_env_default
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-H5L4PT3U.js";
|
|
69
69
|
import {
|
|
70
70
|
en_default
|
|
71
71
|
} from "./chunk-SKCAT7JG.js";
|
|
@@ -10936,7 +10936,7 @@ var exportCanvas = async (type, elements, appState, files, {
|
|
|
10936
10936
|
let blob = canvasToBlob(tempCanvas);
|
|
10937
10937
|
if (appState.exportEmbedScene) {
|
|
10938
10938
|
blob = blob.then(
|
|
10939
|
-
(blob2) => import("./data/image-
|
|
10939
|
+
(blob2) => import("./data/image-GYAOLTNI.js").then(
|
|
10940
10940
|
({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
|
|
10941
10941
|
blob: blob2,
|
|
10942
10942
|
metadata: serializeAsJSON(elements, appState, files, "local")
|
|
@@ -16832,12 +16832,13 @@ var actionToggleViewMode = register({
|
|
|
16832
16832
|
if (appState.viewModeOnly || appProps.viewModeOnly) {
|
|
16833
16833
|
return null;
|
|
16834
16834
|
}
|
|
16835
|
+
const label = appState.viewModeEnabled ? "Edit mode" : t("labels.viewMode");
|
|
16835
16836
|
return /* @__PURE__ */ jsx58(
|
|
16836
16837
|
IconButton,
|
|
16837
16838
|
{
|
|
16838
16839
|
type: "button",
|
|
16839
|
-
icon: eyeIcon,
|
|
16840
|
-
"aria-label":
|
|
16840
|
+
icon: appState.viewModeEnabled ? pencilIcon : eyeIcon,
|
|
16841
|
+
"aria-label": label,
|
|
16841
16842
|
onClick: () => updateData(null),
|
|
16842
16843
|
size: data?.size || "medium",
|
|
16843
16844
|
"data-testid": "button-view-mode",
|
|
@@ -26238,17 +26239,6 @@ var ExitZenModeButton = ({
|
|
|
26238
26239
|
children: t("buttons.exitZenMode")
|
|
26239
26240
|
}
|
|
26240
26241
|
);
|
|
26241
|
-
var ExitViewModeButton = ({
|
|
26242
|
-
actionManager
|
|
26243
|
-
}) => /* @__PURE__ */ jsx66(
|
|
26244
|
-
"button",
|
|
26245
|
-
{
|
|
26246
|
-
type: "button",
|
|
26247
|
-
className: "disable-view-mode",
|
|
26248
|
-
onClick: () => actionManager.executeAction(actionToggleViewMode),
|
|
26249
|
-
children: pencilIcon
|
|
26250
|
-
}
|
|
26251
|
-
);
|
|
26252
26242
|
|
|
26253
26243
|
// components/LoadingMessage.tsx
|
|
26254
26244
|
import clsx29 from "clsx";
|
|
@@ -27038,22 +27028,19 @@ var MobileMenu = ({
|
|
|
27038
27028
|
if (appState.openDialog?.name === "elementLinkSelector") {
|
|
27039
27029
|
return null;
|
|
27040
27030
|
}
|
|
27041
|
-
const topRightUI = /* @__PURE__ */
|
|
27042
|
-
|
|
27043
|
-
|
|
27044
|
-
|
|
27045
|
-
|
|
27046
|
-
|
|
27047
|
-
|
|
27048
|
-
|
|
27049
|
-
|
|
27050
|
-
|
|
27051
|
-
|
|
27052
|
-
|
|
27053
|
-
|
|
27054
|
-
] })),
|
|
27055
|
-
defaultUIEnabled && appState.viewModeEnabled && app.isInteractionEnabled() && /* @__PURE__ */ jsx80(ExitViewModeButton, { actionManager })
|
|
27056
|
-
] });
|
|
27031
|
+
const topRightUI = /* @__PURE__ */ jsx80("div", { className: "excalidraw-ui-top-right", children: renderTopRightUI?.(true, appState) ?? (!appState.viewModeEnabled && /* @__PURE__ */ jsxs39(Fragment11, { children: [
|
|
27032
|
+
defaultUIEnabled && /* @__PURE__ */ jsx80(
|
|
27033
|
+
PenModeButton,
|
|
27034
|
+
{
|
|
27035
|
+
checked: appState.penMode,
|
|
27036
|
+
onChange: () => onPenModeToggle(null),
|
|
27037
|
+
title: t("toolBar.penMode"),
|
|
27038
|
+
isMobile: true,
|
|
27039
|
+
penDetected: appState.penDetected
|
|
27040
|
+
}
|
|
27041
|
+
),
|
|
27042
|
+
/* @__PURE__ */ jsx80(DefaultSidebarTriggerTunnel.Out, {})
|
|
27043
|
+
] })) });
|
|
27057
27044
|
const topLeftUI = /* @__PURE__ */ jsxs39("div", { className: "excalidraw-ui-top-left", children: [
|
|
27058
27045
|
renderTopLeftUI?.(true, appState),
|
|
27059
27046
|
/* @__PURE__ */ jsx80(MainMenuTunnel.Out, {})
|
|
@@ -27816,7 +27803,13 @@ var Footer = ({
|
|
|
27816
27803
|
}
|
|
27817
27804
|
),
|
|
27818
27805
|
children: /* @__PURE__ */ jsx87(Stack_default.Col, { gap: 2, children: /* @__PURE__ */ jsxs45(Section, { heading: "canvasActions", children: [
|
|
27819
|
-
!appState.viewModeOnly && /* @__PURE__ */ jsx87(
|
|
27806
|
+
!appState.viewModeOnly && /* @__PURE__ */ jsx87(
|
|
27807
|
+
Tooltip,
|
|
27808
|
+
{
|
|
27809
|
+
label: appState.viewModeEnabled ? "Edit mode" : t("labels.viewMode"),
|
|
27810
|
+
children: /* @__PURE__ */ jsx87("div", { className: clsx39("view-mode-button"), children: actionManager.renderAction("viewMode") })
|
|
27811
|
+
}
|
|
27812
|
+
),
|
|
27820
27813
|
/* @__PURE__ */ jsx87(Tooltip, { label: t("buttons.smartZoom"), children: /* @__PURE__ */ jsx87("div", { className: clsx39("smart-zoom-button"), children: actionManager.renderAction("smartZoom") }) }),
|
|
27821
27814
|
zoomUIEnabled && app.isNavigationEnabled() && /* @__PURE__ */ jsx87(ZoomActions, { renderAction: actionManager.renderAction }),
|
|
27822
27815
|
defaultUIEnabled && !appState.viewModeEnabled && /* @__PURE__ */ jsx87(
|
|
@@ -33418,10 +33411,14 @@ var DefaultSidebar = Object.assign(
|
|
|
33418
33411
|
children,
|
|
33419
33412
|
className,
|
|
33420
33413
|
docked,
|
|
33414
|
+
onDock,
|
|
33421
33415
|
...rest
|
|
33422
33416
|
}) => {
|
|
33423
33417
|
const appState = useUIAppState();
|
|
33418
|
+
const setAppState = useExcalidrawSetAppState();
|
|
33424
33419
|
const isSearchSidebar = appState.openSidebar?.tab === CANVAS_SEARCH_TAB2;
|
|
33420
|
+
const isDocked = isSearchSidebar ? false : docked ?? appState.defaultSidebarDockedPreference;
|
|
33421
|
+
const canDock = !isSearchSidebar && docked == null && onDock !== false;
|
|
33425
33422
|
return /* @__PURE__ */ createElement2(
|
|
33426
33423
|
Sidebar,
|
|
33427
33424
|
{
|
|
@@ -33433,8 +33430,13 @@ var DefaultSidebar = Object.assign(
|
|
|
33433
33430
|
{ "default-sidebar--search-only": isSearchSidebar },
|
|
33434
33431
|
className
|
|
33435
33432
|
),
|
|
33436
|
-
docked:
|
|
33437
|
-
onDock:
|
|
33433
|
+
docked: isDocked,
|
|
33434
|
+
onDock: canDock ? (nextDocked) => {
|
|
33435
|
+
setAppState({
|
|
33436
|
+
defaultSidebarDockedPreference: nextDocked
|
|
33437
|
+
});
|
|
33438
|
+
onDock?.(nextDocked);
|
|
33439
|
+
} : void 0
|
|
33438
33440
|
},
|
|
33439
33441
|
/* @__PURE__ */ jsxs64(Sidebar.Tabs, { children: [
|
|
33440
33442
|
!isSearchSidebar && /* @__PURE__ */ jsx124(Sidebar.Header, {}),
|
|
@@ -34302,7 +34304,8 @@ var LayerUI = ({
|
|
|
34302
34304
|
const renderCanvasActions = () => /* @__PURE__ */ jsxs67("div", { style: { position: "relative" }, children: [
|
|
34303
34305
|
/* @__PURE__ */ jsxs67("div", { className: "excalidraw-ui-top-left", children: [
|
|
34304
34306
|
renderTopLeftUI?.(false, appState),
|
|
34305
|
-
/* @__PURE__ */ jsx131(tunnels.MainMenuTunnel.Out, {})
|
|
34307
|
+
/* @__PURE__ */ jsx131(tunnels.MainMenuTunnel.Out, {}),
|
|
34308
|
+
/* @__PURE__ */ jsx131(tunnels.DefaultSidebarTriggerTunnel.Out, {})
|
|
34306
34309
|
] }),
|
|
34307
34310
|
renderWelcomeScreen && /* @__PURE__ */ jsx131(tunnels.WelcomeScreenMenuHintTunnel.Out, {})
|
|
34308
34311
|
] });
|
|
@@ -34642,9 +34645,9 @@ var LayerUI = ({
|
|
|
34642
34645
|
] })
|
|
34643
34646
|
]
|
|
34644
34647
|
}
|
|
34645
|
-
)
|
|
34646
|
-
|
|
34647
|
-
|
|
34648
|
+
)
|
|
34649
|
+
] }),
|
|
34650
|
+
renderSidebars()
|
|
34648
34651
|
] });
|
|
34649
34652
|
return /* @__PURE__ */ jsx131(UIAppStateContext.Provider, { value: appState, children: /* @__PURE__ */ jsx131(TunnelsJotaiProvider, { children: /* @__PURE__ */ jsx131(TunnelsContext.Provider, { value: tunnels, children: layerUIJSX }) }) });
|
|
34650
34653
|
};
|
|
@@ -36644,6 +36647,20 @@ var App = class _App extends React40.Component {
|
|
|
36644
36647
|
const dataTransferList = await parseDataTransferEvent(event);
|
|
36645
36648
|
const filesList = dataTransferList.getFiles();
|
|
36646
36649
|
const data = await parseClipboard(dataTransferList, isPlainPaste);
|
|
36650
|
+
if (this.state.viewModeEnabled) {
|
|
36651
|
+
if (!this.containsImagePaste(data, filesList, isPlainPaste)) {
|
|
36652
|
+
return;
|
|
36653
|
+
}
|
|
36654
|
+
if (!this.shouldInsertImageInViewMode({
|
|
36655
|
+
source: "paste",
|
|
36656
|
+
files: filesList.map((file2) => file2.file),
|
|
36657
|
+
data,
|
|
36658
|
+
event
|
|
36659
|
+
})) {
|
|
36660
|
+
event?.preventDefault();
|
|
36661
|
+
return;
|
|
36662
|
+
}
|
|
36663
|
+
}
|
|
36647
36664
|
if (this.props.onPaste) {
|
|
36648
36665
|
try {
|
|
36649
36666
|
if (await this.props.onPaste(data, event) === false) {
|
|
@@ -40373,9 +40390,8 @@ var App = class _App extends React40.Component {
|
|
|
40373
40390
|
if (!isSupportedImageFile(imageFile)) {
|
|
40374
40391
|
throw new Error(t("errors.unsupportedFileType"));
|
|
40375
40392
|
}
|
|
40376
|
-
const mimeType = imageFile.type;
|
|
40377
40393
|
this.cursor.set("wait");
|
|
40378
|
-
if (
|
|
40394
|
+
if (imageFile.type === MIME_TYPES9.svg) {
|
|
40379
40395
|
try {
|
|
40380
40396
|
imageFile = SVGStringToFile(
|
|
40381
40397
|
normalizeSVG(await imageFile.text()),
|
|
@@ -40385,7 +40401,18 @@ var App = class _App extends React40.Component {
|
|
|
40385
40401
|
console.warn(error);
|
|
40386
40402
|
throw new Error(t("errors.svgImageInsertError"));
|
|
40387
40403
|
}
|
|
40404
|
+
} else {
|
|
40405
|
+
const { maxWidthOrHeight } = this.props.imageOptions;
|
|
40406
|
+
try {
|
|
40407
|
+
imageFile = await (this.props.compressImageFile ?? resizeImageFile)(
|
|
40408
|
+
imageFile,
|
|
40409
|
+
{ maxWidthOrHeight }
|
|
40410
|
+
);
|
|
40411
|
+
} catch (error) {
|
|
40412
|
+
console.error("Error trying to resize image file on insertion", error);
|
|
40413
|
+
}
|
|
40388
40414
|
}
|
|
40415
|
+
const mimeType = imageFile.type;
|
|
40389
40416
|
const fileId = await (this.props.generateIdForFile?.(
|
|
40390
40417
|
imageFile
|
|
40391
40418
|
) || generateIdFromFile(imageFile));
|
|
@@ -40397,15 +40424,7 @@ var App = class _App extends React40.Component {
|
|
|
40397
40424
|
}
|
|
40398
40425
|
const existingFileData = this.files[fileId];
|
|
40399
40426
|
if (!existingFileData?.dataURL) {
|
|
40400
|
-
const {
|
|
40401
|
-
try {
|
|
40402
|
-
imageFile = await (this.props.compressImageFile ?? resizeImageFile)(
|
|
40403
|
-
imageFile,
|
|
40404
|
-
{ maxWidthOrHeight }
|
|
40405
|
-
);
|
|
40406
|
-
} catch (error) {
|
|
40407
|
-
console.error("Error trying to resize image file on insertion", error);
|
|
40408
|
-
}
|
|
40427
|
+
const { maxFileSizeBytes } = this.props.imageOptions;
|
|
40409
40428
|
if (imageFile.size > maxFileSizeBytes) {
|
|
40410
40429
|
throw new Error(
|
|
40411
40430
|
t("errors.fileTooBig", {
|
|
@@ -40709,6 +40728,29 @@ var App = class _App extends React40.Component {
|
|
|
40709
40728
|
const dragDataSnapshot = captureDragEventData(event);
|
|
40710
40729
|
const dataTransferList = await parseDataTransferEvent(event);
|
|
40711
40730
|
const fileItems = dataTransferList.getFiles();
|
|
40731
|
+
const imageFiles = fileItems.map((data) => data.file).filter((file2) => isSupportedImageFile(file2));
|
|
40732
|
+
if (this.state.viewModeEnabled) {
|
|
40733
|
+
if (imageFiles.length === 0 || !this.isToolSupported("image")) {
|
|
40734
|
+
return;
|
|
40735
|
+
}
|
|
40736
|
+
if (!this.shouldInsertImageInViewMode({
|
|
40737
|
+
source: "drop",
|
|
40738
|
+
files: imageFiles,
|
|
40739
|
+
event
|
|
40740
|
+
})) {
|
|
40741
|
+
return;
|
|
40742
|
+
}
|
|
40743
|
+
return this.insertImages(
|
|
40744
|
+
imageFiles,
|
|
40745
|
+
sceneX,
|
|
40746
|
+
sceneY,
|
|
40747
|
+
parseDragImageMetadata(
|
|
40748
|
+
dataTransferList,
|
|
40749
|
+
imageFiles.length,
|
|
40750
|
+
dragDataSnapshot
|
|
40751
|
+
)
|
|
40752
|
+
);
|
|
40753
|
+
}
|
|
40712
40754
|
if (fileItems.length === 1) {
|
|
40713
40755
|
const { file: file2, fileHandle } = fileItems[0];
|
|
40714
40756
|
if (file2 && (file2.type === MIME_TYPES9.png || file2.type === MIME_TYPES9.svg)) {
|
|
@@ -40736,7 +40778,6 @@ var App = class _App extends React40.Component {
|
|
|
40736
40778
|
}
|
|
40737
40779
|
}
|
|
40738
40780
|
}
|
|
40739
|
-
const imageFiles = fileItems.map((data) => data.file).filter((file2) => isSupportedImageFile(file2));
|
|
40740
40781
|
if (imageFiles.length > 0 && this.isToolSupported("image")) {
|
|
40741
40782
|
return this.insertImages(
|
|
40742
40783
|
imageFiles,
|
|
@@ -42644,6 +42685,21 @@ var App = class _App extends React40.Component {
|
|
|
42644
42685
|
EVENT11.GESTURE_END,
|
|
42645
42686
|
this.onGestureEnd,
|
|
42646
42687
|
false
|
|
42688
|
+
),
|
|
42689
|
+
addEventListener2(document, EVENT11.PASTE, this.pasteFromClipboard, {
|
|
42690
|
+
passive: false
|
|
42691
|
+
}),
|
|
42692
|
+
addEventListener2(
|
|
42693
|
+
this.excalidrawContainerRef.current,
|
|
42694
|
+
EVENT11.DRAG_OVER,
|
|
42695
|
+
this.disableEvent,
|
|
42696
|
+
false
|
|
42697
|
+
),
|
|
42698
|
+
addEventListener2(
|
|
42699
|
+
this.excalidrawContainerRef.current,
|
|
42700
|
+
EVENT11.DROP,
|
|
42701
|
+
this.disableEvent,
|
|
42702
|
+
false
|
|
42647
42703
|
)
|
|
42648
42704
|
);
|
|
42649
42705
|
if (this.state.viewModeEnabled) {
|
|
@@ -42656,9 +42712,6 @@ var App = class _App extends React40.Component {
|
|
|
42656
42712
|
this.onFullscreenChange,
|
|
42657
42713
|
{ passive: false }
|
|
42658
42714
|
),
|
|
42659
|
-
addEventListener2(document, EVENT11.PASTE, this.pasteFromClipboard, {
|
|
42660
|
-
passive: false
|
|
42661
|
-
}),
|
|
42662
42715
|
addEventListener2(document, EVENT11.CUT, this.onCut, { passive: false }),
|
|
42663
42716
|
addEventListener2(window, EVENT11.RESIZE, this.onResize, false),
|
|
42664
42717
|
addEventListener2(window, EVENT11.UNLOAD, this.onUnload, false),
|
|
@@ -42668,18 +42721,6 @@ var App = class _App extends React40.Component {
|
|
|
42668
42721
|
EVENT11.WHEEL,
|
|
42669
42722
|
this.handleWheel,
|
|
42670
42723
|
{ passive: false }
|
|
42671
|
-
),
|
|
42672
|
-
addEventListener2(
|
|
42673
|
-
this.excalidrawContainerRef.current,
|
|
42674
|
-
EVENT11.DRAG_OVER,
|
|
42675
|
-
this.disableEvent,
|
|
42676
|
-
false
|
|
42677
|
-
),
|
|
42678
|
-
addEventListener2(
|
|
42679
|
-
this.excalidrawContainerRef.current,
|
|
42680
|
-
EVENT11.DROP,
|
|
42681
|
-
this.disableEvent,
|
|
42682
|
-
false
|
|
42683
42724
|
)
|
|
42684
42725
|
);
|
|
42685
42726
|
if (this.props.detectScroll) {
|
|
@@ -42902,6 +42943,42 @@ var App = class _App extends React40.Component {
|
|
|
42902
42943
|
}
|
|
42903
42944
|
this.addTextFromPaste(data.text, isPlainPaste);
|
|
42904
42945
|
}
|
|
42946
|
+
containsImagePaste(data, dataTransferFiles, isPlainPaste) {
|
|
42947
|
+
if (dataTransferFiles.some((data2) => isSupportedImageFile(data2.file))) {
|
|
42948
|
+
return true;
|
|
42949
|
+
}
|
|
42950
|
+
if (!isPlainPaste && data.mixedContent?.some((node) => node.type === "imageUrl")) {
|
|
42951
|
+
return true;
|
|
42952
|
+
}
|
|
42953
|
+
if (isPlainPaste || !data.text) {
|
|
42954
|
+
return false;
|
|
42955
|
+
}
|
|
42956
|
+
const trimmedText = data.text.trim();
|
|
42957
|
+
return trimmedText.startsWith("<svg") && trimmedText.endsWith("</svg>");
|
|
42958
|
+
}
|
|
42959
|
+
shouldInsertImageInViewMode({
|
|
42960
|
+
source,
|
|
42961
|
+
files,
|
|
42962
|
+
data,
|
|
42963
|
+
event
|
|
42964
|
+
}) {
|
|
42965
|
+
if (!this.state.viewModeEnabled) {
|
|
42966
|
+
return true;
|
|
42967
|
+
}
|
|
42968
|
+
if (this.state.viewModeOnly || this.props.viewModeImageInsertBehavior === "reject") {
|
|
42969
|
+
this.props.onViewModeImageInsertRejected?.({
|
|
42970
|
+
source,
|
|
42971
|
+
files,
|
|
42972
|
+
data,
|
|
42973
|
+
event
|
|
42974
|
+
});
|
|
42975
|
+
return false;
|
|
42976
|
+
}
|
|
42977
|
+
flushSync2(() => {
|
|
42978
|
+
this.setState({ viewModeEnabled: false });
|
|
42979
|
+
});
|
|
42980
|
+
return true;
|
|
42981
|
+
}
|
|
42905
42982
|
// TODO rewrite this to paste both text & images at the same time if
|
|
42906
42983
|
// pasted data contains both
|
|
42907
42984
|
async addElementsFromMixedContentPaste(mixedContent, {
|
|
@@ -45619,6 +45696,8 @@ var ExcalidrawBase = (props) => {
|
|
|
45619
45696
|
editorPreferences,
|
|
45620
45697
|
onEditorPreferencesChange,
|
|
45621
45698
|
onPaste,
|
|
45699
|
+
viewModeImageInsertBehavior,
|
|
45700
|
+
onViewModeImageInsertRejected,
|
|
45622
45701
|
detectScroll = true,
|
|
45623
45702
|
handleKeyboardGlobally = false,
|
|
45624
45703
|
autoFocus = false,
|
|
@@ -45732,6 +45811,8 @@ var ExcalidrawBase = (props) => {
|
|
|
45732
45811
|
onEditorPreferencesChange,
|
|
45733
45812
|
UIOptions,
|
|
45734
45813
|
onPaste,
|
|
45814
|
+
viewModeImageInsertBehavior,
|
|
45815
|
+
onViewModeImageInsertRejected,
|
|
45735
45816
|
detectScroll,
|
|
45736
45817
|
handleKeyboardGlobally,
|
|
45737
45818
|
autoFocus,
|