🐛(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.
This commit is contained in:
Anthony LC 2026-04-07 18:04:45 +02:00
parent 52c998ee5f
commit 563a6d0e08
No known key found for this signature in database
2 changed files with 47 additions and 2 deletions

View file

@ -11,6 +11,10 @@ and this project adheres to
- 🚸(frontend) allow opening "@page" links with ctrl/command/middle-mouse click
- ✅ E2E - Any instance friendly #2142
### Fixed
- 🐛(frontend) Fix drop cursor creating columns #2185
## [v4.8.5] - 2026-04-03
### Added

View file

@ -3,13 +3,54 @@
* This is to ensure that the XL modules are only loaded when
* the application is not published as MIT.
*/
import type {
BlockNoteSchema,
BlockSchema,
InlineContentSchema,
StyleSchema,
} from '@blocknote/core';
import * as XLMultiColumn from '@blocknote/xl-multi-column';
/**
* Custom withMultiColumn that strips the MultiColumnDropHandlerExtension
* from ColumnBlock.
* This prevents dragging a block onto another block from
* automatically creating a multi-column layout.
* @param schema
* @returns
*/
const withMultiColumnNoDropHandler = <
B extends BlockSchema,
I extends InlineContentSchema,
S extends StyleSchema,
>(
schema: BlockNoteSchema<B, I, S>,
) => {
const ColumnBlockNoDropHandler = {
...XLMultiColumn.ColumnBlock,
extensions: [],
};
return schema.extend({
blockSpecs: {
column: ColumnBlockNoDropHandler,
columnList: XLMultiColumn.ColumnListBlock,
},
});
};
let modulesXL = undefined;
if (process.env.NEXT_PUBLIC_PUBLISH_AS_MIT === 'false') {
modulesXL = XLMultiColumn;
modulesXL = {
...XLMultiColumn,
withMultiColumn: withMultiColumnNoDropHandler,
};
}
type ModulesXL = typeof XLMultiColumn | undefined;
type ModulesXL =
| (Omit<typeof XLMultiColumn, 'withMultiColumn'> & {
withMultiColumn: typeof withMultiColumnNoDropHandler;
})
| undefined;
export default modulesXL as ModulesXL;