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:
parent
336cbc7158
commit
99a46af4c8
2 changed files with 3 additions and 14 deletions
|
@ -221,9 +221,7 @@ export class BookmarkShapeUtil extends BaseBoxShapeUtil<TLBookmarkShape> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const Canvas: React_3.MemoExoticComponent<({ onDropOverride, }: {
|
export const Canvas: React_2.MemoExoticComponent<() => JSX.Element>;
|
||||||
onDropOverride?: ((defaultOnDrop: (e: React_3.DragEvent<Element>) => Promise<void>) => (e: React_3.DragEvent<Element>) => Promise<void>) | undefined;
|
|
||||||
}) => JSX.Element>;
|
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const checkFlag: (flag: (() => boolean) | boolean | undefined) => boolean | undefined;
|
export const checkFlag: (flag: (() => boolean) | boolean | undefined) => boolean | undefined;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Matrix2d, toDomPrecision } from '@tldraw/primitives'
|
import { Matrix2d, toDomPrecision } from '@tldraw/primitives'
|
||||||
import { TLHandle, TLShapeId } from '@tldraw/tlschema'
|
import { TLHandle, TLShapeId } from '@tldraw/tlschema'
|
||||||
import { dedupe, modulate } from '@tldraw/utils'
|
import { dedupe, modulate } from '@tldraw/utils'
|
||||||
import * as React from 'react'
|
import React from 'react'
|
||||||
import { react } from 'signia'
|
import { react } from 'signia'
|
||||||
import { track, useValue } from 'signia-react'
|
import { track, useValue } from 'signia-react'
|
||||||
import { useCanvasEvents } from '../hooks/useCanvasEvents'
|
import { useCanvasEvents } from '../hooks/useCanvasEvents'
|
||||||
|
@ -23,13 +23,7 @@ import { Shape } from './Shape'
|
||||||
import { ShapeIndicator } from './ShapeIndicator'
|
import { ShapeIndicator } from './ShapeIndicator'
|
||||||
|
|
||||||
/** @public */
|
/** @public */
|
||||||
export const Canvas = track(function Canvas({
|
export const Canvas = track(function Canvas() {
|
||||||
onDropOverride,
|
|
||||||
}: {
|
|
||||||
onDropOverride?: (
|
|
||||||
defaultOnDrop: (e: React.DragEvent<Element>) => Promise<void>
|
|
||||||
) => (e: React.DragEvent<Element>) => Promise<void>
|
|
||||||
}) {
|
|
||||||
const editor = useEditor()
|
const editor = useEditor()
|
||||||
|
|
||||||
const { Background, SvgDefs } = useEditorComponents()
|
const { Background, SvgDefs } = useEditorComponents()
|
||||||
|
@ -71,9 +65,6 @@ export const Canvas = track(function Canvas({
|
||||||
const { context: patternContext, isReady: patternIsReady } = usePattern()
|
const { context: patternContext, isReady: patternIsReady } = usePattern()
|
||||||
|
|
||||||
const events = useCanvasEvents()
|
const events = useCanvasEvents()
|
||||||
if (onDropOverride) {
|
|
||||||
events.onDrop = onDropOverride(events.onDrop)
|
|
||||||
}
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (patternIsReady && editor.isSafari) {
|
if (patternIsReady && editor.isSafari) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue