Fixes #2246 Sublibraries example (ExplodedExample.tsx) (#2247)

Describe what your pull request does. If appropriate, add GIFs or images
showing the before and after.

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Test Plan

1. Run the examples
2. [http://localhost:5420/exploded](http://localhost:5420/exploded)
Observe that shapes work and can be resized as expected

- [ ] Unit Tests
- [ ] End to end tests

### Release Notes

- Fixed Sublibraries (Exploded) example

Co-authored-by: Gary Saunders <gary.saunders@sportsengine.com>
Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
Gary Saunders 2023-11-25 09:18:31 -05:00 committed by GitHub
parent 932ec4cdd6
commit 699502d8c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,11 @@ import {
Canvas, Canvas,
ContextMenu, ContextMenu,
TldrawEditor, TldrawEditor,
TldrawHandles,
TldrawHoveredShapeIndicator,
TldrawScribble,
TldrawSelectionBackground,
TldrawSelectionForeground,
TldrawUi, TldrawUi,
defaultShapeTools, defaultShapeTools,
defaultShapeUtils, defaultShapeUtils,
@ -9,6 +14,15 @@ import {
} from '@tldraw/tldraw' } from '@tldraw/tldraw'
import '@tldraw/tldraw/tldraw.css' import '@tldraw/tldraw/tldraw.css'
const defaultComponents = {
Scribble: TldrawScribble,
CollaboratorScribble: TldrawScribble,
SelectionForeground: TldrawSelectionForeground,
SelectionBackground: TldrawSelectionBackground,
Handles: TldrawHandles,
HoveredShapeIndicator: TldrawHoveredShapeIndicator,
}
export default function ExplodedExample() { export default function ExplodedExample() {
return ( return (
<div className="tldraw__editor"> <div className="tldraw__editor">
@ -16,6 +30,7 @@ export default function ExplodedExample() {
initialState="select" initialState="select"
shapeUtils={defaultShapeUtils} shapeUtils={defaultShapeUtils}
tools={[...defaultTools, ...defaultShapeTools]} tools={[...defaultTools, ...defaultShapeTools]}
components={defaultComponents}
persistenceKey="exploded-example" persistenceKey="exploded-example"
> >
<TldrawUi> <TldrawUi>