Spell 'a text node holding its text and marks alone' once, as isPlainText

This commit is contained in:
2026-10-03 14:44:00 +02:00
parent ade3997cfd
commit a565d49c24
7 changed files with 18 additions and 15 deletions
+5
View File
@@ -64,6 +64,11 @@ export function emptyKeys(held: { attrs?: AdfAttributes; content?: AdfNode[]; ma
return keys
}
// A text node holding its text and marks alone: a format spells it as text, where anything more rides a carry.
export function isPlainText(node: AdfNode): boolean {
return node.type === 'text' && node.attrs === undefined && node.content === undefined && node.marks?.length !== 0
}
export function identicalMark(left: AdfMark, right: AdfMark): boolean {
return marksKey([left]) === marksKey([right])
}