Skip to content

Commit 563a6d0

Browse files
committed
🐛(frontend) Fix drop cursor creating columns
When dropping content, the drop cursor was creating new columns. This fix ensures that the drop cursor behaves correctly and does not create unnecessary columns.
1 parent 52c998e commit 563a6d0

2 files changed

Lines changed: 47 additions & 2 deletions

File tree

  • src/frontend/apps/impress/src/features/docs/doc-editor/components/xl-multi-column

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to
1111
- 🚸(frontend) allow opening "@page" links with ctrl/command/middle-mouse click
1212
- ✅ E2E - Any instance friendly #2142
1313

14+
### Fixed
15+
16+
- 🐛(frontend) Fix drop cursor creating columns #2185
17+
1418
## [v4.8.5] - 2026-04-03
1519

1620
### Added

src/frontend/apps/impress/src/features/docs/doc-editor/components/xl-multi-column/index.ts

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,54 @@
33
* This is to ensure that the XL modules are only loaded when
44
* the application is not published as MIT.
55
*/
6+
import type {
7+
BlockNoteSchema,
8+
BlockSchema,
9+
InlineContentSchema,
10+
StyleSchema,
11+
} from '@blocknote/core';
612
import * as XLMultiColumn from '@blocknote/xl-multi-column';
713

14+
/**
15+
* Custom withMultiColumn that strips the MultiColumnDropHandlerExtension
16+
* from ColumnBlock.
17+
* This prevents dragging a block onto another block from
18+
* automatically creating a multi-column layout.
19+
* @param schema
20+
* @returns
21+
*/
22+
const withMultiColumnNoDropHandler = <
23+
B extends BlockSchema,
24+
I extends InlineContentSchema,
25+
S extends StyleSchema,
26+
>(
27+
schema: BlockNoteSchema<B, I, S>,
28+
) => {
29+
const ColumnBlockNoDropHandler = {
30+
...XLMultiColumn.ColumnBlock,
31+
extensions: [],
32+
};
33+
34+
return schema.extend({
35+
blockSpecs: {
36+
column: ColumnBlockNoDropHandler,
37+
columnList: XLMultiColumn.ColumnListBlock,
38+
},
39+
});
40+
};
41+
842
let modulesXL = undefined;
943
if (process.env.NEXT_PUBLIC_PUBLISH_AS_MIT === 'false') {
10-
modulesXL = XLMultiColumn;
44+
modulesXL = {
45+
...XLMultiColumn,
46+
withMultiColumn: withMultiColumnNoDropHandler,
47+
};
1148
}
1249

13-
type ModulesXL = typeof XLMultiColumn | undefined;
50+
type ModulesXL =
51+
| (Omit<typeof XLMultiColumn, 'withMultiColumn'> & {
52+
withMultiColumn: typeof withMultiColumnNoDropHandler;
53+
})
54+
| undefined;
1455

1556
export default modulesXL as ModulesXL;

0 commit comments

Comments
 (0)