Skip to content
Merged
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
21 changes: 6 additions & 15 deletions packages/core/src/extensions/SideMenu/SideMenuPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,21 +242,11 @@ export class SideMenuView<

this.hoveredBlock = block.node;

// Gets the block's content node, which lets to ignore child blocks when determining the block menu's position.
// TODO: needed?
const blockContent = block.node.firstChild as HTMLElement;

if (!blockContent) {
return;
}

// TODO: needed?

// Shows or updates elements.
if (this.editor.isEditable) {
const blockContentBoundingBox = blockContent.getBoundingClientRect();
const blockContentBoundingBox = block.node.getBoundingClientRect();
const column = block.node.closest("[data-node-type=column]");
this.updateState({
this.state = {
show: true,
referencePos: new DOMRect(
column
Expand All @@ -275,7 +265,8 @@ export class SideMenuView<
block: this.editor.getBlock(
this.hoveredBlock!.getAttribute("data-id")!,
)!,
});
};
this.updateState(this.state);
}
};

Expand Down Expand Up @@ -435,9 +426,9 @@ export class SideMenuView<
// 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") &&
Boolean(this.pmView.dragging);
!!this.pmView.dragging;
// This is the side menu drag from this plugin
const sideMenuIsBeingDragged = Boolean(this.isDragOrigin);
const sideMenuIsBeingDragged = !!this.isDragOrigin;
// Tells us that the current editor instance has a drag ongoing (either text or side menu)
const isDragOrigin = textContentIsBeingDragged || sideMenuIsBeingDragged;

Expand Down
Loading