Replies: 2 comments 1 reply
-
This difference happens because Plate's insertFragment (editor.tf.insertFragment) uses its own transform and normalization system, which enforces a "must have at least one block" rule. So when you insert a table at an empty paragraph, Plate inserts the table after the paragraph instead of replacing it, while Slate's insertFragment replaces the empty paragraph as you expect. This is a known difference in Plate's transform pipeline and normalization logic discussion. If you want to remove the empty paragraph after inserting a table, you can add a custom normalizer or plugin to clean up empty paragraphs after fragment insertion. Plate's transform factory system allows you to hook into or override core transforms like insertFragment, so you can post-process the document and remove empty paragraphs as needed notes. For inspiration, see how others add normalization logic in callbacks (like onSync) to handle unwanted empty paragraphs discussion. You can adapt this approach to your use case by writing a plugin or a custom normalization step that runs after table insertion. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
i try set |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
when i call
editor.tf.insertFragment(tableNode)
at empty p, it will insert tableNode after pReproduction URL
No response
Reproduction steps
1. Go to editor 2. Create a new p 3. call `editor.tf.insertFragment(tableNode)` 4. See error
Plate version
49.1.5
Slate React version
0.117.1
Screenshots
Logs
Browsers
No response
Beta Was this translation helpful? Give feedback.
All reactions