diff --git a/.changeset/dirty-insects-obey.md b/.changeset/dirty-insects-obey.md new file mode 100644 index 0000000000..45071455ab --- /dev/null +++ b/.changeset/dirty-insects-obey.md @@ -0,0 +1,5 @@ +--- +'@udecode/plate-table': patch +--- + +Fixed table insertion inside text nodes diff --git a/packages/table/src/withInsertFragmentTable.ts b/packages/table/src/withInsertFragmentTable.ts index fd3e59af7d..d23c6a7a76 100644 --- a/packages/table/src/withInsertFragmentTable.ts +++ b/packages/table/src/withInsertFragmentTable.ts @@ -156,6 +156,10 @@ export const withInsertFragmentTable = < return; } + } else if (fragment.length === 1 && fragment[0].type === ELEMENT_TABLE) { + // needed to insert as node, otherwise it will be inserted as text + editor.insertNode(fragment[0]); + return; } }