Hi, given the following spec for paragraph nodes:
paragraph: {
content: 'text*',
group: 'block',
toDOM() { return [ 'p', 0 ] },
parseDOM: [ { tag: 'p' } ]
}
can I be confident that paragraphs will always contain at most one text node?
I have extensive operations that I want to perform as quickly as possible on paragraph texts and I’m wondering if paragraph.content.firstChild?.text ?? ''
is fail-proof or if I should really use paragraph.textContent
(which is a getter that calls this.textBetween()
, which calls this.content.nodesBetween()
, which in turn calls this.nodesBetween()
)?
Thanks!
(edit: oh, btw… of course, these are read-only operations, I only need to add or remove a bunch of decorations based on the text content)