diff --git a/CHANGELOG.md b/CHANGELOG.md index 2091c3a0..fdf5c571 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/xl-multi-column/index.ts b/src/frontend/apps/impress/src/features/docs/doc-editor/components/xl-multi-column/index.ts index 301c34dd..584deb9e 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/xl-multi-column/index.ts +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/xl-multi-column/index.ts @@ -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, +) => { + 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 & { + withMultiColumn: typeof withMultiColumnNoDropHandler; + }) + | undefined; export default modulesXL as ModulesXL;