Skip to content

Commit cd37586

Browse files
fix: error when dragging a block from one editor to another with multiple column extension (#1950)
1 parent 17e3c29 commit cd37586

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/xl-multi-column/src/extensions/DropCursor/MultiColumnDropCursorPlugin.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ export function multiColumnDropCursor(
145145
id: UniqueID.options.generateID(),
146146
});
147147

148-
editor.removeBlocks([draggedBlock]);
148+
if (editor.getBlock(draggedBlock.id)) {
149+
editor.removeBlocks([draggedBlock]);
150+
}
149151

150152
editor.updateBlock(columnList, {
151153
children: newChildren,
@@ -162,7 +164,11 @@ export function multiColumnDropCursor(
162164

163165
const blocks =
164166
position === "left" ? [draggedBlock, block] : [block, draggedBlock];
165-
editor.removeBlocks([draggedBlock]);
167+
168+
if (editor.getBlock(draggedBlock.id)) {
169+
editor.removeBlocks([draggedBlock]);
170+
}
171+
166172
editor.replaceBlocks(
167173
[block],
168174
[

0 commit comments

Comments
 (0)