fix: Scope drag and drop events to Excalidraw container to prevent overriding the host drag and drop events (#4445)
* cross-env * reverting lib https://github.com/excalidraw/excalidraw/issues/4282 * Revert "reverting lib" This reverts commit 840726806a55ac53704024619a498abf767c60cb. * Update package.json * Update App.tsx * Update App.tsx * lint * updated changelog * Update src/packages/excalidraw/CHANGELOG.md Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com> * Update src/packages/excalidraw/CHANGELOG.md * Move fixes above build header * Update src/packages/excalidraw/CHANGELOG.md * lint Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com> Co-authored-by: David Luzar <luzar.david@gmail.com>
This commit is contained in:
@ -917,8 +917,16 @@ class App extends React.Component<AppProps, AppState> {
|
||||
window.removeEventListener(EVENT.RESIZE, this.onResize, false);
|
||||
window.removeEventListener(EVENT.UNLOAD, this.onUnload, false);
|
||||
window.removeEventListener(EVENT.BLUR, this.onBlur, false);
|
||||
window.removeEventListener(EVENT.DRAG_OVER, this.disableEvent, false);
|
||||
window.removeEventListener(EVENT.DROP, this.disableEvent, false);
|
||||
this.excalidrawContainerRef.current?.removeEventListener(
|
||||
EVENT.DRAG_OVER,
|
||||
this.disableEvent,
|
||||
false,
|
||||
);
|
||||
this.excalidrawContainerRef.current?.removeEventListener(
|
||||
EVENT.DROP,
|
||||
this.disableEvent,
|
||||
false,
|
||||
);
|
||||
|
||||
document.removeEventListener(
|
||||
EVENT.GESTURE_START,
|
||||
@ -987,8 +995,16 @@ class App extends React.Component<AppProps, AppState> {
|
||||
window.addEventListener(EVENT.RESIZE, this.onResize, false);
|
||||
window.addEventListener(EVENT.UNLOAD, this.onUnload, false);
|
||||
window.addEventListener(EVENT.BLUR, this.onBlur, false);
|
||||
window.addEventListener(EVENT.DRAG_OVER, this.disableEvent, false);
|
||||
window.addEventListener(EVENT.DROP, this.disableEvent, false);
|
||||
this.excalidrawContainerRef.current?.addEventListener(
|
||||
EVENT.DRAG_OVER,
|
||||
this.disableEvent,
|
||||
false,
|
||||
);
|
||||
this.excalidrawContainerRef.current?.addEventListener(
|
||||
EVENT.DROP,
|
||||
this.disableEvent,
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: AppProps, prevState: AppState) {
|
||||
|
Reference in New Issue
Block a user