@myoc/excalidraw 0.19.527 → 0.19.528
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 +53 -0
- package/dist/dev/{chunk-YNR3T55S.js → chunk-6FFT5HLH.js} +2 -2
- package/dist/dev/{chunk-N6LESYN7.js → chunk-NY5S5VQK.js} +4 -3
- package/dist/dev/data/{image-D6KDEKKI.js → image-V7WKCORB.js} +3 -3
- package/dist/dev/index.js +136 -161
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/{chunk-FIMIHFNX.js → chunk-ELA2R5XK.js} +1 -1
- package/dist/prod/{chunk-K3ZT7LUU.js → chunk-JCJ2YNSV.js} +2 -2
- package/dist/prod/data/image-OSFJHW22.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/actions/actionElementLink.d.ts +0 -27
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/components/App.d.ts +3 -0
- package/package.json +4 -4
- package/dist/prod/data/image-GHQKUZQU.js +0 -1
- /package/dist/dev/{chunk-YNR3T55S.js.map → chunk-6FFT5HLH.js.map} +0 -0
- /package/dist/dev/{chunk-N6LESYN7.js.map → chunk-NY5S5VQK.js.map} +0 -0
- /package/dist/dev/data/{image-D6KDEKKI.js.map → image-V7WKCORB.js.map} +0 -0
package/dist/dev/index.js
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
isImageFileHandle,
|
|
45
45
|
isImageFileHandleType,
|
|
46
46
|
isPointHittingLink,
|
|
47
|
+
isPointHittingLinkIcon,
|
|
47
48
|
isSomeElementSelected,
|
|
48
49
|
isSupportedImageFile,
|
|
49
50
|
isSupportedImageFileType,
|
|
@@ -61,10 +62,10 @@ import {
|
|
|
61
62
|
serializeAsJSON,
|
|
62
63
|
strokeRectWithRotation_simple,
|
|
63
64
|
zoomToFitBounds
|
|
64
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-NY5S5VQK.js";
|
|
65
66
|
import {
|
|
66
67
|
define_import_meta_env_default
|
|
67
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-6FFT5HLH.js";
|
|
68
69
|
import {
|
|
69
70
|
en_default
|
|
70
71
|
} from "./chunk-SKCAT7JG.js";
|
|
@@ -317,7 +318,7 @@ import {
|
|
|
317
318
|
getDragOffsetXY,
|
|
318
319
|
Scene as Scene2,
|
|
319
320
|
Store,
|
|
320
|
-
CaptureUpdateAction as
|
|
321
|
+
CaptureUpdateAction as CaptureUpdateAction39,
|
|
321
322
|
hitElementBoundingBox as hitElementBoundingBox2,
|
|
322
323
|
isLineElement as isLineElement9,
|
|
323
324
|
isSimpleArrow,
|
|
@@ -10935,7 +10936,7 @@ var exportCanvas = async (type, elements, appState, files, {
|
|
|
10935
10936
|
let blob = canvasToBlob(tempCanvas);
|
|
10936
10937
|
if (appState.exportEmbedScene) {
|
|
10937
10938
|
blob = blob.then(
|
|
10938
|
-
(blob2) => import("./data/image-
|
|
10939
|
+
(blob2) => import("./data/image-V7WKCORB.js").then(
|
|
10939
10940
|
({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
|
|
10940
10941
|
blob: blob2,
|
|
10941
10942
|
metadata: serializeAsJSON(elements, appState, files, "local")
|
|
@@ -16295,94 +16296,6 @@ var actionToggleCropEditor = register({
|
|
|
16295
16296
|
}
|
|
16296
16297
|
});
|
|
16297
16298
|
|
|
16298
|
-
// actions/actionElementLink.ts
|
|
16299
|
-
import {
|
|
16300
|
-
canCreateLinkFromElements,
|
|
16301
|
-
defaultGetElementLinkFromSelection,
|
|
16302
|
-
getLinkIdAndTypeFromSelection
|
|
16303
|
-
} from "@excalidraw/element";
|
|
16304
|
-
import { CaptureUpdateAction as CaptureUpdateAction32 } from "@excalidraw/element";
|
|
16305
|
-
var actionCopyElementLink = register({
|
|
16306
|
-
name: "copyElementLink",
|
|
16307
|
-
label: "labels.copyElementLink",
|
|
16308
|
-
icon: copyIcon,
|
|
16309
|
-
trackEvent: { category: "element" },
|
|
16310
|
-
perform: async (elements, appState, _, app) => {
|
|
16311
|
-
const selectedElements = getSelectedElements(elements, appState);
|
|
16312
|
-
try {
|
|
16313
|
-
if (window.location) {
|
|
16314
|
-
const idAndType = getLinkIdAndTypeFromSelection(
|
|
16315
|
-
selectedElements,
|
|
16316
|
-
appState
|
|
16317
|
-
);
|
|
16318
|
-
if (idAndType) {
|
|
16319
|
-
await copyTextToSystemClipboard(
|
|
16320
|
-
app.props.generateLinkForSelection ? app.props.generateLinkForSelection(idAndType.id, idAndType.type) : defaultGetElementLinkFromSelection(
|
|
16321
|
-
idAndType.id,
|
|
16322
|
-
idAndType.type
|
|
16323
|
-
)
|
|
16324
|
-
);
|
|
16325
|
-
return {
|
|
16326
|
-
appState: {
|
|
16327
|
-
toast: {
|
|
16328
|
-
message: t("toast.elementLinkCopied"),
|
|
16329
|
-
closable: true
|
|
16330
|
-
}
|
|
16331
|
-
},
|
|
16332
|
-
captureUpdate: CaptureUpdateAction32.EVENTUALLY
|
|
16333
|
-
};
|
|
16334
|
-
}
|
|
16335
|
-
return {
|
|
16336
|
-
appState,
|
|
16337
|
-
elements,
|
|
16338
|
-
app,
|
|
16339
|
-
captureUpdate: CaptureUpdateAction32.EVENTUALLY
|
|
16340
|
-
};
|
|
16341
|
-
}
|
|
16342
|
-
} catch (error) {
|
|
16343
|
-
console.error(error);
|
|
16344
|
-
}
|
|
16345
|
-
return {
|
|
16346
|
-
appState,
|
|
16347
|
-
elements,
|
|
16348
|
-
app,
|
|
16349
|
-
captureUpdate: CaptureUpdateAction32.EVENTUALLY
|
|
16350
|
-
};
|
|
16351
|
-
},
|
|
16352
|
-
predicate: (elements, appState) => canCreateLinkFromElements(getSelectedElements(elements, appState))
|
|
16353
|
-
});
|
|
16354
|
-
var actionLinkToElement = register({
|
|
16355
|
-
name: "linkToElement",
|
|
16356
|
-
label: "labels.linkToElement",
|
|
16357
|
-
icon: elementLinkIcon,
|
|
16358
|
-
perform: (elements, appState, _, app) => {
|
|
16359
|
-
const selectedElements = getSelectedElements(elements, appState);
|
|
16360
|
-
if (selectedElements.length !== 1 || !canCreateLinkFromElements(selectedElements)) {
|
|
16361
|
-
return {
|
|
16362
|
-
elements,
|
|
16363
|
-
appState,
|
|
16364
|
-
app,
|
|
16365
|
-
captureUpdate: CaptureUpdateAction32.EVENTUALLY
|
|
16366
|
-
};
|
|
16367
|
-
}
|
|
16368
|
-
return {
|
|
16369
|
-
appState: {
|
|
16370
|
-
...appState,
|
|
16371
|
-
openDialog: {
|
|
16372
|
-
name: "elementLinkSelector",
|
|
16373
|
-
sourceElementId: getSelectedElements(elements, appState)[0].id
|
|
16374
|
-
}
|
|
16375
|
-
},
|
|
16376
|
-
captureUpdate: CaptureUpdateAction32.IMMEDIATELY
|
|
16377
|
-
};
|
|
16378
|
-
},
|
|
16379
|
-
predicate: (elements, appState, appProps, app) => {
|
|
16380
|
-
const selectedElements = getSelectedElements(elements, appState);
|
|
16381
|
-
return appState.openDialog?.name !== "elementLinkSelector" && selectedElements.length === 1 && canCreateLinkFromElements(selectedElements);
|
|
16382
|
-
},
|
|
16383
|
-
trackEvent: false
|
|
16384
|
-
});
|
|
16385
|
-
|
|
16386
16299
|
// actions/actionFrame.ts
|
|
16387
16300
|
import { getNonDeletedElements as getNonDeletedElements14 } from "@excalidraw/element";
|
|
16388
16301
|
import { mutateElement as mutateElement4 } from "@excalidraw/element";
|
|
@@ -16395,7 +16308,7 @@ import {
|
|
|
16395
16308
|
import { getFrameChildren as getFrameChildren3 } from "@excalidraw/element";
|
|
16396
16309
|
import { getElementsInGroup as getElementsInGroup6 } from "@excalidraw/element";
|
|
16397
16310
|
import { getCommonBounds as getCommonBounds3 } from "@excalidraw/element";
|
|
16398
|
-
import { CaptureUpdateAction as
|
|
16311
|
+
import { CaptureUpdateAction as CaptureUpdateAction32 } from "@excalidraw/element";
|
|
16399
16312
|
var isSingleFrameSelected = (appState, app) => {
|
|
16400
16313
|
const selectedElements = app.scene.getSelectedElements(appState);
|
|
16401
16314
|
return selectedElements.length === 1 && isFrameLikeElement9(selectedElements[0]);
|
|
@@ -16420,13 +16333,13 @@ var actionSelectAllElementsInFrame = register({
|
|
|
16420
16333
|
return acc;
|
|
16421
16334
|
}, {})
|
|
16422
16335
|
},
|
|
16423
|
-
captureUpdate:
|
|
16336
|
+
captureUpdate: CaptureUpdateAction32.IMMEDIATELY
|
|
16424
16337
|
};
|
|
16425
16338
|
}
|
|
16426
16339
|
return {
|
|
16427
16340
|
elements,
|
|
16428
16341
|
appState,
|
|
16429
|
-
captureUpdate:
|
|
16342
|
+
captureUpdate: CaptureUpdateAction32.EVENTUALLY
|
|
16430
16343
|
};
|
|
16431
16344
|
},
|
|
16432
16345
|
predicate: (elements, appState, _, app) => isSingleFrameSelected(appState, app)
|
|
@@ -16446,13 +16359,13 @@ var actionRemoveAllElementsFromFrame = register({
|
|
|
16446
16359
|
[selectedElement.id]: true
|
|
16447
16360
|
}
|
|
16448
16361
|
},
|
|
16449
|
-
captureUpdate:
|
|
16362
|
+
captureUpdate: CaptureUpdateAction32.IMMEDIATELY
|
|
16450
16363
|
};
|
|
16451
16364
|
}
|
|
16452
16365
|
return {
|
|
16453
16366
|
elements,
|
|
16454
16367
|
appState,
|
|
16455
|
-
captureUpdate:
|
|
16368
|
+
captureUpdate: CaptureUpdateAction32.EVENTUALLY
|
|
16456
16369
|
};
|
|
16457
16370
|
},
|
|
16458
16371
|
predicate: (elements, appState, _, app) => isSingleFrameSelected(appState, app)
|
|
@@ -16472,7 +16385,7 @@ var actionupdateFrameRendering = register({
|
|
|
16472
16385
|
enabled: !appState.frameRendering.enabled
|
|
16473
16386
|
}
|
|
16474
16387
|
},
|
|
16475
|
-
captureUpdate:
|
|
16388
|
+
captureUpdate: CaptureUpdateAction32.EVENTUALLY
|
|
16476
16389
|
};
|
|
16477
16390
|
},
|
|
16478
16391
|
checked: (appState) => appState.frameRendering.enabled
|
|
@@ -16518,7 +16431,7 @@ var actionWrapSelectionInFrame = register({
|
|
|
16518
16431
|
appState: {
|
|
16519
16432
|
selectedElementIds: { [frame.id]: true }
|
|
16520
16433
|
},
|
|
16521
|
-
captureUpdate:
|
|
16434
|
+
captureUpdate: CaptureUpdateAction32.IMMEDIATELY
|
|
16522
16435
|
};
|
|
16523
16436
|
}
|
|
16524
16437
|
});
|
|
@@ -16530,13 +16443,13 @@ import {
|
|
|
16530
16443
|
arrayToMap as arrayToMap28,
|
|
16531
16444
|
MOBILE_ACTION_BUTTON_BG as MOBILE_ACTION_BUTTON_BG4
|
|
16532
16445
|
} from "@excalidraw/common";
|
|
16533
|
-
import { CaptureUpdateAction as
|
|
16446
|
+
import { CaptureUpdateAction as CaptureUpdateAction34 } from "@excalidraw/element";
|
|
16534
16447
|
import { orderByFractionalIndex as orderByFractionalIndex2 } from "@excalidraw/element";
|
|
16535
16448
|
|
|
16536
16449
|
// history.ts
|
|
16537
16450
|
import { Emitter as Emitter2 } from "@excalidraw/common";
|
|
16538
16451
|
import {
|
|
16539
|
-
CaptureUpdateAction as
|
|
16452
|
+
CaptureUpdateAction as CaptureUpdateAction33,
|
|
16540
16453
|
StoreChange,
|
|
16541
16454
|
StoreDelta
|
|
16542
16455
|
} from "@excalidraw/element";
|
|
@@ -16650,7 +16563,7 @@ var History = class _History {
|
|
|
16650
16563
|
if (historyDelta === null) {
|
|
16651
16564
|
return;
|
|
16652
16565
|
}
|
|
16653
|
-
const action =
|
|
16566
|
+
const action = CaptureUpdateAction33.IMMEDIATELY;
|
|
16654
16567
|
let prevSnapshot = this.store.snapshot;
|
|
16655
16568
|
let nextElements = elements;
|
|
16656
16569
|
let nextAppState = appState;
|
|
@@ -16734,7 +16647,7 @@ var executeHistoryAction = (app, appState, updater) => {
|
|
|
16734
16647
|
!app.drawShape.hasPendingGesture()) {
|
|
16735
16648
|
const result = updater();
|
|
16736
16649
|
if (!result) {
|
|
16737
|
-
return { captureUpdate:
|
|
16650
|
+
return { captureUpdate: CaptureUpdateAction34.EVENTUALLY };
|
|
16738
16651
|
}
|
|
16739
16652
|
const [nextElementsMap, nextAppState] = result;
|
|
16740
16653
|
const nextElements = orderByFractionalIndex2(
|
|
@@ -16743,10 +16656,10 @@ var executeHistoryAction = (app, appState, updater) => {
|
|
|
16743
16656
|
return {
|
|
16744
16657
|
appState: nextAppState,
|
|
16745
16658
|
elements: nextElements,
|
|
16746
|
-
captureUpdate:
|
|
16659
|
+
captureUpdate: CaptureUpdateAction34.NEVER
|
|
16747
16660
|
};
|
|
16748
16661
|
}
|
|
16749
|
-
return { captureUpdate:
|
|
16662
|
+
return { captureUpdate: CaptureUpdateAction34.EVENTUALLY };
|
|
16750
16663
|
};
|
|
16751
16664
|
var createUndoAction = (history) => ({
|
|
16752
16665
|
name: "undo",
|
|
@@ -16836,7 +16749,7 @@ import {
|
|
|
16836
16749
|
} from "@excalidraw/element";
|
|
16837
16750
|
import { measureText as measureText3 } from "@excalidraw/element";
|
|
16838
16751
|
import { isTextElement as isTextElement7 } from "@excalidraw/element";
|
|
16839
|
-
import { CaptureUpdateAction as
|
|
16752
|
+
import { CaptureUpdateAction as CaptureUpdateAction35 } from "@excalidraw/element";
|
|
16840
16753
|
var actionTextAutoResize = register({
|
|
16841
16754
|
name: "autoResize",
|
|
16842
16755
|
label: "labels.autoResize",
|
|
@@ -16879,7 +16792,7 @@ var actionTextAutoResize = register({
|
|
|
16879
16792
|
elements: elements.map(
|
|
16880
16793
|
(element) => element.id === resized.id ? resized : element
|
|
16881
16794
|
),
|
|
16882
|
-
captureUpdate:
|
|
16795
|
+
captureUpdate: CaptureUpdateAction35.IMMEDIATELY
|
|
16883
16796
|
};
|
|
16884
16797
|
}
|
|
16885
16798
|
});
|
|
@@ -16887,7 +16800,7 @@ var actionTextAutoResize = register({
|
|
|
16887
16800
|
// actions/actionToggleViewMode.tsx
|
|
16888
16801
|
import { CODES as CODES9, KEYS as KEYS36 } from "@excalidraw/common";
|
|
16889
16802
|
import clsx23 from "clsx";
|
|
16890
|
-
import { CaptureUpdateAction as
|
|
16803
|
+
import { CaptureUpdateAction as CaptureUpdateAction36 } from "@excalidraw/element";
|
|
16891
16804
|
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
16892
16805
|
var actionToggleViewMode = register({
|
|
16893
16806
|
name: "viewMode",
|
|
@@ -16907,7 +16820,7 @@ var actionToggleViewMode = register({
|
|
|
16907
16820
|
...appState,
|
|
16908
16821
|
viewModeEnabled: !this.checked(appState)
|
|
16909
16822
|
},
|
|
16910
|
-
captureUpdate:
|
|
16823
|
+
captureUpdate: CaptureUpdateAction36.EVENTUALLY
|
|
16911
16824
|
};
|
|
16912
16825
|
},
|
|
16913
16826
|
checked: (appState) => appState.viewModeEnabled,
|
|
@@ -24373,7 +24286,7 @@ var AppDrawShape = class {
|
|
|
24373
24286
|
import { isArrowKey as isArrowKey2, KEYS as KEYS39 } from "@excalidraw/common";
|
|
24374
24287
|
import {
|
|
24375
24288
|
makeNextSelectedElementIds as makeNextSelectedElementIds3,
|
|
24376
|
-
CaptureUpdateAction as
|
|
24289
|
+
CaptureUpdateAction as CaptureUpdateAction37,
|
|
24377
24290
|
FlowChartCreator,
|
|
24378
24291
|
FlowChartNavigator,
|
|
24379
24292
|
getSelectedElements as getSelectedElements6,
|
|
@@ -24497,7 +24410,7 @@ var AppFlowchart = class _AppFlowchart {
|
|
|
24497
24410
|
}
|
|
24498
24411
|
captureUpdate() {
|
|
24499
24412
|
this.app.syncActionResult({
|
|
24500
|
-
captureUpdate:
|
|
24413
|
+
captureUpdate: CaptureUpdateAction37.IMMEDIATELY
|
|
24501
24414
|
});
|
|
24502
24415
|
}
|
|
24503
24416
|
static getLinkDirectionFromKey(key) {
|
|
@@ -28842,7 +28755,7 @@ import clsx43 from "clsx";
|
|
|
28842
28755
|
import { useEffect as useEffect28, useRef as useRef22, useState as useState24 } from "react";
|
|
28843
28756
|
import { EVENT as EVENT7, KEYS as KEYS45, cloneJSON as cloneJSON3 } from "@excalidraw/common";
|
|
28844
28757
|
import { deepCopyElement as deepCopyElement4 } from "@excalidraw/element";
|
|
28845
|
-
import { CaptureUpdateAction as
|
|
28758
|
+
import { CaptureUpdateAction as CaptureUpdateAction38 } from "@excalidraw/element";
|
|
28846
28759
|
|
|
28847
28760
|
// components/Stats/utils.ts
|
|
28848
28761
|
import { pointFrom as pointFrom40, pointRotateRads as pointRotateRads22 } from "@excalidraw/math";
|
|
@@ -29053,7 +28966,7 @@ var StatsDragInput = ({
|
|
|
29053
28966
|
setAppState
|
|
29054
28967
|
});
|
|
29055
28968
|
app.syncActionResult({
|
|
29056
|
-
captureUpdate:
|
|
28969
|
+
captureUpdate: CaptureUpdateAction38.IMMEDIATELY
|
|
29057
28970
|
});
|
|
29058
28971
|
}
|
|
29059
28972
|
};
|
|
@@ -29161,7 +29074,7 @@ var StatsDragInput = ({
|
|
|
29161
29074
|
false
|
|
29162
29075
|
);
|
|
29163
29076
|
app.syncActionResult({
|
|
29164
|
-
captureUpdate:
|
|
29077
|
+
captureUpdate: CaptureUpdateAction38.IMMEDIATELY
|
|
29165
29078
|
});
|
|
29166
29079
|
dragFinishedCallback?.({
|
|
29167
29080
|
app,
|
|
@@ -31064,8 +30977,8 @@ var StatsInner = memo2(
|
|
|
31064
30977
|
import { useCallback as useCallback10, useEffect as useEffect30, useState as useState27 } from "react";
|
|
31065
30978
|
import { normalizeLink as normalizeLink3, KEYS as KEYS46 } from "@excalidraw/common";
|
|
31066
30979
|
import {
|
|
31067
|
-
defaultGetElementLinkFromSelection
|
|
31068
|
-
getLinkIdAndTypeFromSelection
|
|
30980
|
+
defaultGetElementLinkFromSelection,
|
|
30981
|
+
getLinkIdAndTypeFromSelection
|
|
31069
30982
|
} from "@excalidraw/element";
|
|
31070
30983
|
|
|
31071
30984
|
// components/DialogActionButton.tsx
|
|
@@ -31222,7 +31135,7 @@ var ElementLinkDialog = ({
|
|
|
31222
31135
|
onClose,
|
|
31223
31136
|
appState,
|
|
31224
31137
|
scene,
|
|
31225
|
-
generateLinkForSelection =
|
|
31138
|
+
generateLinkForSelection = defaultGetElementLinkFromSelection
|
|
31226
31139
|
}) => {
|
|
31227
31140
|
const elementsMap = scene.getNonDeletedElementsMap();
|
|
31228
31141
|
const originalLink = elementsMap.get(sourceElementId)?.link ?? null;
|
|
@@ -31232,7 +31145,7 @@ var ElementLinkDialog = ({
|
|
|
31232
31145
|
const selectedElements = getSelectedElements(elementsMap, appState);
|
|
31233
31146
|
let nextLink2 = originalLink;
|
|
31234
31147
|
if (selectedElements.length > 0 && generateLinkForSelection) {
|
|
31235
|
-
const idAndType =
|
|
31148
|
+
const idAndType = getLinkIdAndTypeFromSelection(
|
|
31236
31149
|
selectedElements,
|
|
31237
31150
|
appState
|
|
31238
31151
|
);
|
|
@@ -36080,12 +35993,12 @@ var App = class _App extends React40.Component {
|
|
|
36080
35993
|
if (shouldUpdateStrokeColor) {
|
|
36081
35994
|
this.syncActionResult({
|
|
36082
35995
|
appState: { ...this.state, currentItemStrokeColor: color },
|
|
36083
|
-
captureUpdate:
|
|
35996
|
+
captureUpdate: CaptureUpdateAction39.IMMEDIATELY
|
|
36084
35997
|
});
|
|
36085
35998
|
} else {
|
|
36086
35999
|
this.syncActionResult({
|
|
36087
36000
|
appState: { ...this.state, currentItemBackgroundColor: color },
|
|
36088
|
-
captureUpdate:
|
|
36001
|
+
captureUpdate: CaptureUpdateAction39.IMMEDIATELY
|
|
36089
36002
|
});
|
|
36090
36003
|
}
|
|
36091
36004
|
} else {
|
|
@@ -36098,7 +36011,7 @@ var App = class _App extends React40.Component {
|
|
|
36098
36011
|
}
|
|
36099
36012
|
return el;
|
|
36100
36013
|
}),
|
|
36101
|
-
captureUpdate:
|
|
36014
|
+
captureUpdate: CaptureUpdateAction39.IMMEDIATELY
|
|
36102
36015
|
});
|
|
36103
36016
|
}
|
|
36104
36017
|
},
|
|
@@ -36516,7 +36429,7 @@ var App = class _App extends React40.Component {
|
|
|
36516
36429
|
elements: restoredElements,
|
|
36517
36430
|
appState: restoredAppState,
|
|
36518
36431
|
files: initialData?.files,
|
|
36519
|
-
captureUpdate:
|
|
36432
|
+
captureUpdate: CaptureUpdateAction39.NEVER
|
|
36520
36433
|
});
|
|
36521
36434
|
this.clearImageShapeCache();
|
|
36522
36435
|
this.fonts.loadSceneFonts().then((fontFaces) => {
|
|
@@ -38314,7 +38227,31 @@ var App = class _App extends React40.Component {
|
|
|
38314
38227
|
}
|
|
38315
38228
|
}
|
|
38316
38229
|
});
|
|
38230
|
+
__publicField(this, "getElementLinkAtPositionForContextMenu", (scenePointer, hitElementMightBeLocked) => {
|
|
38231
|
+
const linkElement = this.getElementLinkAtPosition(
|
|
38232
|
+
scenePointer,
|
|
38233
|
+
hitElementMightBeLocked
|
|
38234
|
+
);
|
|
38235
|
+
if (linkElement) {
|
|
38236
|
+
return linkElement;
|
|
38237
|
+
}
|
|
38238
|
+
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
38239
|
+
for (const element of this.scene.getNonDeletedElements().slice().reverse()) {
|
|
38240
|
+
if (element.link && !element.locked && isPointHittingLinkIcon(
|
|
38241
|
+
element,
|
|
38242
|
+
elementsMap,
|
|
38243
|
+
this.state,
|
|
38244
|
+
pointFrom44(scenePointer.x, scenePointer.y)
|
|
38245
|
+
)) {
|
|
38246
|
+
return element;
|
|
38247
|
+
}
|
|
38248
|
+
}
|
|
38249
|
+
});
|
|
38317
38250
|
__publicField(this, "handleElementLinkClick", (event) => {
|
|
38251
|
+
const isActivationButton = (button) => button === POINTER_BUTTON2.MAIN || button === POINTER_BUTTON2.TOUCH;
|
|
38252
|
+
if (!isActivationButton(this.lastPointerDownEvent.button) || !isActivationButton(this.lastPointerUpEvent.button)) {
|
|
38253
|
+
return;
|
|
38254
|
+
}
|
|
38318
38255
|
const draggedDistance = pointDistance11(
|
|
38319
38256
|
pointFrom44(
|
|
38320
38257
|
this.lastPointerDownEvent.clientX,
|
|
@@ -38353,28 +38290,32 @@ var App = class _App extends React40.Component {
|
|
|
38353
38290
|
);
|
|
38354
38291
|
if (lastPointerDownHittingLinkIcon && lastPointerUpHittingLinkIcon) {
|
|
38355
38292
|
hideHyperlinkToolip();
|
|
38356
|
-
|
|
38357
|
-
|
|
38358
|
-
|
|
38359
|
-
|
|
38360
|
-
|
|
38361
|
-
|
|
38362
|
-
|
|
38363
|
-
|
|
38364
|
-
|
|
38365
|
-
|
|
38366
|
-
|
|
38367
|
-
|
|
38368
|
-
|
|
38369
|
-
|
|
38370
|
-
|
|
38371
|
-
|
|
38372
|
-
|
|
38373
|
-
|
|
38374
|
-
|
|
38375
|
-
|
|
38376
|
-
|
|
38377
|
-
|
|
38293
|
+
this.openElementLink(this.hitLinkElement, event);
|
|
38294
|
+
}
|
|
38295
|
+
});
|
|
38296
|
+
__publicField(this, "openElementLink", (element, event) => {
|
|
38297
|
+
let url = element.link;
|
|
38298
|
+
if (!url) {
|
|
38299
|
+
return;
|
|
38300
|
+
}
|
|
38301
|
+
url = normalizeLink4(url);
|
|
38302
|
+
let customEvent;
|
|
38303
|
+
if (this.props.onLinkOpen && event) {
|
|
38304
|
+
customEvent = wrapEvent2(EVENT11.EXCALIDRAW_LINK, event.nativeEvent);
|
|
38305
|
+
this.props.onLinkOpen(
|
|
38306
|
+
{
|
|
38307
|
+
...element,
|
|
38308
|
+
link: url
|
|
38309
|
+
},
|
|
38310
|
+
customEvent
|
|
38311
|
+
);
|
|
38312
|
+
}
|
|
38313
|
+
if (!customEvent?.defaultPrevented) {
|
|
38314
|
+
const target = isLocalLink2(url) ? "_self" : "_blank";
|
|
38315
|
+
const newWindow = window.open(void 0, target);
|
|
38316
|
+
if (newWindow) {
|
|
38317
|
+
newWindow.opener = null;
|
|
38318
|
+
newWindow.location = url;
|
|
38378
38319
|
}
|
|
38379
38320
|
}
|
|
38380
38321
|
});
|
|
@@ -39094,7 +39035,7 @@ var App = class _App extends React40.Component {
|
|
|
39094
39035
|
this.state
|
|
39095
39036
|
)
|
|
39096
39037
|
},
|
|
39097
|
-
captureUpdate: this.state.openDialog?.name === "elementLinkSelector" ?
|
|
39038
|
+
captureUpdate: this.state.openDialog?.name === "elementLinkSelector" ? CaptureUpdateAction39.EVENTUALLY : CaptureUpdateAction39.NEVER
|
|
39098
39039
|
});
|
|
39099
39040
|
return;
|
|
39100
39041
|
}
|
|
@@ -40631,7 +40572,7 @@ var App = class _App extends React40.Component {
|
|
|
40631
40572
|
});
|
|
40632
40573
|
}
|
|
40633
40574
|
if (erroredFiles.size || updatedFiles.size) {
|
|
40634
|
-
this.store.scheduleAction(
|
|
40575
|
+
this.store.scheduleAction(CaptureUpdateAction39.NEVER);
|
|
40635
40576
|
this.scene.replaceAllElements(
|
|
40636
40577
|
this.scene.getElementsIncludingDeleted().map((element) => {
|
|
40637
40578
|
if (isInitializedImageElement3(element)) {
|
|
@@ -40751,7 +40692,7 @@ var App = class _App extends React40.Component {
|
|
|
40751
40692
|
)
|
|
40752
40693
|
},
|
|
40753
40694
|
elements: nextElements,
|
|
40754
|
-
captureUpdate:
|
|
40695
|
+
captureUpdate: CaptureUpdateAction39.IMMEDIATELY
|
|
40755
40696
|
});
|
|
40756
40697
|
this.setState({}, () => {
|
|
40757
40698
|
this.actionManager.executeAction(actionFinalize);
|
|
@@ -40785,7 +40726,7 @@ var App = class _App extends React40.Component {
|
|
|
40785
40726
|
isLoading: false
|
|
40786
40727
|
},
|
|
40787
40728
|
replaceFiles: true,
|
|
40788
|
-
captureUpdate:
|
|
40729
|
+
captureUpdate: CaptureUpdateAction39.IMMEDIATELY
|
|
40789
40730
|
});
|
|
40790
40731
|
return;
|
|
40791
40732
|
} catch (error) {
|
|
@@ -40858,7 +40799,7 @@ var App = class _App extends React40.Component {
|
|
|
40858
40799
|
{
|
|
40859
40800
|
syncInvalidIndices3(elements.concat(ret.elements));
|
|
40860
40801
|
this.store.scheduleMicroAction({
|
|
40861
|
-
action:
|
|
40802
|
+
action: CaptureUpdateAction39.NEVER,
|
|
40862
40803
|
elements,
|
|
40863
40804
|
appState: void 0
|
|
40864
40805
|
});
|
|
@@ -40871,7 +40812,7 @@ var App = class _App extends React40.Component {
|
|
|
40871
40812
|
isLoading: false
|
|
40872
40813
|
},
|
|
40873
40814
|
replaceFiles: true,
|
|
40874
|
-
captureUpdate:
|
|
40815
|
+
captureUpdate: CaptureUpdateAction39.IMMEDIATELY
|
|
40875
40816
|
});
|
|
40876
40817
|
}
|
|
40877
40818
|
} catch (error) {
|
|
@@ -40893,12 +40834,15 @@ var App = class _App extends React40.Component {
|
|
|
40893
40834
|
preferSelected: true,
|
|
40894
40835
|
includeLockedElements: true
|
|
40895
40836
|
});
|
|
40837
|
+
const linkElement = this.isLinksEnabled() ? this.getElementLinkAtPositionForContextMenu({ x, y }, element) : void 0;
|
|
40896
40838
|
const selectedElements = this.scene.getSelectedElements(this.state);
|
|
40897
40839
|
const isHittingCommonBoundBox = this.isHittingCommonBoundingBoxOfSelectedElements(
|
|
40898
40840
|
{ x, y },
|
|
40899
40841
|
selectedElements
|
|
40900
40842
|
);
|
|
40901
|
-
const
|
|
40843
|
+
const selectedLinkedElement = isHittingCommonBoundBox && selectedElements.length === 1 && selectedElements[0].link ? selectedElements[0] : void 0;
|
|
40844
|
+
const contextMenuElement = element ?? linkElement ?? selectedLinkedElement;
|
|
40845
|
+
const type = contextMenuElement || isHittingCommonBoundBox ? "element" : "canvas";
|
|
40902
40846
|
const container = this.excalidrawContainerRef.current;
|
|
40903
40847
|
const { top: offsetTop, left: offsetLeft } = container.getBoundingClientRect();
|
|
40904
40848
|
const left = event.clientX - offsetLeft;
|
|
@@ -40906,19 +40850,19 @@ var App = class _App extends React40.Component {
|
|
|
40906
40850
|
trackEvent("contextMenu", "openContextMenu", type);
|
|
40907
40851
|
this.setState(
|
|
40908
40852
|
{
|
|
40909
|
-
...
|
|
40853
|
+
...contextMenuElement && !this.state.selectedElementIds[contextMenuElement.id] ? {
|
|
40910
40854
|
...this.state,
|
|
40911
40855
|
...selectGroupsForSelectedElements7(
|
|
40912
40856
|
{
|
|
40913
40857
|
editingGroupId: this.state.editingGroupId,
|
|
40914
|
-
selectedElementIds: { [
|
|
40858
|
+
selectedElementIds: { [contextMenuElement.id]: true }
|
|
40915
40859
|
},
|
|
40916
40860
|
this.scene.getNonDeletedElements(),
|
|
40917
40861
|
this.state,
|
|
40918
40862
|
this
|
|
40919
40863
|
),
|
|
40920
|
-
selectedLinearElement: isLinearElement11(
|
|
40921
|
-
|
|
40864
|
+
selectedLinearElement: isLinearElement11(contextMenuElement) ? new LinearElementEditor12(
|
|
40865
|
+
contextMenuElement,
|
|
40922
40866
|
this.scene.getNonDeletedElementsMap()
|
|
40923
40867
|
) : null
|
|
40924
40868
|
} : this.state,
|
|
@@ -40929,7 +40873,7 @@ var App = class _App extends React40.Component {
|
|
|
40929
40873
|
contextMenu: {
|
|
40930
40874
|
top,
|
|
40931
40875
|
left,
|
|
40932
|
-
items: this.getContextMenuItems(type,
|
|
40876
|
+
items: this.getContextMenuItems(type, contextMenuElement)
|
|
40933
40877
|
}
|
|
40934
40878
|
});
|
|
40935
40879
|
}
|
|
@@ -41199,8 +41143,36 @@ var App = class _App extends React40.Component {
|
|
|
41199
41143
|
}
|
|
41200
41144
|
return [];
|
|
41201
41145
|
});
|
|
41146
|
+
__publicField(this, "getElementLinkContextMenuItems", (hitElement) => {
|
|
41147
|
+
if (!hitElement?.link) {
|
|
41148
|
+
return [];
|
|
41149
|
+
}
|
|
41150
|
+
const link = normalizeLink4(hitElement.link);
|
|
41151
|
+
const isObjectLink = isElementLink3(link);
|
|
41152
|
+
return [
|
|
41153
|
+
{
|
|
41154
|
+
key: "goToLink",
|
|
41155
|
+
label: isObjectLink ? t("labels.link.goToElement") : "Go to link",
|
|
41156
|
+
onSelect: () => this.openElementLink(hitElement)
|
|
41157
|
+
},
|
|
41158
|
+
!isObjectLink && {
|
|
41159
|
+
key: "copyLink",
|
|
41160
|
+
label: t("buttons.copyLink"),
|
|
41161
|
+
onSelect: async () => {
|
|
41162
|
+
await copyTextToSystemClipboard(link);
|
|
41163
|
+
this.setState({
|
|
41164
|
+
toast: {
|
|
41165
|
+
message: t("toast.elementLinkCopied"),
|
|
41166
|
+
closable: true
|
|
41167
|
+
}
|
|
41168
|
+
});
|
|
41169
|
+
}
|
|
41170
|
+
}
|
|
41171
|
+
];
|
|
41172
|
+
});
|
|
41202
41173
|
__publicField(this, "getContextMenuItems", (type, hitElement) => {
|
|
41203
41174
|
const imageContextMenuItems = this.getImageContextMenuItems(hitElement);
|
|
41175
|
+
const elementLinkContextMenuItems = this.getElementLinkContextMenuItems(hitElement);
|
|
41204
41176
|
if (type === "canvas") {
|
|
41205
41177
|
if (this.state.viewModeEnabled) {
|
|
41206
41178
|
return [
|
|
@@ -41226,6 +41198,8 @@ var App = class _App extends React40.Component {
|
|
|
41226
41198
|
}
|
|
41227
41199
|
if (this.state.viewModeEnabled) {
|
|
41228
41200
|
return [
|
|
41201
|
+
...elementLinkContextMenuItems,
|
|
41202
|
+
elementLinkContextMenuItems.length > 0 && CONTEXT_MENU_SEPARATOR,
|
|
41229
41203
|
actionSmartZoom,
|
|
41230
41204
|
actionCopy,
|
|
41231
41205
|
imageContextMenuItems.length > 0 && CONTEXT_MENU_SEPARATOR,
|
|
@@ -41270,7 +41244,8 @@ var App = class _App extends React40.Component {
|
|
|
41270
41244
|
actionToggleLinearEditor,
|
|
41271
41245
|
CONTEXT_MENU_SEPARATOR,
|
|
41272
41246
|
actionLink,
|
|
41273
|
-
|
|
41247
|
+
elementLinkContextMenuItems.length > 0 && CONTEXT_MENU_SEPARATOR,
|
|
41248
|
+
...elementLinkContextMenuItems,
|
|
41274
41249
|
CONTEXT_MENU_SEPARATOR,
|
|
41275
41250
|
actionDuplicateSelection,
|
|
41276
41251
|
actionToggleElementLock,
|
|
@@ -44596,7 +44571,7 @@ var App = class _App extends React40.Component {
|
|
|
44596
44571
|
appState: {
|
|
44597
44572
|
newElement: null
|
|
44598
44573
|
},
|
|
44599
|
-
captureUpdate:
|
|
44574
|
+
captureUpdate: CaptureUpdateAction39.NEVER
|
|
44600
44575
|
});
|
|
44601
44576
|
return;
|
|
44602
44577
|
}
|
|
@@ -44727,7 +44702,7 @@ var App = class _App extends React40.Component {
|
|
|
44727
44702
|
if (resizingElement && isInvisiblySmallElement4(resizingElement)) {
|
|
44728
44703
|
this.updateScene({
|
|
44729
44704
|
elements: this.scene.getElementsIncludingDeleted().filter((el) => el.id !== resizingElement.id),
|
|
44730
|
-
captureUpdate:
|
|
44705
|
+
captureUpdate: CaptureUpdateAction39.NEVER
|
|
44731
44706
|
});
|
|
44732
44707
|
}
|
|
44733
44708
|
if (pointerDownState.resize.isResizing) {
|
|
@@ -45596,7 +45571,7 @@ import {
|
|
|
45596
45571
|
newElementWith as newElementWith11,
|
|
45597
45572
|
bumpVersion as bumpVersion4
|
|
45598
45573
|
} from "@excalidraw/element";
|
|
45599
|
-
import { CaptureUpdateAction as
|
|
45574
|
+
import { CaptureUpdateAction as CaptureUpdateAction40 } from "@excalidraw/element";
|
|
45600
45575
|
import {
|
|
45601
45576
|
getCommonBounds as getCommonBounds14,
|
|
45602
45577
|
getVisibleSceneBounds as getVisibleSceneBounds2,
|
|
@@ -45852,7 +45827,7 @@ function useExcalidrawStateValue(selector) {
|
|
|
45852
45827
|
}
|
|
45853
45828
|
export {
|
|
45854
45829
|
Button,
|
|
45855
|
-
|
|
45830
|
+
CaptureUpdateAction40 as CaptureUpdateAction,
|
|
45856
45831
|
DEFAULT_LASER_COLOR2 as DEFAULT_LASER_COLOR,
|
|
45857
45832
|
DEFAULT_OVERSCROLL,
|
|
45858
45833
|
DefaultSidebar,
|