Remove on drop override (#1612)

This PR removes the `onDropOverride` prop from the canvas, which was a
bit of a hack.

### Change Type

- [x] `major` — Breaking change

### Release Notes

- [editor] Remove `onDropOverride`
This commit is contained in:
Steve Ruiz 2023-06-18 13:51:19 +01:00 committed by GitHub
parent 336cbc7158
commit 99a46af4c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 14 deletions

View file

@ -221,9 +221,7 @@ export class BookmarkShapeUtil extends BaseBoxShapeUtil<TLBookmarkShape> {
}
// @public (undocumented)
export const Canvas: React_3.MemoExoticComponent<({ onDropOverride, }: {
onDropOverride?: ((defaultOnDrop: (e: React_3.DragEvent<Element>) => Promise<void>) => (e: React_3.DragEvent<Element>) => Promise<void>) | undefined;
}) => JSX.Element>;
export const Canvas: React_2.MemoExoticComponent<() => JSX.Element>;
// @public (undocumented)
export const checkFlag: (flag: (() => boolean) | boolean | undefined) => boolean | undefined;

View file

@ -1,7 +1,7 @@
import { Matrix2d, toDomPrecision } from '@tldraw/primitives'
import { TLHandle, TLShapeId } from '@tldraw/tlschema'
import { dedupe, modulate } from '@tldraw/utils'
import * as React from 'react'
import React from 'react'
import { react } from 'signia'
import { track, useValue } from 'signia-react'
import { useCanvasEvents } from '../hooks/useCanvasEvents'
@ -23,13 +23,7 @@ import { Shape } from './Shape'
import { ShapeIndicator } from './ShapeIndicator'
/** @public */
export const Canvas = track(function Canvas({
onDropOverride,
}: {
onDropOverride?: (
defaultOnDrop: (e: React.DragEvent<Element>) => Promise<void>
) => (e: React.DragEvent<Element>) => Promise<void>
}) {
export const Canvas = track(function Canvas() {
const editor = useEditor()
const { Background, SvgDefs } = useEditorComponents()
@ -71,9 +65,6 @@ export const Canvas = track(function Canvas({
const { context: patternContext, isReady: patternIsReady } = usePattern()
const events = useCanvasEvents()
if (onDropOverride) {
events.onDrop = onDropOverride(events.onDrop)
}
React.useEffect(() => {
if (patternIsReady && editor.isSafari) {