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:
parent
7c77944951
commit
6f59e54da6
1 changed files with 3 additions and 1 deletions
|
@ -38,7 +38,9 @@ class DangerousHtmlExample extends BaseBoxShapeUtil<IDangerousHtmlShape> {
|
||||||
|
|
||||||
export default function ExternalContentSourcesExample() {
|
export default function ExternalContentSourcesExample() {
|
||||||
const handleMount = useCallback((editor: Editor) => {
|
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 }) => {
|
editor.registerExternalContentHandler('text', async ({ point, sources }) => {
|
||||||
const htmlSource = sources?.find((s) => s.type === 'text' && s.subtype === 'html')
|
const htmlSource = sources?.find((s) => s.type === 'text' && s.subtype === 'html')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue