From 1d2146b63890ff68b3e89cbe1253bee4292adab3 Mon Sep 17 00:00:00 2001 From: Nikita Korovin Date: Mon, 27 Nov 2023 17:12:09 +0400 Subject: [PATCH 1/2] fix: insert table in paragraph --- packages/table/src/withInsertFragmentTable.ts | 4 ++++ 1 file changed, 4 insertions(+) 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; } } From 089e4bd1272d2aec6fb91cf28e7e8b7baf122c9a Mon Sep 17 00:00:00 2001 From: Nikita Korovin Date: Mon, 27 Nov 2023 17:18:40 +0400 Subject: [PATCH 2/2] changeset --- .changeset/dirty-insects-obey.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/dirty-insects-obey.md 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