fix(refboard): restore drag-drop with fallback + React event handlers
- Add onDragOver/onDrop preventDefault on container div (React level) to always block browser default file-open behavior - Add DOM fallback in useCanvasSetup if ref is somehow null - setupDragDrop's native listeners handle the actual upload logic
This commit is contained in:
@@ -253,7 +253,12 @@ export function useCanvasSetup(deps: CanvasSetupDeps) {
|
||||
|
||||
// Setup drag/drop and paste
|
||||
if (!isPublicView || user) {
|
||||
const dropTarget = canvasContainerRef.current;
|
||||
// Use the ref first, fall back to DOM query for the canvas parent
|
||||
let dropTarget: HTMLElement | null = canvasContainerRef.current;
|
||||
if (!dropTarget) {
|
||||
const canvasEl = document.querySelector('canvas');
|
||||
dropTarget = canvasEl?.parentElement ?? null;
|
||||
}
|
||||
if (dropTarget) {
|
||||
dropCleanupRef.current = setupDragDrop(dropTarget, viewport, scene, resolvedBoardId, onCanvasChange);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user