Skip to content

Commit 2c9162f

Browse files
authored
fix: resolve several drag & drop issues (#1845)
1 parent 7840a2e commit 2c9162f

File tree

10 files changed

+653
-547
lines changed

10 files changed

+653
-547
lines changed

docs/pages/docs/editor-basics/setup.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ type BlockNoteEditorOptions = {
4646
resolveFileUrl: (url: string) => Promise<string>;
4747
schema?: BlockNoteSchema;
4848
setIdAttribute?: boolean;
49-
sideMenuDetection?: "viewport" | "editor";
5049
tabBehavior?: "prefer-navigate-ui" | "prefer-indent";
5150
tables?: TableFeatures;
5251
trailingBlock?: boolean;
@@ -88,8 +87,6 @@ The hook takes two optional parameters:
8887

8988
`setIdAttribute`: Whether to render an `id` HTML attribute on blocks as well as a `data-id` attribute. Defaults to `false`.
9089

91-
`sideMenuDetection`: Determines whether the mouse cursor position is locked to the editor bounding box for showing the [Block Side Menu](/docs/ui-components/side-menu) and block drag & drop. When set to `viewport`, the Side Menu will be shown next to the nearest block to the cursor, regardless of where it is in the viewport. Dropping blocks will also be locked to the editor bounding box. Otherwise, the Side Menu will only be shown when the cursor is within the editor bounds, and blocks can only be dropped when hovering the editor. In order to use multiple editors, must be set to `editor`. Defaults to `viewport`.
92-
9390
`tabBehavior`: Determines whether pressing the tab key should navigate toolbars for keyboard accessibility. When set to `"prefer-navigate-ui`, the user can navigate toolbars using Tab. Pressing Escape re-focuses the editor, and Tab now indents blocks. `"prefer-indent"` causes Tab to always indent blocks. Defaults to `prefer-navigate-ui`.
9491

9592
`tables`: Configuration for table features. Allowing you to enable more advanced table features like `splitCells`, `cellBackgroundColor`, `cellTextColor`, and `headers`.

examples/01-basic/12-multi-editor/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { useCreateBlockNote } from "@blocknote/react";
88
function Editor(props: { initialContent?: PartialBlock[] }) {
99
// Creates a new editor instance.
1010
const editor = useCreateBlockNote({
11-
sideMenuDetection: "editor",
1211
initialContent: props.initialContent,
1312
});
1413

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"@tiptap/pm": "^2.12.0",
9494
"emoji-mart": "^5.6.0",
9595
"hast-util-from-dom": "^5.0.1",
96-
"prosemirror-dropcursor": "^1.8.1",
96+
"prosemirror-dropcursor": "^1.8.2",
9797
"prosemirror-highlight": "^0.13.0",
9898
"prosemirror-model": "^1.25.1",
9999
"prosemirror-state": "^1.4.3",

packages/core/src/editor/BlockNoteEditor.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,6 @@ export type BlockNoteEditorOptions<
312312
*/
313313
setIdAttribute?: boolean;
314314

315-
/**
316-
* The detection mode for showing the side menu - "viewport" always shows the
317-
* side menu for the block next to the mouse cursor, while "editor" only shows
318-
* it when hovering the editor or the side menu itself.
319-
*
320-
* @default "viewport"
321-
*/
322-
sideMenuDetection: "viewport" | "editor";
323-
324315
/**
325316
Select desired behavior when pressing `Tab` (or `Shift-Tab`). Specifically,
326317
what should happen when a user has selected multiple blocks while a toolbar
@@ -639,7 +630,6 @@ export class BlockNoteEditor<
639630
dropCursor: this.options.dropCursor ?? dropCursor,
640631
placeholders: newOptions.placeholders,
641632
tabBehavior: newOptions.tabBehavior,
642-
sideMenuDetection: newOptions.sideMenuDetection || "viewport",
643633
comments: newOptions.comments,
644634
pasteHandler: newOptions.pasteHandler,
645635
});

packages/core/src/editor/BlockNoteExtensions.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ type ExtensionOptions<
9090
string | undefined
9191
>;
9292
tabBehavior?: "prefer-navigate-ui" | "prefer-indent";
93-
sideMenuDetection: "viewport" | "editor";
9493
comments?: {
9594
threadStore: ThreadStore;
9695
};
@@ -133,10 +132,7 @@ export const getBlockNoteExtensions = <
133132
opts.editor,
134133
);
135134
ret["linkToolbar"] = new LinkToolbarProsemirrorPlugin(opts.editor);
136-
ret["sideMenu"] = new SideMenuProsemirrorPlugin(
137-
opts.editor,
138-
opts.sideMenuDetection,
139-
);
135+
ret["sideMenu"] = new SideMenuProsemirrorPlugin(opts.editor);
140136
ret["suggestionMenus"] = new SuggestionMenuProseMirrorPlugin(opts.editor);
141137
ret["filePanel"] = new FilePanelProsemirrorPlugin(opts.editor as any);
142138
ret["placeholder"] = new PlaceholderPlugin(opts.editor, opts.placeholders);

0 commit comments

Comments
 (0)