Skip to content

Commit 03c9c7b

Browse files
fix(table): insert trailing and inter-table paragraph blocks to prevent desynced selection (#4956)
1 parent acf46df commit 03c9c7b

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

packages/table/src/lib/withNormalizeTable.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,26 @@ export const withNormalizeTable: OverrideEditor<TableConfig> = ({
9494
return;
9595
}
9696
}
97+
if (path.length === 1) {
98+
const isLastBlock = path[0] === editor.children.length - 1;
99+
100+
if (isLastBlock) {
101+
editor.tf.insertNodes(editor.api.create.block(), {
102+
at: [path[0] + 1],
103+
});
104+
105+
return;
106+
}
107+
108+
const nextNode = editor.children[path[0] + 1];
109+
110+
if (ElementApi.isElement(nextNode) && nextNode.type === type) {
111+
editor.tf.insertNodes(editor.api.create.block(), {
112+
at: [path[0] + 1],
113+
});
114+
115+
return;
116+
}
97117
}
98118
}
99119
if (n.type === editor.getType(KEYS.tr)) {

0 commit comments

Comments
 (0)