Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions packages/core/src/extensions/SideMenu/SideMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,20 @@ export class SideMenuView<
return;
}

// Relevance gate: Only handle drags that belong to BlockNote
// This prevents interference with external drag-and-drop libraries
// by avoiding calls to closeDropCursor() for non-BlockNote drags
const isBlockNoteDrag =
this.pmView.dragging !== null ||
this.isDragOrigin ||
event.dataTransfer?.types.includes("blocknote/html") ||
(event.target instanceof Node && this.pmView.dom.contains(event.target));

if (!isBlockNoteDrag) {
// Not a BlockNote-related drag, return early without any processing
return;
}

const dragEventContext = this.getDragEventContext(event);

if (!dragEventContext || !dragEventContext.isDropPoint) {
Expand Down Expand Up @@ -419,6 +433,23 @@ export class SideMenuView<
* - Whether the drop event is within the bounds of the current editor instance
*/
getDragEventContext = (event: DragEvent) => {
// Relevance gate: Only handle drags that belong to BlockNote
// Check if at least one of the following is true:
// 1. ProseMirror drag started in an editor
// 2. Side menu drag
// 3. BlockNote-specific data type in the drag
// 4. (optional stricter mode) Event target is inside this editor
const isBlockNoteDrag =
this.pmView.dragging !== null ||
this.isDragOrigin ||
event.dataTransfer?.types.includes("blocknote/html") ||
(event.target instanceof Node && this.pmView.dom.contains(event.target));

if (!isBlockNoteDrag) {
// Not a BlockNote-related drag, return early
return undefined;
}

// We need to check if there is text content that is being dragged (select some text & just drag it)
const textContentIsBeingDragged =
!event.dataTransfer?.types.includes("blocknote/html") &&
Expand Down Expand Up @@ -477,6 +508,19 @@ export class SideMenuView<
return;
}

// Relevance gate: Only handle drags that belong to BlockNote
// This prevents interference with external drag-and-drop libraries
const isBlockNoteDrag =
this.pmView.dragging !== null ||
this.isDragOrigin ||
event.dataTransfer?.types.includes("blocknote/html") ||
(event.target instanceof Node && this.pmView.dom.contains(event.target));

if (!isBlockNoteDrag) {
// Not a BlockNote-related drag, return early without any processing
return;
}

const context = this.getDragEventContext(event);
if (!context) {
this.closeDropCursor();
Expand Down
Loading