@excalidraw/excalidraw 0.17.1-1ed53b1 → 0.17.1-22b3927
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/dist/browser/dev/excalidraw-assets-dev/{chunk-JKPJV7MZ.js → chunk-Q6A4M3MN.js} +4 -2
- package/dist/browser/dev/excalidraw-assets-dev/chunk-Q6A4M3MN.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{chunk-OKAZAA6U.js → chunk-VC7RRIDZ.js} +230 -93
- package/dist/browser/dev/excalidraw-assets-dev/chunk-VC7RRIDZ.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{dist-ITJNUBZF.js → dist-6QVAH5JA.js} +36 -14
- package/dist/browser/dev/excalidraw-assets-dev/dist-6QVAH5JA.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{en-BF4XUPIZ.js → en-Y27YPU72.js} +2 -2
- package/dist/browser/dev/excalidraw-assets-dev/{image-LVS32KQQ.js → image-J7S3ALXP.js} +2 -2
- package/dist/browser/dev/index.js +335 -116
- package/dist/browser/dev/index.js.map +4 -4
- package/dist/browser/prod/excalidraw-assets/chunk-CWO763YJ.js +55 -0
- package/dist/browser/prod/excalidraw-assets/{chunk-O4AI3NNG.js → chunk-IZMZ6RPD.js} +1 -1
- package/dist/browser/prod/excalidraw-assets/dist-567JAXHK.js +7 -0
- package/dist/browser/prod/excalidraw-assets/{en-N7CLNF6C.js → en-GSUSWMSH.js} +1 -1
- package/dist/browser/prod/excalidraw-assets/image-SZBFRCU2.js +1 -0
- package/dist/browser/prod/index.js +24 -24
- package/dist/dev/{en-UQDDYCH7.json → en-OIPCBIOA.json} +3 -1
- package/dist/dev/index.js +576 -207
- package/dist/dev/index.js.map +4 -4
- package/dist/excalidraw/actions/actionAddToLibrary.d.ts +3 -3
- package/dist/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/excalidraw/actions/actionBoundText.d.ts +3 -3
- package/dist/excalidraw/actions/actionBoundText.js +3 -1
- package/dist/excalidraw/actions/actionCanvas.d.ts +13 -13
- package/dist/excalidraw/actions/actionClipboard.d.ts +12 -12
- package/dist/excalidraw/actions/actionDeleteSelected.d.ts +3 -3
- package/dist/excalidraw/actions/actionDistribute.d.ts +2 -2
- package/dist/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
- package/dist/excalidraw/actions/actionElementLock.d.ts +2 -2
- package/dist/excalidraw/actions/actionExport.d.ts +11 -11
- package/dist/excalidraw/actions/actionFinalize.d.ts +2 -2
- package/dist/excalidraw/actions/actionFlip.d.ts +2 -2
- package/dist/excalidraw/actions/actionFrame.d.ts +312 -4
- package/dist/excalidraw/actions/actionGroup.d.ts +312 -2
- package/dist/excalidraw/actions/actionHistory.js +4 -4
- package/dist/excalidraw/actions/actionLinearEditor.d.ts +1 -1
- package/dist/excalidraw/actions/actionLink.d.ts +1 -1
- package/dist/excalidraw/actions/actionMenu.d.ts +3 -3
- package/dist/excalidraw/actions/actionNavigate.d.ts +2 -2
- package/dist/excalidraw/actions/actionProperties.d.ts +13 -13
- package/dist/excalidraw/actions/actionProperties.js +1 -1
- package/dist/excalidraw/actions/actionSelectAll.d.ts +1 -1
- package/dist/excalidraw/actions/actionStyles.d.ts +5 -2
- package/dist/excalidraw/actions/actionTextAutoResize.d.ts +17 -0
- package/dist/excalidraw/actions/actionTextAutoResize.js +38 -0
- package/dist/excalidraw/actions/actionToggleGridMode.d.ts +1 -1
- package/dist/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -1
- package/dist/excalidraw/actions/actionToggleStats.d.ts +1 -1
- package/dist/excalidraw/actions/actionToggleViewMode.d.ts +1 -1
- package/dist/excalidraw/actions/actionToggleZenMode.d.ts +1 -1
- package/dist/excalidraw/actions/actionZindex.d.ts +4 -4
- package/dist/excalidraw/actions/types.d.ts +1 -1
- package/dist/excalidraw/change.js +13 -6
- package/dist/excalidraw/components/Actions.js +1 -1
- package/dist/excalidraw/components/App.d.ts +2 -2
- package/dist/excalidraw/components/App.js +133 -51
- package/dist/excalidraw/components/ButtonIconSelect.js +1 -1
- package/dist/excalidraw/components/CheckboxItem.js +1 -1
- package/dist/excalidraw/components/CommandPalette/CommandPalette.js +2 -2
- package/dist/excalidraw/components/ContextMenu.js +1 -1
- package/dist/excalidraw/components/Dialog.js +1 -1
- package/dist/excalidraw/components/FollowMode/FollowMode.js +1 -1
- package/dist/excalidraw/components/IconPicker.js +2 -2
- package/dist/excalidraw/components/LayerUI.js +2 -2
- package/dist/excalidraw/components/MobileMenu.js +1 -1
- package/dist/excalidraw/components/PasteChartDialog.js +1 -1
- package/dist/excalidraw/components/canvases/InteractiveCanvas.d.ts +3 -2
- package/dist/excalidraw/components/canvases/InteractiveCanvas.js +4 -2
- package/dist/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/excalidraw/components/canvases/StaticCanvas.js +2 -2
- package/dist/excalidraw/components/icons.js +6 -2
- package/dist/excalidraw/constants.d.ts +1 -0
- package/dist/excalidraw/constants.js +5 -0
- package/dist/excalidraw/data/restore.js +3 -0
- package/dist/excalidraw/element/dragElements.d.ts +2 -2
- package/dist/excalidraw/element/dragElements.js +27 -3
- package/dist/excalidraw/element/embeddable.d.ts +1 -1
- package/dist/excalidraw/element/index.d.ts +1 -1
- package/dist/excalidraw/element/index.js +1 -1
- package/dist/excalidraw/element/mutateElement.d.ts +1 -1
- package/dist/excalidraw/element/mutateElement.js +5 -3
- package/dist/excalidraw/element/newElement.d.ts +2 -5
- package/dist/excalidraw/element/newElement.js +16 -14
- package/dist/excalidraw/element/resizeElements.js +73 -21
- package/dist/excalidraw/element/resizeTest.js +2 -4
- package/dist/excalidraw/element/textElement.d.ts +1 -0
- package/dist/excalidraw/element/textElement.js +11 -3
- package/dist/excalidraw/element/textWysiwyg.d.ts +10 -4
- package/dist/excalidraw/element/textWysiwyg.js +38 -17
- package/dist/excalidraw/element/transformHandles.js +0 -10
- package/dist/excalidraw/element/types.d.ts +7 -0
- package/dist/excalidraw/fractionalIndex.js +2 -4
- package/dist/excalidraw/locales/en.json +3 -1
- package/dist/excalidraw/mermaid.d.ts +2 -0
- package/dist/excalidraw/mermaid.js +28 -0
- package/dist/excalidraw/renderer/interactiveScene.d.ts +1 -1
- package/dist/excalidraw/renderer/interactiveScene.js +31 -5
- package/dist/excalidraw/renderer/renderElement.d.ts +2 -2
- package/dist/excalidraw/renderer/renderElement.js +2 -2
- package/dist/excalidraw/scene/Fonts.d.ts +1 -3
- package/dist/excalidraw/scene/Fonts.js +6 -12
- package/dist/excalidraw/scene/Renderer.d.ts +1 -1
- package/dist/excalidraw/scene/Renderer.js +2 -3
- package/dist/excalidraw/scene/Scene.d.ts +10 -4
- package/dist/excalidraw/scene/Scene.js +14 -8
- package/dist/excalidraw/scene/export.js +1 -1
- package/dist/excalidraw/scene/types.d.ts +2 -1
- package/dist/excalidraw/snapping.js +2 -1
- package/dist/excalidraw/store.d.ts +32 -2
- package/dist/excalidraw/store.js +27 -0
- package/dist/excalidraw/types.d.ts +1 -0
- package/dist/prod/{en-UQDDYCH7.json → en-OIPCBIOA.json} +3 -1
- package/dist/prod/index.js +42 -42
- package/package.json +2 -2
- package/dist/browser/dev/excalidraw-assets-dev/chunk-JKPJV7MZ.js.map +0 -7
- package/dist/browser/dev/excalidraw-assets-dev/chunk-OKAZAA6U.js.map +0 -7
- package/dist/browser/dev/excalidraw-assets-dev/dist-ITJNUBZF.js.map +0 -7
- package/dist/browser/prod/excalidraw-assets/chunk-SXBDZOS3.js +0 -55
- package/dist/browser/prod/excalidraw-assets/dist-54276HPL.js +0 -6
- package/dist/browser/prod/excalidraw-assets/image-VAGBVQ3G.js +0 -1
- /package/dist/browser/dev/excalidraw-assets-dev/{en-BF4XUPIZ.js.map → en-Y27YPU72.js.map} +0 -0
- /package/dist/browser/dev/excalidraw-assets-dev/{image-LVS32KQQ.js.map → image-J7S3ALXP.js.map} +0 -0
|
@@ -39,8 +39,8 @@ export const createUndoAction = (history, store) => ({
|
|
|
39
39
|
event.key.toLowerCase() === KEYS.Z &&
|
|
40
40
|
!event.shiftKey,
|
|
41
41
|
PanelComponent: ({ updateData, data }) => {
|
|
42
|
-
const { isUndoStackEmpty } = useEmitter(history.onHistoryChangedEmitter, new HistoryChangedEvent());
|
|
43
|
-
return (_jsx(ToolButton, { type: "button", icon: UndoIcon, "aria-label": t("buttons.undo"), onClick: updateData, size: data?.size || "medium", disabled: isUndoStackEmpty }));
|
|
42
|
+
const { isUndoStackEmpty } = useEmitter(history.onHistoryChangedEmitter, new HistoryChangedEvent(history.isUndoStackEmpty, history.isRedoStackEmpty));
|
|
43
|
+
return (_jsx(ToolButton, { type: "button", icon: UndoIcon, "aria-label": t("buttons.undo"), onClick: updateData, size: data?.size || "medium", disabled: isUndoStackEmpty, "data-testid": "button-undo" }));
|
|
44
44
|
},
|
|
45
45
|
});
|
|
46
46
|
export const createRedoAction = (history, store) => ({
|
|
@@ -56,7 +56,7 @@ export const createRedoAction = (history, store) => ({
|
|
|
56
56
|
event.key.toLowerCase() === KEYS.Z) ||
|
|
57
57
|
(isWindows && event.ctrlKey && !event.shiftKey && event.key === KEYS.Y),
|
|
58
58
|
PanelComponent: ({ updateData, data }) => {
|
|
59
|
-
const { isRedoStackEmpty } = useEmitter(history.onHistoryChangedEmitter, new HistoryChangedEvent());
|
|
60
|
-
return (_jsx(ToolButton, { type: "button", icon: RedoIcon, "aria-label": t("buttons.redo"), onClick: updateData, size: data?.size || "medium", disabled: isRedoStackEmpty }));
|
|
59
|
+
const { isRedoStackEmpty } = useEmitter(history.onHistoryChangedEmitter, new HistoryChangedEvent(history.isUndoStackEmpty, history.isRedoStackEmpty));
|
|
60
|
+
return (_jsx(ToolButton, { type: "button", icon: RedoIcon, "aria-label": t("buttons.redo"), onClick: updateData, size: data?.size || "medium", disabled: isRedoStackEmpty, "data-testid": "button-redo" }));
|
|
61
61
|
},
|
|
62
62
|
});
|
|
@@ -163,7 +163,7 @@ export declare const actionToggleLinearEditor: {
|
|
|
163
163
|
userToFollow: import("../types").UserToFollow | null;
|
|
164
164
|
followedBy: Set<import("../types").SocketId>;
|
|
165
165
|
};
|
|
166
|
-
storeAction:
|
|
166
|
+
storeAction: "capture";
|
|
167
167
|
};
|
|
168
168
|
PanelComponent: ({ appState, updateData, app }: import("./types").PanelComponentProps) => JSX.Element;
|
|
169
169
|
} & {
|
|
@@ -157,7 +157,7 @@ export declare const actionLink: {
|
|
|
157
157
|
userToFollow: import("../types").UserToFollow | null;
|
|
158
158
|
followedBy: Set<import("../types").SocketId>;
|
|
159
159
|
};
|
|
160
|
-
storeAction:
|
|
160
|
+
storeAction: "capture";
|
|
161
161
|
};
|
|
162
162
|
trackEvent: {
|
|
163
163
|
category: "hyperlink";
|
|
@@ -158,7 +158,7 @@ export declare const actionToggleCanvasMenu: {
|
|
|
158
158
|
userToFollow: import("../types").UserToFollow | null;
|
|
159
159
|
followedBy: Set<import("../types").SocketId>;
|
|
160
160
|
};
|
|
161
|
-
storeAction:
|
|
161
|
+
storeAction: "none";
|
|
162
162
|
};
|
|
163
163
|
PanelComponent: ({ appState, updateData }: import("./types").PanelComponentProps) => JSX.Element;
|
|
164
164
|
} & {
|
|
@@ -323,7 +323,7 @@ export declare const actionToggleEditMenu: {
|
|
|
323
323
|
userToFollow: import("../types").UserToFollow | null;
|
|
324
324
|
followedBy: Set<import("../types").SocketId>;
|
|
325
325
|
};
|
|
326
|
-
storeAction:
|
|
326
|
+
storeAction: "none";
|
|
327
327
|
};
|
|
328
328
|
PanelComponent: ({ elements, appState, updateData }: import("./types").PanelComponentProps) => JSX.Element;
|
|
329
329
|
} & {
|
|
@@ -482,7 +482,7 @@ export declare const actionShortcuts: {
|
|
|
482
482
|
userToFollow: import("../types").UserToFollow | null;
|
|
483
483
|
followedBy: Set<import("../types").SocketId>;
|
|
484
484
|
};
|
|
485
|
-
storeAction:
|
|
485
|
+
storeAction: "none";
|
|
486
486
|
};
|
|
487
487
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
488
488
|
} & {
|
|
@@ -160,7 +160,7 @@ export declare const actionGoToCollaborator: {
|
|
|
160
160
|
objectsSnapModeEnabled: boolean;
|
|
161
161
|
followedBy: Set<import("../types").SocketId>;
|
|
162
162
|
};
|
|
163
|
-
storeAction:
|
|
163
|
+
storeAction: "none";
|
|
164
164
|
} | {
|
|
165
165
|
appState: {
|
|
166
166
|
userToFollow: {
|
|
@@ -317,7 +317,7 @@ export declare const actionGoToCollaborator: {
|
|
|
317
317
|
objectsSnapModeEnabled: boolean;
|
|
318
318
|
followedBy: Set<import("../types").SocketId>;
|
|
319
319
|
};
|
|
320
|
-
storeAction:
|
|
320
|
+
storeAction: "none";
|
|
321
321
|
};
|
|
322
322
|
PanelComponent: ({ updateData, data, appState }: import("./types").PanelComponentProps) => JSX.Element;
|
|
323
323
|
} & {
|
|
@@ -179,7 +179,7 @@ export declare const actionChangeFillStyle: {
|
|
|
179
179
|
userToFollow: import("../types").UserToFollow | null;
|
|
180
180
|
followedBy: Set<import("../types").SocketId>;
|
|
181
181
|
};
|
|
182
|
-
storeAction:
|
|
182
|
+
storeAction: "capture";
|
|
183
183
|
};
|
|
184
184
|
PanelComponent: ({ elements, appState, updateData }: import("./types").PanelComponentProps) => JSX.Element;
|
|
185
185
|
} & {
|
|
@@ -343,7 +343,7 @@ export declare const actionChangeStrokeWidth: {
|
|
|
343
343
|
userToFollow: import("../types").UserToFollow | null;
|
|
344
344
|
followedBy: Set<import("../types").SocketId>;
|
|
345
345
|
};
|
|
346
|
-
storeAction:
|
|
346
|
+
storeAction: "capture";
|
|
347
347
|
};
|
|
348
348
|
PanelComponent: ({ elements, appState, updateData }: import("./types").PanelComponentProps) => JSX.Element;
|
|
349
349
|
} & {
|
|
@@ -507,7 +507,7 @@ export declare const actionChangeSloppiness: {
|
|
|
507
507
|
userToFollow: import("../types").UserToFollow | null;
|
|
508
508
|
followedBy: Set<import("../types").SocketId>;
|
|
509
509
|
};
|
|
510
|
-
storeAction:
|
|
510
|
+
storeAction: "capture";
|
|
511
511
|
};
|
|
512
512
|
PanelComponent: ({ elements, appState, updateData }: import("./types").PanelComponentProps) => JSX.Element;
|
|
513
513
|
} & {
|
|
@@ -671,7 +671,7 @@ export declare const actionChangeStrokeStyle: {
|
|
|
671
671
|
userToFollow: import("../types").UserToFollow | null;
|
|
672
672
|
followedBy: Set<import("../types").SocketId>;
|
|
673
673
|
};
|
|
674
|
-
storeAction:
|
|
674
|
+
storeAction: "capture";
|
|
675
675
|
};
|
|
676
676
|
PanelComponent: ({ elements, appState, updateData }: import("./types").PanelComponentProps) => JSX.Element;
|
|
677
677
|
} & {
|
|
@@ -835,7 +835,7 @@ export declare const actionChangeOpacity: {
|
|
|
835
835
|
userToFollow: import("../types").UserToFollow | null;
|
|
836
836
|
followedBy: Set<import("../types").SocketId>;
|
|
837
837
|
};
|
|
838
|
-
storeAction:
|
|
838
|
+
storeAction: "capture";
|
|
839
839
|
};
|
|
840
840
|
PanelComponent: ({ elements, appState, updateData }: import("./types").PanelComponentProps) => JSX.Element;
|
|
841
841
|
} & {
|
|
@@ -999,7 +999,7 @@ export declare const actionChangeFontSize: {
|
|
|
999
999
|
userToFollow: import("../types").UserToFollow | null;
|
|
1000
1000
|
followedBy: Set<import("../types").SocketId>;
|
|
1001
1001
|
};
|
|
1002
|
-
storeAction:
|
|
1002
|
+
storeAction: "capture";
|
|
1003
1003
|
};
|
|
1004
1004
|
PanelComponent: ({ elements, appState, updateData, app }: import("./types").PanelComponentProps) => JSX.Element;
|
|
1005
1005
|
} & {
|
|
@@ -1164,7 +1164,7 @@ export declare const actionDecreaseFontSize: {
|
|
|
1164
1164
|
userToFollow: import("../types").UserToFollow | null;
|
|
1165
1165
|
followedBy: Set<import("../types").SocketId>;
|
|
1166
1166
|
};
|
|
1167
|
-
storeAction:
|
|
1167
|
+
storeAction: "capture";
|
|
1168
1168
|
};
|
|
1169
1169
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
1170
1170
|
} & {
|
|
@@ -1329,7 +1329,7 @@ export declare const actionIncreaseFontSize: {
|
|
|
1329
1329
|
userToFollow: import("../types").UserToFollow | null;
|
|
1330
1330
|
followedBy: Set<import("../types").SocketId>;
|
|
1331
1331
|
};
|
|
1332
|
-
storeAction:
|
|
1332
|
+
storeAction: "capture";
|
|
1333
1333
|
};
|
|
1334
1334
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
1335
1335
|
} & {
|
|
@@ -1493,7 +1493,7 @@ export declare const actionChangeFontFamily: {
|
|
|
1493
1493
|
userToFollow: import("../types").UserToFollow | null;
|
|
1494
1494
|
followedBy: Set<import("../types").SocketId>;
|
|
1495
1495
|
};
|
|
1496
|
-
storeAction:
|
|
1496
|
+
storeAction: "capture";
|
|
1497
1497
|
};
|
|
1498
1498
|
PanelComponent: ({ elements, appState, updateData, app }: import("./types").PanelComponentProps) => JSX.Element;
|
|
1499
1499
|
} & {
|
|
@@ -1657,7 +1657,7 @@ export declare const actionChangeTextAlign: {
|
|
|
1657
1657
|
userToFollow: import("../types").UserToFollow | null;
|
|
1658
1658
|
followedBy: Set<import("../types").SocketId>;
|
|
1659
1659
|
};
|
|
1660
|
-
storeAction:
|
|
1660
|
+
storeAction: "capture";
|
|
1661
1661
|
};
|
|
1662
1662
|
PanelComponent: ({ elements, appState, updateData, app }: import("./types").PanelComponentProps) => JSX.Element;
|
|
1663
1663
|
} & {
|
|
@@ -1823,7 +1823,7 @@ export declare const actionChangeVerticalAlign: {
|
|
|
1823
1823
|
userToFollow: import("../types").UserToFollow | null;
|
|
1824
1824
|
followedBy: Set<import("../types").SocketId>;
|
|
1825
1825
|
};
|
|
1826
|
-
storeAction:
|
|
1826
|
+
storeAction: "capture";
|
|
1827
1827
|
};
|
|
1828
1828
|
PanelComponent: ({ elements, appState, updateData, app }: import("./types").PanelComponentProps) => JSX.Element;
|
|
1829
1829
|
} & {
|
|
@@ -1987,7 +1987,7 @@ export declare const actionChangeRoundness: {
|
|
|
1987
1987
|
userToFollow: import("../types").UserToFollow | null;
|
|
1988
1988
|
followedBy: Set<import("../types").SocketId>;
|
|
1989
1989
|
};
|
|
1990
|
-
storeAction:
|
|
1990
|
+
storeAction: "capture";
|
|
1991
1991
|
};
|
|
1992
1992
|
PanelComponent: ({ elements, appState, updateData }: import("./types").PanelComponentProps) => JSX.Element;
|
|
1993
1993
|
} & {
|
|
@@ -2154,7 +2154,7 @@ export declare const actionChangeArrowhead: {
|
|
|
2154
2154
|
userToFollow: import("../types").UserToFollow | null;
|
|
2155
2155
|
followedBy: Set<import("../types").SocketId>;
|
|
2156
2156
|
};
|
|
2157
|
-
storeAction:
|
|
2157
|
+
storeAction: "capture";
|
|
2158
2158
|
};
|
|
2159
2159
|
PanelComponent: ({ elements, appState, updateData }: import("./types").PanelComponentProps) => JSX.Element;
|
|
2160
2160
|
} & {
|
|
@@ -60,7 +60,7 @@ export const getFormValue = function (elements, appState, getAttribute, isReleva
|
|
|
60
60
|
return ret;
|
|
61
61
|
};
|
|
62
62
|
const offsetElementAfterFontResize = (prevElement, nextElement) => {
|
|
63
|
-
if (isBoundToContainer(nextElement)) {
|
|
63
|
+
if (isBoundToContainer(nextElement) || !nextElement.autoResize) {
|
|
64
64
|
return nextElement;
|
|
65
65
|
}
|
|
66
66
|
return mutateElement(nextElement, {
|
|
@@ -162,7 +162,7 @@ export declare const actionSelectAll: {
|
|
|
162
162
|
userToFollow: import("../types").UserToFollow | null;
|
|
163
163
|
followedBy: Set<import("../types").SocketId>;
|
|
164
164
|
};
|
|
165
|
-
storeAction:
|
|
165
|
+
storeAction: "capture";
|
|
166
166
|
};
|
|
167
167
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
168
168
|
} & {
|
|
@@ -158,7 +158,7 @@ export declare const actionCopyStyles: {
|
|
|
158
158
|
userToFollow: import("../types").UserToFollow | null;
|
|
159
159
|
followedBy: Set<import("../types").SocketId>;
|
|
160
160
|
};
|
|
161
|
-
storeAction:
|
|
161
|
+
storeAction: "none";
|
|
162
162
|
};
|
|
163
163
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
164
164
|
} & {
|
|
@@ -173,7 +173,10 @@ export declare const actionPasteStyles: {
|
|
|
173
173
|
};
|
|
174
174
|
perform: (elements: readonly import("../element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, formData: any, app: import("../types").AppClassProperties) => {
|
|
175
175
|
elements: readonly import("../element/types").OrderedExcalidrawElement[];
|
|
176
|
-
storeAction:
|
|
176
|
+
storeAction: "none";
|
|
177
|
+
} | {
|
|
178
|
+
elements: import("../element/types").OrderedExcalidrawElement[];
|
|
179
|
+
storeAction: "capture";
|
|
177
180
|
};
|
|
178
181
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
179
182
|
} & {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AppClassProperties } from "../types";
|
|
2
|
+
export declare const actionTextAutoResize: {
|
|
3
|
+
name: "autoResize";
|
|
4
|
+
label: string;
|
|
5
|
+
icon: null;
|
|
6
|
+
trackEvent: {
|
|
7
|
+
category: "element";
|
|
8
|
+
};
|
|
9
|
+
predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState, _: unknown, app: AppClassProperties) => boolean;
|
|
10
|
+
perform: (elements: readonly import("../element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: AppClassProperties) => {
|
|
11
|
+
appState: Readonly<import("../types").AppState>;
|
|
12
|
+
elements: import("../element/types").OrderedExcalidrawElement[];
|
|
13
|
+
storeAction: "capture";
|
|
14
|
+
};
|
|
15
|
+
} & {
|
|
16
|
+
keyTest?: undefined;
|
|
17
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { isTextElement } from "../element";
|
|
2
|
+
import { newElementWith } from "../element/mutateElement";
|
|
3
|
+
import { measureText } from "../element/textElement";
|
|
4
|
+
import { getSelectedElements } from "../scene";
|
|
5
|
+
import { StoreAction } from "../store";
|
|
6
|
+
import { getFontString } from "../utils";
|
|
7
|
+
import { register } from "./register";
|
|
8
|
+
export const actionTextAutoResize = register({
|
|
9
|
+
name: "autoResize",
|
|
10
|
+
label: "labels.autoResize",
|
|
11
|
+
icon: null,
|
|
12
|
+
trackEvent: { category: "element" },
|
|
13
|
+
predicate: (elements, appState, _, app) => {
|
|
14
|
+
const selectedElements = getSelectedElements(elements, appState);
|
|
15
|
+
return (selectedElements.length === 1 &&
|
|
16
|
+
isTextElement(selectedElements[0]) &&
|
|
17
|
+
!selectedElements[0].autoResize);
|
|
18
|
+
},
|
|
19
|
+
perform: (elements, appState, _, app) => {
|
|
20
|
+
const selectedElements = getSelectedElements(elements, appState);
|
|
21
|
+
return {
|
|
22
|
+
appState,
|
|
23
|
+
elements: elements.map((element) => {
|
|
24
|
+
if (element.id === selectedElements[0].id && isTextElement(element)) {
|
|
25
|
+
const metrics = measureText(element.originalText, getFontString(element), element.lineHeight);
|
|
26
|
+
return newElementWith(element, {
|
|
27
|
+
autoResize: true,
|
|
28
|
+
width: metrics.width,
|
|
29
|
+
height: metrics.height,
|
|
30
|
+
text: element.originalText,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return element;
|
|
34
|
+
}),
|
|
35
|
+
storeAction: StoreAction.CAPTURE,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -163,7 +163,7 @@ export declare const actionToggleGridMode: {
|
|
|
163
163
|
userToFollow: import("../types").UserToFollow | null;
|
|
164
164
|
followedBy: Set<import("../types").SocketId>;
|
|
165
165
|
};
|
|
166
|
-
storeAction:
|
|
166
|
+
storeAction: "none";
|
|
167
167
|
};
|
|
168
168
|
checked: (appState: AppState) => boolean;
|
|
169
169
|
predicate: (element: readonly import("../element/types").ExcalidrawElement[], appState: AppState, props: import("../types").ExcalidrawProps) => boolean;
|
|
@@ -161,7 +161,7 @@ export declare const actionToggleObjectsSnapMode: {
|
|
|
161
161
|
userToFollow: import("../types").UserToFollow | null;
|
|
162
162
|
followedBy: Set<import("../types").SocketId>;
|
|
163
163
|
};
|
|
164
|
-
storeAction:
|
|
164
|
+
storeAction: "none";
|
|
165
165
|
};
|
|
166
166
|
checked: (appState: Readonly<import("../types").AppState>) => boolean;
|
|
167
167
|
predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps) => boolean;
|
|
@@ -161,7 +161,7 @@ export declare const actionToggleStats: {
|
|
|
161
161
|
userToFollow: import("../types").UserToFollow | null;
|
|
162
162
|
followedBy: Set<import("../types").SocketId>;
|
|
163
163
|
};
|
|
164
|
-
storeAction:
|
|
164
|
+
storeAction: "none";
|
|
165
165
|
};
|
|
166
166
|
checked: (appState: Readonly<import("../types").AppState>) => boolean;
|
|
167
167
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
@@ -162,7 +162,7 @@ export declare const actionToggleViewMode: {
|
|
|
162
162
|
userToFollow: import("../types").UserToFollow | null;
|
|
163
163
|
followedBy: Set<import("../types").SocketId>;
|
|
164
164
|
};
|
|
165
|
-
storeAction:
|
|
165
|
+
storeAction: "none";
|
|
166
166
|
};
|
|
167
167
|
checked: (appState: Readonly<import("../types").AppState>) => boolean;
|
|
168
168
|
predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps) => boolean;
|
|
@@ -162,7 +162,7 @@ export declare const actionToggleZenMode: {
|
|
|
162
162
|
userToFollow: import("../types").UserToFollow | null;
|
|
163
163
|
followedBy: Set<import("../types").SocketId>;
|
|
164
164
|
};
|
|
165
|
-
storeAction:
|
|
165
|
+
storeAction: "none";
|
|
166
166
|
};
|
|
167
167
|
checked: (appState: Readonly<import("../types").AppState>) => boolean;
|
|
168
168
|
predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps) => boolean;
|
|
@@ -10,7 +10,7 @@ export declare const actionSendBackward: {
|
|
|
10
10
|
perform: (elements: readonly import("../element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
|
|
11
11
|
elements: readonly import("../element/types").ExcalidrawElement[];
|
|
12
12
|
appState: Readonly<import("../types").AppState>;
|
|
13
|
-
storeAction:
|
|
13
|
+
storeAction: "capture";
|
|
14
14
|
};
|
|
15
15
|
keyPriority: number;
|
|
16
16
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
@@ -29,7 +29,7 @@ export declare const actionBringForward: {
|
|
|
29
29
|
perform: (elements: readonly import("../element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
|
|
30
30
|
elements: readonly import("../element/types").ExcalidrawElement[];
|
|
31
31
|
appState: Readonly<import("../types").AppState>;
|
|
32
|
-
storeAction:
|
|
32
|
+
storeAction: "capture";
|
|
33
33
|
};
|
|
34
34
|
keyPriority: number;
|
|
35
35
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
@@ -48,7 +48,7 @@ export declare const actionSendToBack: {
|
|
|
48
48
|
perform: (elements: readonly import("../element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
|
|
49
49
|
elements: readonly import("../element/types").ExcalidrawElement[] | import("../element/types").ExcalidrawElement[];
|
|
50
50
|
appState: Readonly<import("../types").AppState>;
|
|
51
|
-
storeAction:
|
|
51
|
+
storeAction: "capture";
|
|
52
52
|
};
|
|
53
53
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
54
54
|
PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => JSX.Element;
|
|
@@ -66,7 +66,7 @@ export declare const actionBringToFront: {
|
|
|
66
66
|
perform: (elements: readonly import("../element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
|
|
67
67
|
elements: readonly import("../element/types").ExcalidrawElement[] | import("../element/types").ExcalidrawElement[];
|
|
68
68
|
appState: Readonly<import("../types").AppState>;
|
|
69
|
-
storeAction:
|
|
69
|
+
storeAction: "capture";
|
|
70
70
|
};
|
|
71
71
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
72
72
|
PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => JSX.Element;
|
|
@@ -15,7 +15,7 @@ export type ActionResult = {
|
|
|
15
15
|
type ActionFn = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
16
16
|
export type UpdaterFn = (res: ActionResult) => void;
|
|
17
17
|
export type ActionFilterFn = (action: Action) => void;
|
|
18
|
-
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette";
|
|
18
|
+
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize";
|
|
19
19
|
export type PanelComponentProps = {
|
|
20
20
|
elements: readonly ExcalidrawElement[];
|
|
21
21
|
appState: AppState;
|
|
@@ -858,15 +858,22 @@ export class ElementsChange {
|
|
|
858
858
|
if (!flags.containsZindexDifference) {
|
|
859
859
|
return elements;
|
|
860
860
|
}
|
|
861
|
-
const
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
|
|
861
|
+
const unordered = Array.from(elements.values());
|
|
862
|
+
const ordered = orderByFractionalIndex([...unordered]);
|
|
863
|
+
const moved = Delta.getRightDifferences(unordered, ordered, true).reduce((acc, arrayIndex) => {
|
|
864
|
+
const candidate = unordered[Number(arrayIndex)];
|
|
865
|
+
if (candidate && changed.has(candidate.id)) {
|
|
866
|
+
acc.set(candidate.id, candidate);
|
|
867
|
+
}
|
|
868
|
+
return acc;
|
|
869
|
+
}, new Map());
|
|
870
|
+
if (!flags.containsVisibleDifference && moved.size) {
|
|
865
871
|
// we found a difference in order!
|
|
866
872
|
flags.containsVisibleDifference = true;
|
|
867
873
|
}
|
|
868
|
-
//
|
|
869
|
-
|
|
874
|
+
// synchronize all elements that were actually moved
|
|
875
|
+
// could fallback to synchronizing all invalid indices
|
|
876
|
+
return arrayToMap(syncMovedIndices(ordered, moved));
|
|
870
877
|
}
|
|
871
878
|
/**
|
|
872
879
|
* It is necessary to post process the partials in case of reference values,
|
|
@@ -140,7 +140,7 @@ export const ShapesSwitcher = ({ activeTool, appState, app, UIOptions, }) => {
|
|
|
140
140
|
};
|
|
141
141
|
export const ZoomActions = ({ renderAction, zoom, }) => (_jsx(Stack.Col, { gap: 1, className: "zoom-actions", children: _jsxs(Stack.Row, { align: "center", children: [renderAction("zoomOut"), renderAction("resetZoom"), renderAction("zoomIn")] }) }));
|
|
142
142
|
export const UndoRedoActions = ({ renderAction, className, }) => (_jsxs("div", { className: `undo-redo-buttons ${className}`, children: [_jsx("div", { className: "undo-button-container", children: _jsx(Tooltip, { label: t("buttons.undo"), children: renderAction("undo") }) }), _jsx("div", { className: "redo-button-container", children: _jsxs(Tooltip, { label: t("buttons.redo"), children: [" ", renderAction("redo")] }) })] }));
|
|
143
|
-
export const ExitZenModeAction = ({ actionManager, showExitZenModeBtn, }) => (_jsx("button", { className: clsx("disable-zen-mode", {
|
|
143
|
+
export const ExitZenModeAction = ({ actionManager, showExitZenModeBtn, }) => (_jsx("button", { type: "button", className: clsx("disable-zen-mode", {
|
|
144
144
|
"disable-zen-mode--visible": showExitZenModeBtn,
|
|
145
145
|
}), onClick: () => actionManager.executeAction(actionToggleZenMode), children: t("buttons.exitZenMode") }));
|
|
146
146
|
export const FinalizeAction = ({ renderAction, className, }) => (_jsx("div", { className: `finalize-button ${className}`, children: renderAction("finalize", { size: "small" }) }));
|
|
@@ -342,10 +342,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
342
342
|
elements?: SceneData["elements"];
|
|
343
343
|
appState?: Pick<AppState, K> | null | undefined;
|
|
344
344
|
collaborators?: SceneData["collaborators"];
|
|
345
|
-
/** @default StoreAction.
|
|
345
|
+
/** @default StoreAction.NONE */
|
|
346
346
|
storeAction?: SceneData["storeAction"];
|
|
347
347
|
}) => void;
|
|
348
|
-
private
|
|
348
|
+
private triggerRender;
|
|
349
349
|
/**
|
|
350
350
|
* @returns whether the menu was toggled on or off
|
|
351
351
|
*/
|