fix(core): account for node attrs when checking if content is equal

This commit is contained in:
Nick the Sick 2024-07-22 18:41:36 +02:00
parent 4e5b2d89cd
commit 35682d1322
No known key found for this signature in database
GPG Key ID: F575992F156E5BCC
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"@tiptap/core": patch
---
This fixes a bug with the placeholder extension where a heading level other than the default was not considered empty, when comparing node contents, we need to consider that the node attributes are carried over for a fair comparison of content instead of attribute values

View File

@ -1,7 +1,7 @@
import { Node as ProseMirrorNode } from '@tiptap/pm/model'
export function isNodeEmpty(node: ProseMirrorNode): boolean {
const defaultContent = node.type.createAndFill()
const defaultContent = node.type.createAndFill(node.attrs)
if (!defaultContent) {
return false