mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-07 09:25:29 +08:00
refactor: use the faster .eq
method for determining equality
This commit is contained in:
parent
aee15c2874
commit
f4a7dbaf5c
@ -1,8 +1,11 @@
|
||||
import { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
||||
|
||||
export function isNodeEmpty(node: ProseMirrorNode): boolean {
|
||||
const defaultContent = node.type.createAndFill()?.toJSON()
|
||||
const content = node.toJSON()
|
||||
const defaultContent = node.type.createAndFill()
|
||||
|
||||
return JSON.stringify(defaultContent) === JSON.stringify(content)
|
||||
if (!defaultContent) {
|
||||
return false
|
||||
}
|
||||
|
||||
return node.eq(defaultContent)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user