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

Method getBaseBlockAttributes

src/trix/models/document.js:587–607  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

585 }
586
587 getBaseBlockAttributes() {
588 let baseBlockAttributes = this.getBlockAtIndex(0).getAttributes()
589
590 for (let blockIndex = 1; blockIndex < this.getBlockCount(); blockIndex++) {
591 const blockAttributes = this.getBlockAtIndex(blockIndex).getAttributes()
592 const lastAttributeIndex = Math.min(baseBlockAttributes.length, blockAttributes.length)
593
594 baseBlockAttributes = (() => {
595 const result = []
596 for (let index = 0; index < lastAttributeIndex; index++) {
597 if (blockAttributes[index] !== baseBlockAttributes[index]) {
598 break
599 }
600 result.push(blockAttributes[index])
601 }
602 return result
603 })()
604 }
605
606 return baseBlockAttributes
607 }
608
609 getAttachmentById(attachmentId) {
610 for (const attachment of this.getAttachments()) {

Callers 2

mergeDocumentAtRangeMethod · 0.80
trix.jsFile · 0.80

Calls 3

getBlockAtIndexMethod · 0.95
getBlockCountMethod · 0.95
getAttributesMethod · 0.45

Tested by

no test coverage detected