MCPcopy
hub / github.com/basecamp/trix / appendBlockForTextNode

Method appendBlockForTextNode

src/trix/models/html_parser.js:130–142  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

128 }
129
130 appendBlockForTextNode(node) {
131 const element = node.parentNode
132 if (element === this.currentBlockElement && this.isBlockElement(node.previousSibling)) {
133 return this.appendStringWithAttributes("\n")
134 } else if (element === this.containerElement || this.isBlockElement(element)) {
135 const attributes = this.getBlockAttributes(element)
136 const htmlAttributes = this.getBlockHTMLAttributes(element)
137 if (!arraysAreEqual(attributes, this.currentBlock?.attributes)) {
138 this.currentBlock = this.appendBlockForAttributesWithElement(attributes, element, htmlAttributes)
139 this.currentBlockElement = element
140 }
141 }
142 }
143
144 appendBlockForElement(element) {
145 const elementIsBlockElement = this.isBlockElement(element)

Callers 1

processNodeMethod · 0.95

Calls 6

isBlockElementMethod · 0.95
getBlockAttributesMethod · 0.95
arraysAreEqualFunction · 0.90

Tested by

no test coverage detected