@dwelle/excalidraw 0.4.0-336d85a → 0.4.0-6f83d64
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 +192 -3
- package/README.md +72 -16
- package/dist/excalidraw-assets/Assistant-Bold.woff2 +0 -0
- package/dist/excalidraw-assets/Assistant-Medium.woff2 +0 -0
- package/dist/excalidraw-assets/Assistant-Regular.woff2 +0 -0
- package/dist/excalidraw-assets/Assistant-SemiBold.woff2 +0 -0
- package/dist/excalidraw-assets/{vendor-cb04f63875674d708080.js → vendor-2002fe1b8862917b36c1.js} +2 -2
- package/dist/excalidraw-assets/{vendor-cb04f63875674d708080.js.LICENSE.txt → vendor-2002fe1b8862917b36c1.js.LICENSE.txt} +0 -0
- package/dist/excalidraw-assets-dev/Assistant-Bold.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Assistant-Medium.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Assistant-Regular.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Assistant-SemiBold.woff2 +0 -0
- package/dist/excalidraw.development.js +635 -276
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +2 -0
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +15 -12
- package/types/actions/actionAlign.d.ts +18 -6
- package/types/actions/actionBoundText.d.ts +5 -4
- package/types/actions/actionCanvas.d.ts +69 -47
- package/types/actions/actionClipboard.d.ts +34 -20
- package/types/actions/actionDeleteSelected.d.ts +27 -13
- package/types/actions/actionDistribute.d.ts +6 -2
- package/types/actions/actionDuplicateSelection.d.ts +3 -1
- package/types/actions/actionExport.d.ts +78 -53
- package/types/actions/actionFinalize.d.ts +13 -9
- package/types/actions/actionGroup.d.ts +6 -2
- package/types/actions/actionLinearEditor.d.ts +115 -0
- package/types/actions/actionMenu.d.ts +24 -15
- package/types/actions/actionNavigate.d.ts +3 -1
- package/types/actions/actionProperties.d.ts +104 -65
- package/types/actions/actionStyles.d.ts +5 -4
- package/types/actions/actionToggleGridMode.d.ts +5 -4
- package/types/actions/actionToggleLock.d.ts +5 -4
- package/types/actions/actionToggleStats.d.ts +5 -4
- package/types/actions/actionToggleViewMode.d.ts +5 -4
- package/types/actions/actionToggleZenMode.d.ts +5 -4
- package/types/actions/actionZindex.d.ts +12 -4
- package/types/actions/index.d.ts +1 -0
- package/types/actions/manager.d.ts +1 -1
- package/types/actions/shortcuts.d.ts +1 -1
- package/types/actions/types.d.ts +4 -2
- package/types/appState.d.ts +13 -12
- package/types/clients.d.ts +1 -1
- package/types/clipboard.d.ts +6 -1
- package/types/components/Actions.d.ts +1 -0
- package/types/components/App.d.ts +54 -2
- package/types/components/Avatar.d.ts +1 -1
- package/types/components/CollabButton.d.ts +2 -3
- package/types/components/DialogActionButton.d.ts +10 -0
- package/types/components/Footer.d.ts +2 -1
- package/types/components/HelpButton.d.ts +8 -0
- package/types/components/HintViewer.d.ts +3 -2
- package/types/components/HomeButton.d.ts +5 -0
- package/types/components/ImageExportDialog.d.ts +3 -1
- package/types/components/InitializeApp.d.ts +2 -0
- package/types/components/JSONExportDialog.d.ts +2 -2
- package/types/components/LayerUI.d.ts +6 -4
- package/types/components/LibraryButton.d.ts +1 -0
- package/types/components/LibraryMenu.d.ts +14 -5
- package/types/components/LibraryMenuBrowseButton.d.ts +7 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +12 -0
- package/types/components/LibraryMenuItems.d.ts +5 -14
- package/types/components/LibraryUnit.d.ts +2 -3
- package/types/components/LoadingMessage.d.ts +2 -0
- package/types/components/MenuItem.d.ts +11 -0
- package/types/components/MenuUtils.d.ts +1 -0
- package/types/components/MobileMenu.d.ts +9 -8
- package/types/components/Sidebar/Sidebar.d.ts +73 -0
- package/types/components/Sidebar/SidebarHeader.d.ts +20 -0
- package/types/components/Sidebar/common.d.ts +16 -0
- package/types/components/UserList.d.ts +0 -1
- package/types/components/WelcomeScreen.d.ts +10 -0
- package/types/components/WelcomeScreenDecor.d.ts +6 -0
- package/types/components/hoc/withUpstreamOverride.d.ts +10 -0
- package/types/components/icons.d.ts +81 -122
- package/types/constants.d.ts +15 -7
- package/types/data/restore.d.ts +1 -1
- package/types/data/types.d.ts +16 -1
- package/types/element/Hyperlink.d.ts +8 -5
- package/types/element/bounds.d.ts +2 -1
- package/types/element/image.d.ts +1 -1
- package/types/element/index.d.ts +1 -1
- package/types/element/linearElementEditor.d.ts +39 -10
- package/types/element/newElement.d.ts +16 -3
- package/types/element/resizeElements.d.ts +0 -1
- package/types/element/textElement.d.ts +23 -4
- package/types/element/transformHandles.d.ts +3 -4
- package/types/element/typeChecks.d.ts +1 -0
- package/types/element/types.d.ts +6 -3
- package/types/hooks/useOutsideClick.d.ts +2 -0
- package/types/keys.d.ts +13 -3
- package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-cb04f63875674d708080.d.ts → vendor-2002fe1b8862917b36c1.d.ts} +0 -0
- package/types/packages/excalidraw/example/App.d.ts +2 -1
- package/types/packages/excalidraw/example/sidebar/{Sidebar.d.ts → ExampleSidebar.d.ts} +1 -1
- package/types/packages/excalidraw/index.d.ts +2 -1
- package/types/renderer/renderElement.d.ts +4 -3
- package/types/renderer/renderScene.d.ts +1 -1
- package/types/scene/Fonts.d.ts +21 -0
- package/types/scene/Scene.d.ts +15 -0
- package/types/scene/comparisons.d.ts +1 -2
- package/types/scene/index.d.ts +1 -1
- package/types/scene/types.d.ts +1 -0
- package/types/shapes.d.ts +27 -3
- package/types/types.d.ts +32 -14
- package/types/components/BackgroundPickerAndDarkModeToggle.d.ts +0 -9
- package/types/components/Card.d.ts +0 -7
- package/types/components/HelpIcon.d.ts +0 -8
- package/types/components/SidebarLockButton.d.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -11,19 +11,208 @@ The change should be grouped under one of the below section and must contain PR
|
|
|
11
11
|
Please add the latest change on the top under the correct section.
|
|
12
12
|
-->
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## 0.13.0 (2022-10-27)
|
|
15
15
|
|
|
16
16
|
### Excalidraw API
|
|
17
17
|
|
|
18
18
|
#### Features
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
20
|
+
- `restoreElements()` now takes an optional parameter to indicate whether we should also recalculate text element dimensions. Defaults to `true`, but since this is a potentially costly operation, you may want to disable it if you restore elements in tight loops, such as during collaboration [#5432](https://github.com/excalidraw/excalidraw/pull/5432).
|
|
21
|
+
- Support rendering custom sidebar using [`renderSidebar`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#renderSidebar) prop ([#5663](https://github.com/excalidraw/excalidraw/pull/5663)).
|
|
22
|
+
- Add [`toggleMenu`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#toggleMenu) prop to toggle specific menu open/close state ([#5663](https://github.com/excalidraw/excalidraw/pull/5663)).
|
|
23
|
+
- Support [theme](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#theme) to be semi-controlled [#5660](https://github.com/excalidraw/excalidraw/pull/5660).
|
|
24
|
+
- Added support for storing [`customData`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#storing-custom-data-on-excalidraw-elements) on Excalidraw elements [#5592].
|
|
25
|
+
- Added `exportPadding?: number;` to [exportToCanvas](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#exporttocanvas) and [exportToBlob](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#exporttoblob). The default value of the padding is `10`.
|
|
22
26
|
|
|
23
27
|
#### Breaking Changes
|
|
24
28
|
|
|
29
|
+
- `props.UIOptions.canvasActions.theme` is now renamed to `props.UIOptions.canvasActions.toggleTheme` [#5660](https://github.com/excalidraw/excalidraw/pull/5660).
|
|
25
30
|
- `setToastMessage` API is now renamed to `setToast` API and the function signature is also updated [#5427](https://github.com/excalidraw/excalidraw/pull/5427). You can also pass `duration` and `closable` attributes along with `message`.
|
|
26
31
|
|
|
32
|
+
## Excalidraw Library
|
|
33
|
+
|
|
34
|
+
**_This section lists the updates made to the excalidraw library and will not affect the integration._**
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
- Render library into `Sidebar` on mobile [#5774](https://github.com/excalidraw/excalidraw/pull/5774)
|
|
39
|
+
|
|
40
|
+
- Additional drag and drop image format support (webp, bmp, ico) [#5749](https://github.com/excalidraw/excalidraw/pull/5749)
|
|
41
|
+
|
|
42
|
+
- Enter and Exit line editor via context menu [#5719](https://github.com/excalidraw/excalidraw/pull/5719)
|
|
43
|
+
|
|
44
|
+
- Further reduce darkmode init flash [#5701](https://github.com/excalidraw/excalidraw/pull/5701)
|
|
45
|
+
|
|
46
|
+
- Support segment midpoints in line editor [#5641](https://github.com/excalidraw/excalidraw/pull/5641)
|
|
47
|
+
|
|
48
|
+
- Added exportPadding to PNG (blob) export in @excalidraw/utils [#5626](https://github.com/excalidraw/excalidraw/pull/5626)
|
|
49
|
+
|
|
50
|
+
- Introduce ExcalidrawElements and ExcalidrawAppState provider [#5463](https://github.com/excalidraw/excalidraw/pull/5463)
|
|
51
|
+
|
|
52
|
+
- Enable midpoint inside linear element editor [#5564](https://github.com/excalidraw/excalidraw/pull/5564)
|
|
53
|
+
|
|
54
|
+
- Show a mid point for linear elements [#5534](https://github.com/excalidraw/excalidraw/pull/5534)
|
|
55
|
+
|
|
56
|
+
- Lock angle when editing linear elements with shift pressed [#5527](https://github.com/excalidraw/excalidraw/pull/5527)
|
|
57
|
+
|
|
58
|
+
- Redesign linear elements 🎉 [#5501](https://github.com/excalidraw/excalidraw/pull/5501)
|
|
59
|
+
|
|
60
|
+
- Cursor alignment when creating linear elements with shift pressed [#5518](https://github.com/excalidraw/excalidraw/pull/5518)
|
|
61
|
+
|
|
62
|
+
- Shift-clamp when creating multi-point lines/arrows [#5500](https://github.com/excalidraw/excalidraw/pull/5500)
|
|
63
|
+
|
|
64
|
+
- Cursor alignment when creating generic elements [#5516](https://github.com/excalidraw/excalidraw/pull/5516)
|
|
65
|
+
|
|
66
|
+
- Make context menu scrollable [#4030](https://github.com/excalidraw/excalidraw/pull/4030)
|
|
67
|
+
|
|
68
|
+
### Fixes
|
|
69
|
+
|
|
70
|
+
- Ungroup short cut key [#5779](https://github.com/excalidraw/excalidraw/pull/5779)
|
|
71
|
+
|
|
72
|
+
- Replaced KeyboardEvent.code with KeyboardEvent.key for all letters [#5523](https://github.com/excalidraw/excalidraw/pull/5523)
|
|
73
|
+
|
|
74
|
+
- Free draw flip not scaling correctly [#5752](https://github.com/excalidraw/excalidraw/pull/5752)
|
|
75
|
+
|
|
76
|
+
- Wait for window focus until prompting for library install [#5751](https://github.com/excalidraw/excalidraw/pull/5751)
|
|
77
|
+
|
|
78
|
+
- Update perfect freehand library to fix extra dot [#5727](https://github.com/excalidraw/excalidraw/pull/5727)
|
|
79
|
+
|
|
80
|
+
- RestoreElementWithProperties drops "parent" property [#5742](https://github.com/excalidraw/excalidraw/pull/5742)
|
|
81
|
+
|
|
82
|
+
- Horizontal text alignment for bound text when resizing [#5721](https://github.com/excalidraw/excalidraw/pull/5721)
|
|
83
|
+
|
|
84
|
+
- Set the dimensions of bound text correctly [#5710](https://github.com/excalidraw/excalidraw/pull/5710)
|
|
85
|
+
|
|
86
|
+
- Image-mirroring in export preview and in exported svg [#5700](https://github.com/excalidraw/excalidraw/pull/5700)
|
|
87
|
+
|
|
88
|
+
- Double state update incorrectly resetting state [#5704](https://github.com/excalidraw/excalidraw/pull/5704)
|
|
89
|
+
|
|
90
|
+
- Remove no longer used code related to collab room loading [#5699](https://github.com/excalidraw/excalidraw/pull/5699)
|
|
91
|
+
|
|
92
|
+
- Revert webpack deduping to fix `@next` runtime [#5695](https://github.com/excalidraw/excalidraw/pull/5695)
|
|
93
|
+
|
|
94
|
+
- Move to release notes for v0.9.0 and after [#5686](https://github.com/excalidraw/excalidraw/pull/5686)
|
|
95
|
+
|
|
96
|
+
- Zen-mode exit button not working [#5682](https://github.com/excalidraw/excalidraw/pull/5682)
|
|
97
|
+
|
|
98
|
+
- Buttons jump around on the mobile menu [#5658](https://github.com/excalidraw/excalidraw/pull/5658)
|
|
99
|
+
|
|
100
|
+
- #5622 - prevent session theme reset during collaboration [#5640](https://github.com/excalidraw/excalidraw/pull/5640)
|
|
101
|
+
|
|
102
|
+
- Library actions inside the sidebar [#5638](https://github.com/excalidraw/excalidraw/pull/5638)
|
|
103
|
+
|
|
104
|
+
- Don't render library menu twice for mobile [#5636](https://github.com/excalidraw/excalidraw/pull/5636)
|
|
105
|
+
|
|
106
|
+
- Reintroduce help dialog button [#5631](https://github.com/excalidraw/excalidraw/pull/5631)
|
|
107
|
+
|
|
108
|
+
- Add display name to components so it doesn't show as anonymous [#5616](https://github.com/excalidraw/excalidraw/pull/5616)
|
|
109
|
+
|
|
110
|
+
- Improve solveQuadratic when a = 0 [#5618](https://github.com/excalidraw/excalidraw/pull/5618)
|
|
111
|
+
|
|
112
|
+
- Add random tiny offsets to avoid linear elements from being clipped [#5615](https://github.com/excalidraw/excalidraw/pull/5615)
|
|
113
|
+
|
|
114
|
+
- Crash when adding a new point in the line editor #5602 [#5606](https://github.com/excalidraw/excalidraw/pull/5606)
|
|
115
|
+
|
|
116
|
+
- Allow box selection of points when inside editor [#5594](https://github.com/excalidraw/excalidraw/pull/5594)
|
|
117
|
+
|
|
118
|
+
- Remove unnecessary conditions in pointerup for linear elements [#5575](https://github.com/excalidraw/excalidraw/pull/5575)
|
|
119
|
+
|
|
120
|
+
- Check if hitting link in handleSelectionOnPointerDown [#5589](https://github.com/excalidraw/excalidraw/pull/5589)
|
|
121
|
+
|
|
122
|
+
- Points not being normalized on single-elem resize [#5581](https://github.com/excalidraw/excalidraw/pull/5581)
|
|
123
|
+
|
|
124
|
+
- Deselect linear element when clicked inside bounding box outside editor [#5579](https://github.com/excalidraw/excalidraw/pull/5579)
|
|
125
|
+
|
|
126
|
+
- Resize multiple elements from center [#5560](https://github.com/excalidraw/excalidraw/pull/5560)
|
|
127
|
+
|
|
128
|
+
- Call static methods via class instead of instance in linearElementEditor [#5561](https://github.com/excalidraw/excalidraw/pull/5561)
|
|
129
|
+
|
|
130
|
+
- Show bounding box for 3 or more linear point elements [#5554](https://github.com/excalidraw/excalidraw/pull/5554)
|
|
131
|
+
|
|
132
|
+
- Cleanup the condition for dragging elements [#5555](https://github.com/excalidraw/excalidraw/pull/5555)
|
|
133
|
+
|
|
134
|
+
- Shareable links being merged with current scene data [#5547](https://github.com/excalidraw/excalidraw/pull/5547)
|
|
135
|
+
|
|
136
|
+
- Scene lookup failing when looking up by id [#5542](https://github.com/excalidraw/excalidraw/pull/5542)
|
|
137
|
+
|
|
138
|
+
- Remove rounding to fix jitter when shift-editing [#5543](https://github.com/excalidraw/excalidraw/pull/5543)
|
|
139
|
+
|
|
140
|
+
- Line deselected when shift-dragging point outside editor [#5540](https://github.com/excalidraw/excalidraw/pull/5540)
|
|
141
|
+
|
|
142
|
+
- Flip linear elements after redesign [#5538](https://github.com/excalidraw/excalidraw/pull/5538)
|
|
143
|
+
|
|
144
|
+
- Disable locking aspect ratio for box-selection [#5525](https://github.com/excalidraw/excalidraw/pull/5525)
|
|
145
|
+
|
|
146
|
+
- Add `title` attribute to the modal close button [#5521](https://github.com/excalidraw/excalidraw/pull/5521)
|
|
147
|
+
|
|
148
|
+
- Context menu positioning when component has offsets [#5520](https://github.com/excalidraw/excalidraw/pull/5520)
|
|
149
|
+
|
|
150
|
+
- Resolve paths in prebuild.js script [#5498](https://github.com/excalidraw/excalidraw/pull/5498)
|
|
151
|
+
|
|
152
|
+
- Use flushSync when moving line editor since we need to read previous value after setting state [#5508](https://github.com/excalidraw/excalidraw/pull/5508)
|
|
153
|
+
|
|
154
|
+
- UseLayout effect cleanup in dev mode for charts [#5505](https://github.com/excalidraw/excalidraw/pull/5505)
|
|
155
|
+
|
|
156
|
+
- Revert browser toast for high/low zoom [#5495](https://github.com/excalidraw/excalidraw/pull/5495)
|
|
157
|
+
|
|
158
|
+
- Fixing push to DockerHub [#5468](https://github.com/excalidraw/excalidraw/pull/5468)
|
|
159
|
+
|
|
160
|
+
- Incorrectly rendering freedraw elements [#5481](https://github.com/excalidraw/excalidraw/pull/5481)
|
|
161
|
+
|
|
162
|
+
- Generate types when building example [#5480](https://github.com/excalidraw/excalidraw/pull/5480)
|
|
163
|
+
|
|
164
|
+
- Use React.FC as react-dom is not able to infer types of Modal [#5479](https://github.com/excalidraw/excalidraw/pull/5479)
|
|
165
|
+
|
|
166
|
+
- Missing translation for "Scale" to Export Dialog [#5456](https://github.com/excalidraw/excalidraw/pull/5456)
|
|
167
|
+
|
|
168
|
+
- Add display name for Excalidraw component so it doesn't show as anonymous [#5464](https://github.com/excalidraw/excalidraw/pull/5464)
|
|
169
|
+
|
|
170
|
+
- Account for safe area for floating buttons on mobile [#5420](https://github.com/excalidraw/excalidraw/pull/5420)
|
|
171
|
+
|
|
172
|
+
- Attribute warnings in comment svg example [#5465](https://github.com/excalidraw/excalidraw/pull/5465)
|
|
173
|
+
|
|
174
|
+
- Check for ctrl key when wheel event triggered to only disable zooming [#5459](https://github.com/excalidraw/excalidraw/pull/5459)
|
|
175
|
+
|
|
176
|
+
- Disable render throttling by default & during resize [#5451](https://github.com/excalidraw/excalidraw/pull/5451)
|
|
177
|
+
|
|
178
|
+
- Attach wheel event to exscalidraw container only [#5443](https://github.com/excalidraw/excalidraw/pull/5443)
|
|
179
|
+
|
|
180
|
+
- Show toast when browser zoom is not 100% [#5304](https://github.com/excalidraw/excalidraw/pull/5304)
|
|
181
|
+
|
|
182
|
+
- Prevent browser zoom inside Excalidraw [#5426](https://github.com/excalidraw/excalidraw/pull/5426)
|
|
183
|
+
|
|
184
|
+
- Typo in changelog [#5425](https://github.com/excalidraw/excalidraw/pull/5425)
|
|
185
|
+
|
|
186
|
+
### Refactor
|
|
187
|
+
|
|
188
|
+
- Create a util to compute container dimensions for bound text container [#5708](https://github.com/excalidraw/excalidraw/pull/5708)
|
|
189
|
+
|
|
190
|
+
- Reuse common ui dialogs and message for mobile and LayerUI [#5611](https://github.com/excalidraw/excalidraw/pull/5611)
|
|
191
|
+
|
|
192
|
+
- Stats component [#5610](https://github.com/excalidraw/excalidraw/pull/5610)
|
|
193
|
+
|
|
194
|
+
- Move footer to its own component [#5609](https://github.com/excalidraw/excalidraw/pull/5609)
|
|
195
|
+
|
|
196
|
+
- Remove unused attribute hasHitElementInside from pointerDownState [#5591](https://github.com/excalidraw/excalidraw/pull/5591)
|
|
197
|
+
|
|
198
|
+
- Cleanup renderScene [#5573](https://github.com/excalidraw/excalidraw/pull/5573)
|
|
199
|
+
|
|
200
|
+
- Rename docs to dev-docs [#5487](https://github.com/excalidraw/excalidraw/pull/5487)
|
|
201
|
+
|
|
202
|
+
- Remove unnecessary if condition for linear element onKeyDown [#5486](https://github.com/excalidraw/excalidraw/pull/5486)
|
|
203
|
+
|
|
204
|
+
- Improve typing & check [#5415](https://github.com/excalidraw/excalidraw/pull/5415)
|
|
205
|
+
|
|
206
|
+
- Don't pass zenModeEnable, viewModeEnabled and toggleZenMode props to LayerUI [#5444](https://github.com/excalidraw/excalidraw/pull/5444)
|
|
207
|
+
|
|
208
|
+
### Build
|
|
209
|
+
|
|
210
|
+
- Add missing dependencies: pica, lodash [#5656](https://github.com/excalidraw/excalidraw/pull/5656)
|
|
211
|
+
|
|
212
|
+
- Move dotenv to dev deps [#5472](https://github.com/excalidraw/excalidraw/pull/5472)
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
27
216
|
## 0.12.0 (2022-07-07)
|
|
28
217
|
|
|
29
218
|
Check out the [release notes](https://github.com/excalidraw/excalidraw/releases/tag/v0.12.0) )
|
package/README.md
CHANGED
|
@@ -376,13 +376,17 @@ Most notably, you can customize the primary colors, by overriding these variable
|
|
|
376
376
|
|
|
377
377
|
For a complete list of variables, check [theme.scss](https://github.com/excalidraw/excalidraw/blob/master/src/css/theme.scss), though most of them will not make sense to override.
|
|
378
378
|
|
|
379
|
+
### Does this package support collaboration ?
|
|
380
|
+
|
|
381
|
+
No, Excalidraw package doesn't come with collaboration built in, since the implementation is specific to each host app. We expose APIs which you can use to communicate with Excalidraw which you can use to implement it. You can check our own implementation [here](https://github.com/excalidraw/excalidraw/blob/master/src/excalidraw-app/index.tsx).
|
|
382
|
+
|
|
379
383
|
### Props
|
|
380
384
|
|
|
381
385
|
| Name | Type | Default | Description |
|
|
382
386
|
| --- | --- | --- | --- |
|
|
383
387
|
| [`onChange`](#onChange) | Function | | This callback is triggered whenever the component updates due to any change. This callback will receive the excalidraw elements and the current app state. |
|
|
384
|
-
| [`initialData`](#initialData) | <
|
|
385
|
-
| [`ref`](#ref) | [`createRef`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs) | [`useRef`](https://reactjs.org/docs/hooks-reference.html#useref) | [`callbackRef`](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) | <
|
|
388
|
+
| [`initialData`](#initialData) | <code>{elements?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L106">ExcalidrawElement[]</a>, appState?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L79">AppState<a> } </code> | null | The initial data with which app loads. |
|
|
389
|
+
| [`ref`](#ref) | [`createRef`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs) | [`useRef`](https://reactjs.org/docs/hooks-reference.html#useref) | [`callbackRef`](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) | <code>{ current: { readyPromise: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317">resolvablePromise</a> } }</code> | | Ref to be passed to Excalidraw |
|
|
386
390
|
| [`onCollabButtonClick`](#onCollabButtonClick) | Function | | Callback to be triggered when the collab button is clicked |
|
|
387
391
|
| [`isCollaborating`](#isCollaborating) | `boolean` | | This implies if the app is in collaboration mode |
|
|
388
392
|
| [`onPointerUpdate`](#onPointerUpdate) | Function | | Callback triggered when mouse pointer is updated. |
|
|
@@ -390,22 +394,23 @@ For a complete list of variables, check [theme.scss](https://github.com/excalidr
|
|
|
390
394
|
| [`renderTopRightUI`](#renderTopRightUI) | Function | | Function that renders custom UI in top right corner |
|
|
391
395
|
| [`renderFooter `](#renderFooter) | Function | | Function that renders custom UI footer |
|
|
392
396
|
| [`renderCustomStats`](#renderCustomStats) | Function | | Function that can be used to render custom stats on the stats dialog. |
|
|
397
|
+
| [`renderSIdebar`](#renderSIdebar) | Function | | Render function that renders custom sidebar. |
|
|
393
398
|
| [`viewModeEnabled`](#viewModeEnabled) | boolean | | This implies if the app is in view mode. |
|
|
394
399
|
| [`zenModeEnabled`](#zenModeEnabled) | boolean | | This implies if the zen mode is enabled |
|
|
395
400
|
| [`gridModeEnabled`](#gridModeEnabled) | boolean | | This implies if the grid mode is enabled |
|
|
396
401
|
| [`libraryReturnUrl`](#libraryReturnUrl) | string | | What URL should [libraries.excalidraw.com](https://libraries.excalidraw.com) be installed to |
|
|
397
402
|
| [`theme`](#theme) | [THEME.LIGHT](#THEME-1) | [THEME.DARK](#THEME-1) | [THEME.LIGHT](#THEME-1) | The theme of the Excalidraw component |
|
|
398
403
|
| [`name`](#name) | string | | Name of the drawing |
|
|
399
|
-
| [`UIOptions`](#UIOptions) | <
|
|
400
|
-
| [`onPaste`](#onPaste) | <
|
|
404
|
+
| [`UIOptions`](#UIOptions) | <code>{ canvasActions: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L208"> CanvasActions<a/> }</code> | [DEFAULT UI OPTIONS](https://github.com/excalidraw/excalidraw/blob/master/src/constants.ts#L129) | To customise UI options. Currently we support customising [`canvas actions`](#canvasActions) |
|
|
405
|
+
| [`onPaste`](#onPaste) | <code>(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L21">ClipboardData</a>, event: ClipboardEvent | null) => boolean</code> | | Callback to be triggered if passed when the something is pasted in to the scene |
|
|
401
406
|
| [`detectScroll`](#detectScroll) | boolean | true | Indicates whether to update the offsets when nearest ancestor is scrolled. |
|
|
402
407
|
| [`handleKeyboardGlobally`](#handleKeyboardGlobally) | boolean | false | Indicates whether to bind the keyboard events to document. |
|
|
403
|
-
| [`onLibraryChange`](#onLibraryChange) | <
|
|
408
|
+
| [`onLibraryChange`](#onLibraryChange) | <code>(items: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L200">LibraryItems</a>) => void | Promise<any> </code> | | The callback if supplied is triggered when the library is updated and receives the library items. |
|
|
404
409
|
| [`autoFocus`](#autoFocus) | boolean | false | Implies whether to focus the Excalidraw component on page load |
|
|
405
410
|
| [`generateIdForFile`](#generateIdForFile) | `(file: File) => string | Promise<string>` | Allows you to override `id` generation for files added on canvas |
|
|
406
|
-
| [`onLinkOpen`](#onLinkOpen) | <
|
|
407
|
-
| [`onPointerDown`](#onPointerDown) | <
|
|
408
|
-
| [`onScrollChange`](#onScrollChange) | (scrollX: number, scrollY: number) | | This prop if passed gets triggered when scrolling the canvas. |
|
|
411
|
+
| [`onLinkOpen`](#onLinkOpen) | <code>(element: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L106">NonDeletedExcalidrawElement</a>, event: CustomEvent) </code> | | This prop if passed will be triggered when link of an element is clicked. |
|
|
412
|
+
| [`onPointerDown`](#onPointerDown) | <code>(activeTool: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L93"> AppState["activeTool"]</a>, pointerDownState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L365">PointerDownState</a>) => void</code> | | This prop if passed gets triggered on pointer down evenets |
|
|
413
|
+
| [`onScrollChange`](#onScrollChange) | <code>(scrollX: number, scrollY: number)</code> | | This prop if passed gets triggered when scrolling the canvas. |
|
|
409
414
|
|
|
410
415
|
### Dimensions of Excalidraw
|
|
411
416
|
|
|
@@ -503,6 +508,7 @@ You can pass a `ref` when you want to access some excalidraw APIs. We expose the
|
|
|
503
508
|
| [setActiveTool](#setActiveTool) | <code>(tool: { type: typeof <a href="https://github.com/excalidraw/excalidraw/blob/master/src/shapes.tsx#L4">SHAPES</a> [number]["value"]| "eraser" } | { type: "custom"; customType: string }) => void</code> | This API can be used to set the active tool |
|
|
504
509
|
| [setCursor](#setCursor) | <code>(cursor: string) => void </code> | This API can be used to set customise the mouse cursor on the canvas |
|
|
505
510
|
| [resetCursor](#resetCursor) | <code>() => void </code> | This API can be used to reset to default mouse cursor on the canvas |
|
|
511
|
+
| [toggleMenu](#toggleMenu) | <code>(type: string, force?: boolean) => boolean</code> | Toggles specific menus on/off |
|
|
506
512
|
|
|
507
513
|
#### `readyPromise`
|
|
508
514
|
|
|
@@ -619,6 +625,38 @@ A function returning JSX to render custom UI footer. For example, you can use th
|
|
|
619
625
|
|
|
620
626
|
A function that can be used to render custom stats (returns JSX) in the nerd stats dialog. For example you can use this prop to render the size of the elements in the storage.
|
|
621
627
|
|
|
628
|
+
#### `renderSidebar`
|
|
629
|
+
|
|
630
|
+
<pre>
|
|
631
|
+
() => JSX | null
|
|
632
|
+
</pre>
|
|
633
|
+
|
|
634
|
+
Optional function that can render custom sidebar. This sidebar is the same that the library menu sidebar is using, and can be used for any purposes your app needs. The render function should return a `<Sidebar>` instance — a component that is exported from the Excalidraw package. It accepts `children` which can be any content you like to render inside.
|
|
635
|
+
|
|
636
|
+
The `<Sidebar>` component takes these props (all are optional except `children`):
|
|
637
|
+
|
|
638
|
+
| name | type | description |
|
|
639
|
+
| --- | --- | --- |
|
|
640
|
+
| className | string |
|
|
641
|
+
| children | <pre>React.ReactNode</pre> | Content you want to render inside the sidebar. |
|
|
642
|
+
| onClose | <pre>() => void</pre> | Invoked when the component is closed (by user, or the editor). No need to act on this event, as the editor manages the sidebar open state on its own. |
|
|
643
|
+
| onDock | <pre>(isDocked: boolean) => void</pre> | Invoked when the user toggles the dock button. |
|
|
644
|
+
| docked | boolean | Indicates whether the sidebar is docked. By default, the sidebar is undocked. If passed, the docking becomes controlled, and you are responsible for updating the `docked` state by listening on `onDock` callback. See [here](#dockedSidebarBreakpoint) for more info docking. |
|
|
645
|
+
| dockable | boolean | Indicates whether the sidebar can be docked by user (=the dock button is shown). If `false`, you can still dock programmatically by passing `docked=true` |
|
|
646
|
+
|
|
647
|
+
The sidebar will always include a header with close/dock buttons (when applicable).
|
|
648
|
+
|
|
649
|
+
You can also add custom content to the header, by rendering `<Sidebar.Header>` as a child of the `<Sidebar>` component. Note that the custom header will still include the default buttons.
|
|
650
|
+
|
|
651
|
+
The `<Sidebar.Header>` component takes these props children (all are optional):
|
|
652
|
+
|
|
653
|
+
| name | type | description |
|
|
654
|
+
| --- | --- | --- |
|
|
655
|
+
| className | string |
|
|
656
|
+
| children | <pre>React.ReactNode</pre> | Content you want to render inside the sidebar header, sibling of the header buttons. |
|
|
657
|
+
|
|
658
|
+
For example code, see the example [`App.tsx`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/example/App.tsx#L524) file.
|
|
659
|
+
|
|
622
660
|
#### `viewModeEnabled`
|
|
623
661
|
|
|
624
662
|
This prop indicates whether the app is in `view mode`. When supplied, the value takes precedence over `intialData.appState.viewModeEnabled`, the `view mode` will be fully controlled by the host app, and users won't be able to toggle it from within the app.
|
|
@@ -637,7 +675,9 @@ If supplied, this URL will be used when user tries to install a library from [li
|
|
|
637
675
|
|
|
638
676
|
#### `theme`
|
|
639
677
|
|
|
640
|
-
This prop controls Excalidraw's theme. When supplied, the value takes precedence over `intialData.appState.theme`, the theme will be fully controlled by the host app, and users won't be able to toggle it from within the app.
|
|
678
|
+
This prop controls Excalidraw's theme. When supplied, the value takes precedence over `intialData.appState.theme`, the theme will be fully controlled by the host app, and users won't be able to toggle it from within the app unless `UIOptions.canvasActions.toggleTheme` is set to `true`, in which case the `theme` prop will control Excalidraw's default theme with ability to allow theme switching (you must take care of updating the `theme` prop when you detect a change to `appState.theme` from the [onChange](#onChange) callback).
|
|
679
|
+
|
|
680
|
+
You can use [`THEME`](#THEME-1) to specify the theme.
|
|
641
681
|
|
|
642
682
|
#### `name`
|
|
643
683
|
|
|
@@ -660,7 +700,7 @@ This prop can be used to customise UI of Excalidraw. Currently we support custom
|
|
|
660
700
|
| `export` | false | [exportOpts](#exportOpts) | <pre>{ saveFileToDisk: true }</pre> | This prop allows to customize the UI inside the export dialog. By default it shows the "saveFileToDisk". If this prop is `false` the export button will not be rendered. For more details visit [`exportOpts`](#exportOpts). |
|
|
661
701
|
| `loadScene` | boolean | true | Implies whether to show `Load button` |
|
|
662
702
|
| `saveToActiveFile` | boolean | true | Implies whether to show `Save button` to save to current file |
|
|
663
|
-
| `
|
|
703
|
+
| `toggleTheme` | boolean | null | null | Implies whether to show `Theme toggle`. When defined as `boolean`, takes precedence over [`props.theme`](#theme) to show `Theme toggle` |
|
|
664
704
|
| `saveAsImage` | boolean | true | Implies whether to show `Save as image button` |
|
|
665
705
|
|
|
666
706
|
##### `dockedSidebarBreakpoint`
|
|
@@ -751,6 +791,16 @@ This API can be used to customise the mouse cursor on the canvas and has the bel
|
|
|
751
791
|
(cursor: string) => void
|
|
752
792
|
</pre>
|
|
753
793
|
|
|
794
|
+
#### `toggleMenu`
|
|
795
|
+
|
|
796
|
+
<pre>
|
|
797
|
+
(type: "library" | "customSidebar", force?: boolean) => boolean
|
|
798
|
+
</pre>
|
|
799
|
+
|
|
800
|
+
This API can be used to toggle a specific menu (currently only the sidebars), and returns whether the menu was toggled on or off. If the `force` flag passed, it will force the menu to be toggled either on/off based on the boolean passed.
|
|
801
|
+
|
|
802
|
+
This API is especially useful when you render a custom sidebar using [`renderSidebar`](#renderSidebar) prop, and you want to toggle it from your app based on a user action.
|
|
803
|
+
|
|
754
804
|
#### `resetCursor`
|
|
755
805
|
|
|
756
806
|
This API can be used to reset to default mouse cursor.
|
|
@@ -840,10 +890,6 @@ This prop if passed will be triggered when canvas is scrolled and has the below
|
|
|
840
890
|
(scrollX: number, scrollY: number) => void
|
|
841
891
|
```
|
|
842
892
|
|
|
843
|
-
### Does it support collaboration ?
|
|
844
|
-
|
|
845
|
-
No, Excalidraw package doesn't come with collaboration built in, since the implementation is specific to each host app. We expose APIs which you can use to communicate with Excalidraw which you can use to implement it. You can check our own implementation [here](https://github.com/excalidraw/excalidraw/blob/master/src/excalidraw-app/index.tsx).
|
|
846
|
-
|
|
847
893
|
### Restore utilities
|
|
848
894
|
|
|
849
895
|
#### `restoreAppState`
|
|
@@ -869,7 +915,11 @@ When `localAppState` is supplied, it's used in place of values that are missing
|
|
|
869
915
|
**_Signature_**
|
|
870
916
|
|
|
871
917
|
<pre>
|
|
872
|
-
restoreElements(
|
|
918
|
+
restoreElements(
|
|
919
|
+
elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L16">ImportedDataState["elements"]</a>,
|
|
920
|
+
localElements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L16">ExcalidrawElement[]</a> | null | undefined): <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L106">ExcalidrawElement[]</a>,
|
|
921
|
+
refreshDimensions: boolean
|
|
922
|
+
)
|
|
873
923
|
</pre>
|
|
874
924
|
|
|
875
925
|
**_How to use_**
|
|
@@ -882,12 +932,18 @@ This function will make sure all properties of element is correctly set and if a
|
|
|
882
932
|
|
|
883
933
|
When `localElements` are supplied, they are used to ensure that existing restored elements reuse `version` (and increment it), and regenerate `versionNonce`. Use this when you import elements which may already be present in the scene to ensure that you do not disregard the newly imported elements if you're using element version to detect the updates.
|
|
884
934
|
|
|
935
|
+
Parameter `refreshDimensions` indicates whether we should also recalculate text element dimensions. Defaults to `false`. Since this is a potentially costly operation, you may want to disable it if you restore elements in tight loops, such as during collaboration.
|
|
936
|
+
|
|
885
937
|
#### `restore`
|
|
886
938
|
|
|
887
939
|
**_Signature_**
|
|
888
940
|
|
|
889
941
|
<pre>
|
|
890
|
-
restoreElements(
|
|
942
|
+
restoreElements(
|
|
943
|
+
data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L12">ImportedDataState</a>,
|
|
944
|
+
localAppState: Partial<<a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L79">AppState</a>> | null | undefined,
|
|
945
|
+
localElements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L16">ExcalidrawElement[]</a> | null | undefined): <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L4">DataState</a>
|
|
946
|
+
)
|
|
891
947
|
</pre>
|
|
892
948
|
|
|
893
949
|
See [`restoreAppState()`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#restoreAppState) about `localAppState`, and [`restoreElements()`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#restoreElements) about `localElements`.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|