Update the comment in the example. (#2272)

Update the External content sources example. The comment was misleading
as it mentioned dragging a file, but the example only works when you
paste the `text/html` content.


https://github.com/tldraw/tldraw/assets/2523721/7c4193ff-e2ba-417f-95c0-7da1f10b585b

Improves https://github.com/tldraw/tldraw/issues/2200

### 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

### Release Notes

- Improve the comment for one of our examples.
This commit is contained in:
Mitja Bezenšek 2023-12-05 12:10:37 +01:00 committed by GitHub
parent 7c77944951
commit 6f59e54da6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,9 @@ class DangerousHtmlExample extends BaseBoxShapeUtil<IDangerousHtmlShape> {
export default function ExternalContentSourcesExample() {
const handleMount = useCallback((editor: Editor) => {
// When a user uploads a file, create an asset from it
// We will register a new handler for text content. When a user pastes `text/html` content into the editor,
// we will create a new shape with that html content.
// To test this copy some html content from VS Code or some other text editor.
editor.registerExternalContentHandler('text', async ({ point, sources }) => {
const htmlSource = sources?.find((s) => s.type === 'text' && s.subtype === 'html')