fix: apply formatting to pasted text only when the block is a paragraph (#4906)

This commit is contained in:
q200892907 2024-03-15 14:38:27 +08:00 committed by GitHub
parent ac34617e51
commit 57e3a2ce68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,8 +13,8 @@ extension PasteNodes on EditorState {
}
final transaction = this.transaction;
final insertedDelta = insertedNode.delta;
// if the node is empty, replace it with the inserted node.
if (delta.isEmpty) {
// if the node is empty and its type is paragprah, replace it with the inserted node.
if (delta.isEmpty && node.type == ParagraphBlockKeys.type) {
transaction.insertNode(
selection.end.path.next,
insertedNode,