mirror of
https://github.com/suitenumerique/docs.git
synced 2026-04-25 17:15:01 +02:00
🐛(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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user