mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: support updating library in updateScene API (#4546)
* feat: support updating library in updateScene API * fix * update docs * Update src/packages/excalidraw/CHANGELOG.md
This commit is contained in:
parent
5f1616f2c5
commit
b475412199
8 changed files with 32 additions and 9 deletions
|
@ -19,6 +19,8 @@ Please add the latest change on the top under the correct section.
|
|||
|
||||
### Features
|
||||
|
||||
- Support updating library using [`updateScene`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#updateScene) API [#4546](https://github.com/excalidraw/excalidraw/pull/4546).
|
||||
|
||||
- Introduced primary colors to the app. The colors can be overriden. Check [readme](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#customizing-styles) on how to do so.
|
||||
|
||||
- #### BREAKING CHANGE
|
||||
|
|
|
@ -509,6 +509,7 @@ You can use this function to update the scene with the sceneData. It accepts the
|
|||
| `appState` | [`ImportedDataState["appState"]`](https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L18) | The `appState` to be updated in the scene. |
|
||||
| `collaborators` | <pre>Map<string, <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L29">Collaborator></a></pre> | The list of collaborators to be updated in the scene. |
|
||||
| `commitToHistory` | `boolean` | Implies if the `history (undo/redo)` should be recorded. Defaults to `false`. |
|
||||
| `libraryItems` | [LibraryItems](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L258) | The `libraryItems` to be update in the scene. |
|
||||
|
||||
### `addFiles`
|
||||
|
||||
|
|
|
@ -103,6 +103,24 @@ export default function App() {
|
|||
>
|
||||
Reset Scene
|
||||
</button>
|
||||
<button
|
||||
onClick={() => {
|
||||
excalidrawRef.current.updateScene({
|
||||
libraryItems: [
|
||||
{
|
||||
status: "published",
|
||||
elements: initialData.libraryItems[0],
|
||||
},
|
||||
{
|
||||
status: "unpublished",
|
||||
elements: initialData.libraryItems[1],
|
||||
},
|
||||
],
|
||||
});
|
||||
}}
|
||||
>
|
||||
Update Library
|
||||
</button>
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue