@excalidraw/excalidraw 0.17.1-c0b80a0 → 0.17.1-c329470
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-JGDL4H2X.js → chunk-3DLVY5XU.js} +8272 -6864
- package/dist/browser/dev/excalidraw-assets-dev/chunk-3DLVY5XU.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{chunk-V7NFEZA6.js → chunk-NOAEU4NM.js} +9 -2
- package/dist/browser/dev/excalidraw-assets-dev/chunk-NOAEU4NM.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{en-ZSVWGT55.js → en-7IBTMWBG.js} +2 -2
- package/dist/browser/dev/excalidraw-assets-dev/{image-RJG3J34Y.js → image-N5AC7SEK.js} +2 -6
- package/dist/browser/dev/index.css +85 -50
- package/dist/browser/dev/index.css.map +3 -3
- package/dist/browser/dev/index.js +4375 -3766
- package/dist/browser/dev/index.js.map +4 -4
- package/dist/browser/prod/excalidraw-assets/{chunk-LDVEIXGO.js → chunk-7CSIPVOW.js} +2 -2
- package/dist/browser/prod/excalidraw-assets/chunk-TX3BU7T2.js +47 -0
- package/dist/browser/prod/excalidraw-assets/{en-UPNEHLDS.js → en-LOGQBETY.js} +1 -1
- package/dist/browser/prod/excalidraw-assets/image-3V4U7GZE.js +1 -0
- package/dist/browser/prod/index.css +1 -1
- package/dist/browser/prod/index.js +40 -40
- package/dist/dev/index.css +85 -50
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +8688 -6706
- package/dist/dev/index.js.map +4 -4
- package/dist/{prod/locales/en-ZXYG7GCR.json → dev/locales/en-V6KXFSCK.json} +8 -1
- package/dist/excalidraw/actions/actionAlign.d.ts +7 -6
- package/dist/excalidraw/actions/actionAlign.js +14 -14
- package/dist/excalidraw/actions/actionClipboard.d.ts +7 -3
- package/dist/excalidraw/actions/actionDeleteSelected.d.ts +7 -3
- package/dist/excalidraw/actions/actionDeleteSelected.js +103 -34
- package/dist/excalidraw/actions/actionDuplicateSelection.js +105 -95
- package/dist/excalidraw/actions/actionFlip.js +16 -7
- package/dist/excalidraw/actions/actionFrame.d.ts +493 -0
- package/dist/excalidraw/actions/actionFrame.js +45 -2
- package/dist/excalidraw/actions/actionGroup.js +6 -4
- package/dist/excalidraw/actions/actionProperties.js +145 -116
- package/dist/excalidraw/actions/actionSelectAll.js +4 -3
- package/dist/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/excalidraw/actions/shortcuts.js +1 -0
- package/dist/excalidraw/actions/types.d.ts +1 -1
- package/dist/excalidraw/align.d.ts +2 -1
- package/dist/excalidraw/align.js +15 -6
- package/dist/excalidraw/clipboard.d.ts +27 -5
- package/dist/excalidraw/clipboard.js +55 -28
- package/dist/excalidraw/components/Actions.d.ts +2 -1
- package/dist/excalidraw/components/Actions.js +4 -2
- package/dist/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/excalidraw/components/ActiveConfirmDialog.js +2 -3
- package/dist/excalidraw/components/App.d.ts +1 -0
- package/dist/excalidraw/components/App.js +216 -111
- package/dist/excalidraw/components/ColorPicker/ColorInput.js +2 -3
- package/dist/excalidraw/components/ColorPicker/ColorPicker.js +2 -3
- package/dist/excalidraw/components/ColorPicker/CustomColorList.js +1 -1
- package/dist/excalidraw/components/ColorPicker/Picker.js +1 -1
- package/dist/excalidraw/components/ColorPicker/PickerColorList.js +1 -1
- package/dist/excalidraw/components/ColorPicker/ShadeList.js +1 -1
- package/dist/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/dist/excalidraw/components/ColorPicker/colorPickerUtils.js +1 -1
- package/dist/excalidraw/components/CommandPalette/CommandPalette.js +3 -3
- package/dist/excalidraw/components/ConfirmDialog.js +17 -5
- package/dist/excalidraw/components/Dialog.js +2 -3
- package/dist/excalidraw/components/EyeDropper.d.ts +1 -1
- package/dist/excalidraw/components/EyeDropper.js +1 -1
- package/dist/excalidraw/components/IconPicker.d.ts +2 -2
- package/dist/excalidraw/components/IconPicker.js +56 -53
- package/dist/excalidraw/components/LayerUI.js +6 -6
- package/dist/excalidraw/components/LibraryMenu.d.ts +2 -16
- package/dist/excalidraw/components/LibraryMenu.js +70 -28
- package/dist/excalidraw/components/LibraryMenuHeaderContent.js +4 -5
- package/dist/excalidraw/components/MobileMenu.js +1 -1
- package/dist/excalidraw/components/OverwriteConfirm/OverwriteConfirm.js +2 -3
- package/dist/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/dist/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.js +2 -3
- package/dist/excalidraw/components/Range.d.ts +9 -0
- package/dist/excalidraw/components/Range.js +24 -0
- package/dist/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/excalidraw/components/SearchMenu.js +3 -4
- package/dist/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/excalidraw/components/Sidebar/Sidebar.js +2 -3
- package/dist/excalidraw/components/Stats/Collapsible.d.ts +2 -1
- package/dist/excalidraw/components/Stats/Collapsible.js +2 -2
- package/dist/excalidraw/components/Stats/Dimension.js +94 -8
- package/dist/excalidraw/components/Stats/MultiDimension.js +8 -5
- package/dist/excalidraw/components/Stats/Position.js +63 -3
- package/dist/excalidraw/components/Stats/index.js +21 -4
- package/dist/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/excalidraw/components/Stats/utils.js +2 -55
- package/dist/excalidraw/components/TTDDialog/TTDDialog.js +1 -1
- package/dist/excalidraw/components/ToolButton.js +4 -9
- package/dist/excalidraw/components/hoc/withInternalFallback.js +3 -3
- package/dist/excalidraw/components/hyperlink/Hyperlink.js +6 -12
- package/dist/excalidraw/components/icons.d.ts +9 -0
- package/dist/excalidraw/components/icons.js +4 -4
- package/dist/excalidraw/components/main-menu/DefaultItems.js +2 -3
- package/dist/excalidraw/constants.d.ts +5 -1
- package/dist/excalidraw/constants.js +9 -1
- package/dist/excalidraw/context/tunnels.d.ts +2 -1
- package/dist/excalidraw/context/tunnels.js +3 -1
- package/dist/excalidraw/data/blob.d.ts +1 -0
- package/dist/excalidraw/data/blob.js +7 -3
- package/dist/excalidraw/data/filesystem.d.ts +2 -1
- package/dist/excalidraw/data/filesystem.js +1 -0
- package/dist/excalidraw/data/image.d.ts +0 -6
- package/dist/excalidraw/data/image.js +1 -43
- package/dist/excalidraw/data/index.js +6 -6
- package/dist/excalidraw/data/library.d.ts +9 -3
- package/dist/excalidraw/data/library.js +43 -6
- package/dist/excalidraw/data/restore.js +26 -8
- package/dist/excalidraw/data/url.d.ts +0 -1
- package/dist/excalidraw/data/url.js +2 -4
- package/dist/excalidraw/editor-jotai.d.ts +56 -0
- package/dist/excalidraw/editor-jotai.js +8 -0
- package/dist/excalidraw/element/binding.d.ts +9 -6
- package/dist/excalidraw/element/binding.js +124 -44
- package/dist/excalidraw/element/bounds.js +10 -0
- package/dist/excalidraw/element/cropElement.d.ts +5 -0
- package/dist/excalidraw/element/cropElement.js +28 -1
- package/dist/excalidraw/element/dragElements.js +13 -7
- package/dist/excalidraw/element/elbowArrow.d.ts +16 -0
- package/dist/excalidraw/element/elbowArrow.js +1268 -0
- package/dist/excalidraw/element/embeddable.js +4 -5
- package/dist/excalidraw/element/flowchart.d.ts +1 -1
- package/dist/excalidraw/element/flowchart.js +25 -9
- package/dist/excalidraw/element/heading.d.ts +5 -1
- package/dist/excalidraw/element/heading.js +5 -1
- package/dist/excalidraw/element/image.js +19 -5
- package/dist/excalidraw/element/linearElementEditor.d.ts +9 -10
- package/dist/excalidraw/element/linearElementEditor.js +97 -38
- package/dist/excalidraw/element/mutateElement.d.ts +3 -1
- package/dist/excalidraw/element/mutateElement.js +31 -4
- package/dist/excalidraw/element/newElement.d.ts +8 -12
- package/dist/excalidraw/element/newElement.js +36 -21
- package/dist/excalidraw/element/resizeElements.d.ts +20 -5
- package/dist/excalidraw/element/resizeElements.js +593 -361
- package/dist/excalidraw/element/sortElements.js +1 -4
- package/dist/excalidraw/element/types.d.ts +23 -1
- package/dist/excalidraw/fonts/Fonts.d.ts +0 -16
- package/dist/excalidraw/fonts/Fonts.js +6 -31
- package/dist/excalidraw/frame.d.ts +11 -5
- package/dist/excalidraw/frame.js +146 -35
- package/dist/excalidraw/groups.js +3 -0
- package/dist/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/excalidraw/hooks/useLibraryItemSvg.js +2 -3
- package/dist/excalidraw/hooks/useScrollPosition.js +1 -1
- package/dist/excalidraw/i18n.js +3 -4
- package/dist/excalidraw/index.js +3 -4
- package/dist/excalidraw/locales/en.json +8 -1
- package/dist/excalidraw/renderer/interactiveScene.js +43 -32
- package/dist/excalidraw/renderer/staticScene.js +6 -4
- package/dist/excalidraw/renderer/staticSvgScene.js +1 -1
- package/dist/excalidraw/scene/Shape.js +40 -17
- package/dist/excalidraw/scene/comparisons.d.ts +0 -477
- package/dist/excalidraw/scene/comparisons.js +0 -37
- package/dist/excalidraw/scene/export.d.ts +7 -0
- package/dist/excalidraw/scene/export.js +107 -43
- package/dist/excalidraw/scene/index.d.ts +1 -1
- package/dist/excalidraw/scene/index.js +1 -1
- package/dist/excalidraw/scene/selection.js +4 -1
- package/dist/excalidraw/types.d.ts +15 -0
- package/dist/excalidraw/utility-types.d.ts +1 -0
- package/dist/excalidraw/utils.d.ts +8 -1
- package/dist/excalidraw/utils.js +9 -0
- package/dist/excalidraw/visualdebug.d.ts +8 -1
- package/dist/excalidraw/visualdebug.js +3 -0
- package/dist/math/line.d.ts +19 -0
- package/dist/math/line.js +32 -3
- package/dist/math/point.d.ts +10 -0
- package/dist/math/point.js +12 -1
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +29 -44
- package/dist/{dev/locales/en-ZXYG7GCR.json → prod/locales/en-V6KXFSCK.json} +8 -1
- package/package.json +5 -2
- package/dist/browser/dev/excalidraw-assets-dev/chunk-JGDL4H2X.js.map +0 -7
- package/dist/browser/dev/excalidraw-assets-dev/chunk-V7NFEZA6.js.map +0 -7
- package/dist/browser/prod/excalidraw-assets/chunk-S2XKB3DE.js +0 -62
- package/dist/browser/prod/excalidraw-assets/image-OFI2YYMP.js +0 -1
- package/dist/excalidraw/element/routing.d.ts +0 -12
- package/dist/excalidraw/element/routing.js +0 -642
- package/dist/excalidraw/jotai.d.ts +0 -34
- package/dist/excalidraw/jotai.js +0 -18
- /package/dist/browser/dev/excalidraw-assets-dev/{en-ZSVWGT55.js.map → en-7IBTMWBG.js.map} +0 -0
- /package/dist/browser/dev/excalidraw-assets-dev/{image-RJG3J34Y.js.map → image-N5AC7SEK.js.map} +0 -0
|
@@ -5,6 +5,8 @@ import { deepCopyElement } from "./element/newElement";
|
|
|
5
5
|
import { mutateElement } from "./element/mutateElement";
|
|
6
6
|
import { getContainingFrame } from "./frame";
|
|
7
7
|
import { arrayToMap, isMemberOf, isPromiseLike } from "./utils";
|
|
8
|
+
import { createFile, isSupportedImageFileType } from "./data/blob";
|
|
9
|
+
import { ExcalidrawError } from "./errors";
|
|
8
10
|
export const probablySupportsClipboardReadText = "clipboard" in navigator && "readText" in navigator.clipboard;
|
|
9
11
|
export const probablySupportsClipboardWriteText = "clipboard" in navigator && "writeText" in navigator.clipboard;
|
|
10
12
|
export const probablySupportsClipboardBlob = "clipboard" in navigator &&
|
|
@@ -31,6 +33,11 @@ export const createPasteEvent = ({ types, files, }) => {
|
|
|
31
33
|
});
|
|
32
34
|
if (types) {
|
|
33
35
|
for (const [type, value] of Object.entries(types)) {
|
|
36
|
+
if (typeof value !== "string") {
|
|
37
|
+
files = files || [];
|
|
38
|
+
files.push(value);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
34
41
|
try {
|
|
35
42
|
event.clipboardData?.setData(type, value);
|
|
36
43
|
if (event.clipboardData?.getData(type) !== value) {
|
|
@@ -128,12 +135,12 @@ function parseHTMLTree(el) {
|
|
|
128
135
|
return result;
|
|
129
136
|
}
|
|
130
137
|
const maybeParseHTMLPaste = (event) => {
|
|
131
|
-
const html = event.clipboardData?.getData(
|
|
138
|
+
const html = event.clipboardData?.getData(MIME_TYPES.html);
|
|
132
139
|
if (!html) {
|
|
133
140
|
return null;
|
|
134
141
|
}
|
|
135
142
|
try {
|
|
136
|
-
const doc = new DOMParser().parseFromString(html,
|
|
143
|
+
const doc = new DOMParser().parseFromString(html, MIME_TYPES.html);
|
|
137
144
|
const content = parseHTMLTree(doc.body);
|
|
138
145
|
if (content.length) {
|
|
139
146
|
return { type: "mixedContent", value: content };
|
|
@@ -144,30 +151,38 @@ const maybeParseHTMLPaste = (event) => {
|
|
|
144
151
|
}
|
|
145
152
|
return null;
|
|
146
153
|
};
|
|
154
|
+
/**
|
|
155
|
+
* Reads OS clipboard programmatically. May not work on all browsers.
|
|
156
|
+
* Will prompt user for permission if not granted.
|
|
157
|
+
*/
|
|
147
158
|
export const readSystemClipboard = async () => {
|
|
148
159
|
const types = {};
|
|
149
|
-
try {
|
|
150
|
-
if (navigator.clipboard?.readText) {
|
|
151
|
-
return { "text/plain": await navigator.clipboard?.readText() };
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
catch (error) {
|
|
155
|
-
// @ts-ignore
|
|
156
|
-
if (navigator.clipboard?.read) {
|
|
157
|
-
console.warn(`navigator.clipboard.readText() failed (${error.message}). Failling back to navigator.clipboard.read()`);
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
throw error;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
160
|
let clipboardItems;
|
|
164
161
|
try {
|
|
165
162
|
clipboardItems = await navigator.clipboard?.read();
|
|
166
163
|
}
|
|
167
164
|
catch (error) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
try {
|
|
166
|
+
if (navigator.clipboard?.readText) {
|
|
167
|
+
console.warn(`navigator.clipboard.readText() failed (${error.message}). Failling back to navigator.clipboard.read()`);
|
|
168
|
+
const readText = await navigator.clipboard?.readText();
|
|
169
|
+
if (readText) {
|
|
170
|
+
return { [MIME_TYPES.text]: readText };
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
// @ts-ignore
|
|
176
|
+
if (navigator.clipboard?.read) {
|
|
177
|
+
console.warn(`navigator.clipboard.readText() failed (${error.message}). Failling back to navigator.clipboard.read()`);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
if (error.name === "DataError") {
|
|
181
|
+
console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${error.message}`);
|
|
182
|
+
return types;
|
|
183
|
+
}
|
|
184
|
+
throw error;
|
|
185
|
+
}
|
|
171
186
|
}
|
|
172
187
|
throw error;
|
|
173
188
|
}
|
|
@@ -177,10 +192,22 @@ export const readSystemClipboard = async () => {
|
|
|
177
192
|
continue;
|
|
178
193
|
}
|
|
179
194
|
try {
|
|
180
|
-
|
|
195
|
+
if (type === MIME_TYPES.text || type === MIME_TYPES.html) {
|
|
196
|
+
types[type] = await (await item.getType(type)).text();
|
|
197
|
+
}
|
|
198
|
+
else if (isSupportedImageFileType(type)) {
|
|
199
|
+
const imageBlob = await item.getType(type);
|
|
200
|
+
const file = createFile(imageBlob, type, undefined);
|
|
201
|
+
types[type] = file;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
throw new ExcalidrawError(`Unsupported clipboard type: ${type}`);
|
|
205
|
+
}
|
|
181
206
|
}
|
|
182
207
|
catch (error) {
|
|
183
|
-
console.warn(
|
|
208
|
+
console.warn(error instanceof ExcalidrawError
|
|
209
|
+
? error.message
|
|
210
|
+
: `Cannot retrieve ${type} from clipboardItem: ${error.message}`);
|
|
184
211
|
}
|
|
185
212
|
}
|
|
186
213
|
}
|
|
@@ -193,14 +220,14 @@ export const readSystemClipboard = async () => {
|
|
|
193
220
|
/**
|
|
194
221
|
* Parses "paste" ClipboardEvent.
|
|
195
222
|
*/
|
|
196
|
-
const
|
|
223
|
+
const parseClipboardEventTextData = async (event, isPlainPaste = false) => {
|
|
197
224
|
try {
|
|
198
225
|
const mixedContent = !isPlainPaste && event && maybeParseHTMLPaste(event);
|
|
199
226
|
if (mixedContent) {
|
|
200
227
|
if (mixedContent.value.every((item) => item.type === "text")) {
|
|
201
228
|
return {
|
|
202
229
|
type: "text",
|
|
203
|
-
value: event.clipboardData?.getData(
|
|
230
|
+
value: event.clipboardData?.getData(MIME_TYPES.text) ||
|
|
204
231
|
mixedContent.value
|
|
205
232
|
.map((item) => item.value)
|
|
206
233
|
.join("\n")
|
|
@@ -209,7 +236,7 @@ const parseClipboardEvent = async (event, isPlainPaste = false) => {
|
|
|
209
236
|
}
|
|
210
237
|
return mixedContent;
|
|
211
238
|
}
|
|
212
|
-
const text = event.clipboardData?.getData(
|
|
239
|
+
const text = event.clipboardData?.getData(MIME_TYPES.text);
|
|
213
240
|
return { type: "text", value: (text || "").trim() };
|
|
214
241
|
}
|
|
215
242
|
catch {
|
|
@@ -217,10 +244,10 @@ const parseClipboardEvent = async (event, isPlainPaste = false) => {
|
|
|
217
244
|
}
|
|
218
245
|
};
|
|
219
246
|
/**
|
|
220
|
-
* Attempts to parse clipboard
|
|
247
|
+
* Attempts to parse clipboard event.
|
|
221
248
|
*/
|
|
222
249
|
export const parseClipboard = async (event, isPlainPaste = false) => {
|
|
223
|
-
const parsedEventData = await
|
|
250
|
+
const parsedEventData = await parseClipboardEventTextData(event, isPlainPaste);
|
|
224
251
|
if (parsedEventData.type === "mixedContent") {
|
|
225
252
|
return {
|
|
226
253
|
mixedContent: parsedEventData.value,
|
|
@@ -301,8 +328,8 @@ export const copyTextToSystemClipboard = async (text, clipboardEvent) => {
|
|
|
301
328
|
// (2) if fails and we have access to ClipboardEvent, use plain old setData()
|
|
302
329
|
try {
|
|
303
330
|
if (clipboardEvent) {
|
|
304
|
-
clipboardEvent.clipboardData?.setData(
|
|
305
|
-
if (clipboardEvent.clipboardData?.getData(
|
|
331
|
+
clipboardEvent.clipboardData?.setData(MIME_TYPES.text, text || "");
|
|
332
|
+
if (clipboardEvent.clipboardData?.getData(MIME_TYPES.text) !== text) {
|
|
306
333
|
throw new Error("Failed to setData on clipboardEvent");
|
|
307
334
|
}
|
|
308
335
|
return;
|
|
@@ -5,10 +5,11 @@ import type { AppClassProperties, AppProps, UIAppState, Zoom } from "../types";
|
|
|
5
5
|
import "./Actions.scss";
|
|
6
6
|
export declare const canChangeStrokeColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
|
|
7
7
|
export declare const canChangeBackgroundColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
|
|
8
|
-
export declare const SelectedShapeActions: ({ appState, elementsMap, renderAction, }: {
|
|
8
|
+
export declare const SelectedShapeActions: ({ appState, elementsMap, renderAction, app, }: {
|
|
9
9
|
appState: UIAppState;
|
|
10
10
|
elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
|
|
11
11
|
renderAction: ActionManager["renderAction"];
|
|
12
|
+
app: AppClassProperties;
|
|
12
13
|
}) => JSX.Element;
|
|
13
14
|
export declare const ShapesSwitcher: ({ activeTool, appState, app, UIOptions, }: {
|
|
14
15
|
activeTool: UIAppState["activeTool"];
|
|
@@ -20,6 +20,7 @@ import { EmbedIcon, extraToolsIcon, frameToolIcon, mermaidLogoIcon, laserPointer
|
|
|
20
20
|
import { KEYS } from "../keys";
|
|
21
21
|
import { useTunnels } from "../context/tunnels";
|
|
22
22
|
import { CLASSES } from "../constants";
|
|
23
|
+
import { alignActionsPredicate } from "../actions/actionAlign";
|
|
23
24
|
export const canChangeStrokeColor = (appState, targetElements) => {
|
|
24
25
|
let commonSelectedType = targetElements[0]?.type || null;
|
|
25
26
|
for (const element of targetElements) {
|
|
@@ -39,7 +40,7 @@ export const canChangeBackgroundColor = (appState, targetElements) => {
|
|
|
39
40
|
return (hasBackground(appState.activeTool.type) ||
|
|
40
41
|
targetElements.some((element) => hasBackground(element.type)));
|
|
41
42
|
};
|
|
42
|
-
export const SelectedShapeActions = ({ appState, elementsMap, renderAction, }) => {
|
|
43
|
+
export const SelectedShapeActions = ({ appState, elementsMap, renderAction, app, }) => {
|
|
43
44
|
const targetElements = getTargetElements(elementsMap, appState);
|
|
44
45
|
let isSingleElementBoundContainer = false;
|
|
45
46
|
if (targetElements.length === 2 &&
|
|
@@ -61,6 +62,7 @@ export const SelectedShapeActions = ({ appState, elementsMap, renderAction, }) =
|
|
|
61
62
|
const showCropEditorAction = !appState.croppingElementId &&
|
|
62
63
|
targetElements.length === 1 &&
|
|
63
64
|
isImageElement(targetElements[0]);
|
|
65
|
+
const showAlignActions = !isSingleElementBoundContainer && alignActionsPredicate(appState, app);
|
|
64
66
|
return (_jsxs("div", { className: "panelColumn", children: [_jsx("div", { children: canChangeStrokeColor(appState, targetElements) &&
|
|
65
67
|
renderAction("changeStrokeColor") }), canChangeBackgroundColor(appState, targetElements) && (_jsx("div", { children: renderAction("changeBackgroundColor") })), showFillIcons && renderAction("changeFillStyle"), (hasStrokeWidth(appState.activeTool.type) ||
|
|
66
68
|
targetElements.some((element) => hasStrokeWidth(element.type))) &&
|
|
@@ -74,7 +76,7 @@ export const SelectedShapeActions = ({ appState, elementsMap, renderAction, }) =
|
|
|
74
76
|
suppportsHorizontalAlign(targetElements, elementsMap)) &&
|
|
75
77
|
renderAction("changeTextAlign")] })), shouldAllowVerticalAlign(targetElements, elementsMap) &&
|
|
76
78
|
renderAction("changeVerticalAlign"), (canHaveArrowheads(appState.activeTool.type) ||
|
|
77
|
-
targetElements.some((element) => canHaveArrowheads(element.type))) && (_jsx(_Fragment, { children: renderAction("changeArrowhead") })), renderAction("changeOpacity"), _jsxs("fieldset", { children: [_jsx("legend", { children: t("labels.layers") }), _jsxs("div", { className: "buttonList", children: [renderAction("sendToBack"), renderAction("sendBackward"), renderAction("bringForward"), renderAction("bringToFront")] })] }),
|
|
79
|
+
targetElements.some((element) => canHaveArrowheads(element.type))) && (_jsx(_Fragment, { children: renderAction("changeArrowhead") })), renderAction("changeOpacity"), _jsxs("fieldset", { children: [_jsx("legend", { children: t("labels.layers") }), _jsxs("div", { className: "buttonList", children: [renderAction("sendToBack"), renderAction("sendBackward"), renderAction("bringForward"), renderAction("bringToFront")] })] }), showAlignActions && !isSingleElementBoundContainer && (_jsxs("fieldset", { children: [_jsx("legend", { children: t("labels.align") }), _jsxs("div", { className: "buttonList", children: [isRTL ? (_jsxs(_Fragment, { children: [renderAction("alignRight"), renderAction("alignHorizontallyCentered"), renderAction("alignLeft")] })) : (_jsxs(_Fragment, { children: [renderAction("alignLeft"), renderAction("alignHorizontallyCentered"), renderAction("alignRight")] })), targetElements.length > 2 &&
|
|
78
80
|
renderAction("distributeHorizontally"), _jsx("div", { style: { flexBasis: "100%", height: 0 } }), _jsxs("div", { style: {
|
|
79
81
|
display: "flex",
|
|
80
82
|
flexWrap: "wrap",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const activeConfirmDialogAtom: import("jotai").PrimitiveAtom<"clearCanvas" | null> & {
|
|
2
|
+
export declare const activeConfirmDialogAtom: import("jotai/vanilla/atom").PrimitiveAtom<"clearCanvas" | null> & {
|
|
3
3
|
init: "clearCanvas" | null;
|
|
4
4
|
};
|
|
5
5
|
export declare const ActiveConfirmDialog: () => JSX.Element | null;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { atom, useAtom } from "jotai";
|
|
3
2
|
import { actionClearCanvas } from "../actions";
|
|
4
3
|
import { t } from "../i18n";
|
|
5
|
-
import {
|
|
4
|
+
import { atom, useAtom } from "../editor-jotai";
|
|
6
5
|
import { useExcalidrawActionManager } from "./App";
|
|
7
6
|
import ConfirmDialog from "./ConfirmDialog";
|
|
8
7
|
export const activeConfirmDialogAtom = atom(null);
|
|
9
8
|
export const ActiveConfirmDialog = () => {
|
|
10
|
-
const [activeConfirmDialog, setActiveConfirmDialog] = useAtom(activeConfirmDialogAtom
|
|
9
|
+
const [activeConfirmDialog, setActiveConfirmDialog] = useAtom(activeConfirmDialogAtom);
|
|
11
10
|
const actionManager = useExcalidrawActionManager();
|
|
12
11
|
if (!activeConfirmDialog) {
|
|
13
12
|
return null;
|
|
@@ -248,6 +248,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
248
248
|
private renderEmbeddables;
|
|
249
249
|
private getFrameNameDOMId;
|
|
250
250
|
frameNameBoundsCache: FrameNameBoundsCache;
|
|
251
|
+
private resetEditingFrame;
|
|
251
252
|
private renderFrameNames;
|
|
252
253
|
private toggleOverscrollBehavior;
|
|
253
254
|
render(): JSX.Element;
|