@zsviczian/excalidraw 0.12.0-obsidian-4 → 0.12.0-obsidian-7
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/README.md +16 -8
- package/dist/excalidraw.development.js +54 -32
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionClipboard.d.ts +1 -0
- package/types/actions/actionDeleteSelected.d.ts +1 -0
- package/types/components/Actions.d.ts +15 -3
- package/types/components/App.d.ts +3 -0
- package/types/components/Footer.d.ts +9 -0
- package/types/components/LayerUI.d.ts +1 -1
- package/types/components/LibraryMenu.d.ts +1 -2
- package/types/components/MobileMenu.d.ts +3 -3
- package/types/components/Stats.d.ts +1 -1
- package/types/constants.d.ts +1 -1
- package/types/element/Hyperlink.d.ts +1 -2
- package/types/element/bounds.d.ts +1 -1
- package/types/element/linearElementEditor.d.ts +20 -12
- package/types/element/transformHandles.d.ts +5 -4
- package/types/element/types.d.ts +1 -0
- package/types/points.d.ts +2 -1
- package/types/polyfill.d.ts +2 -0
- package/types/renderer/renderScene.d.ts +18 -2
- package/types/types.d.ts +0 -1
package/README.md
CHANGED
|
@@ -394,7 +394,7 @@ For a complete list of variables, check [theme.scss](https://github.com/excalidr
|
|
|
394
394
|
| [`zenModeEnabled`](#zenModeEnabled) | boolean | | This implies if the zen mode is enabled |
|
|
395
395
|
| [`gridModeEnabled`](#gridModeEnabled) | boolean | | This implies if the grid mode is enabled |
|
|
396
396
|
| [`libraryReturnUrl`](#libraryReturnUrl) | string | | What URL should [libraries.excalidraw.com](https://libraries.excalidraw.com) be installed to |
|
|
397
|
-
| [`theme`](#theme) | [THEME.LIGHT](#THEME-1) | [THEME.
|
|
397
|
+
| [`theme`](#theme) | [THEME.LIGHT](#THEME-1) | [THEME.DARK](#THEME-1) | [THEME.LIGHT](#THEME-1) | The theme of the Excalidraw component |
|
|
398
398
|
| [`name`](#name) | string | | Name of the drawing |
|
|
399
399
|
| [`UIOptions`](#UIOptions) | <pre>{ canvasActions: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L208"> CanvasActions<a/> }</pre> | [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) |
|
|
400
400
|
| [`onPaste`](#onPaste) | <pre>(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L21">ClipboardData</a>, event: ClipboardEvent | null) => boolean</pre> | | Callback to be triggered if passed when the something is pasted in to the scene |
|
|
@@ -470,12 +470,20 @@ This helps to load Excalidraw with `initialData`. It must be an object or a [pro
|
|
|
470
470
|
|
|
471
471
|
You might want to use this when you want to load excalidraw with some initial elements and app state.
|
|
472
472
|
|
|
473
|
+
#### Storing custom data on Excalidraw elements
|
|
474
|
+
|
|
475
|
+
Beyond attributes that Excalidraw elements already support, you can store custom data on each element in a `customData` object. The type of the attribute is [`Record<string, any>`](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L59) and is optional.
|
|
476
|
+
|
|
477
|
+
You can use this to add any extra information you need to keep track of.
|
|
478
|
+
|
|
479
|
+
You can add `customData` to elements when passing them as `initialData`, or using [`updateScene`](#updateScene)/[`updateLibrary`](#updateLibrary) afterwards.
|
|
480
|
+
|
|
473
481
|
#### `ref`
|
|
474
482
|
|
|
475
483
|
You can pass a `ref` when you want to access some excalidraw APIs. We expose the below APIs:
|
|
476
484
|
|
|
477
|
-
| API |
|
|
478
|
-
| --- | --- | --- |
|
|
485
|
+
| API | Signature | Usage |
|
|
486
|
+
| --- | --- | --- |
|
|
479
487
|
| ready | `boolean` | This is set to true once Excalidraw is rendered |
|
|
480
488
|
| readyPromise | [resolvablePromise](https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317) | This promise will be resolved with the api once excalidraw has rendered. This will be helpful when you want do some action on the host app once this promise resolves. For this to work you will have to pass ref as shown [here](#readyPromise) |
|
|
481
489
|
| [updateScene](#updateScene) | <code>(scene: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L207">sceneData</a>) => void </code> | updates the scene with the sceneData |
|
|
@@ -489,11 +497,11 @@ You can pass a `ref` when you want to access some excalidraw APIs. We expose the
|
|
|
489
497
|
| scrollToContent | <code> (target?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L106">ExcalidrawElement</a> | <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L106">ExcalidrawElement</a>[]) => void </code> | Scroll the nearest element out of the elements supplied to the center. Defaults to the elements on the scene. |
|
|
490
498
|
| zoomToFit | `(target?:ExcalidrawElement[], maxZoom:number=1, margin:number=0.03) => void` | Zoom to fit elements on viewport. If no elements are supplied, the function will zoom to fit all elements. `maxZoom` is the maximum zoom level allowed (default 100%). `margin` is understood in % of viewport width and height. Default value is a minimum of 1.5% margin around the image compared to viewport . |
|
|
491
499
|
| refresh | `() => void` | Updates the offsets for the Excalidraw component so that the coordinates are computed correctly (for example the cursor position). You don't have to call this when the position is changed on page scroll or when the excalidraw container resizes (we handle that ourselves). For any other cases if the position of excalidraw is updated (example due to scroll on parent container and not page scroll) you should call this API. |
|
|
492
|
-
| [importLibrary](#importlibrary) |
|
|
493
|
-
| [setToast](#setToast) |
|
|
500
|
+
| [importLibrary](#importlibrary) | <code>(url: string, token?: string) => void</code> | Imports library from given URL |
|
|
501
|
+
| [setToast](#setToast) | <code>({ message: string, closable?:boolean, duration?:number } | null) => void</code> | This API can be used to show the toast with custom message. |
|
|
494
502
|
| [id](#id) | string | Unique ID for the excalidraw component. |
|
|
495
503
|
| [getFiles](#getFiles) | <code>() => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64">files</a> </code> | This API can be used to get the files present in the scene. It may contain files that aren't referenced by any element, so if you're persisting the files to a storage, you should compare them against stored elements. |
|
|
496
|
-
| [setActiveTool](#setActiveTool) | <code>(tool: { type: typeof <a href="https://github.com/excalidraw/excalidraw/blob/master/src/shapes.tsx#L4">SHAPES</a>[number]["value"]
|
|
504
|
+
| [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 |
|
|
497
505
|
| [setCursor](#setCursor) | <code>(cursor: string) => void </code> | This API can be used to set customise the mouse cursor on the canvas |
|
|
498
506
|
| [resetCursor](#resetCursor) | <code>() => void </code> | This API can be used to reset to default mouse cursor on the canvas |
|
|
499
507
|
|
|
@@ -1094,10 +1102,10 @@ import { loadLibraryFromBlob } from "@excalidraw/excalidraw";
|
|
|
1094
1102
|
**_Signature_**
|
|
1095
1103
|
|
|
1096
1104
|
<pre>
|
|
1097
|
-
loadLibraryFromBlob(blob: <a href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a
|
|
1105
|
+
loadLibraryFromBlob(blob: <a href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a>, defaultStatus: "published" | "unpublished")
|
|
1098
1106
|
</pre>
|
|
1099
1107
|
|
|
1100
|
-
This function loads the library from the blob.
|
|
1108
|
+
This function loads the library from the blob. Additonally takes `defaultStatus` param which sets the default status for library item if not present, defaults to `unpublished`.
|
|
1101
1109
|
|
|
1102
1110
|
#### `loadFromBlob`
|
|
1103
1111
|
|