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

Method findRangesForBlockAttribute

src/trix/models/document.js:653–666  ·  view source on GitHub ↗
(attributeName)

Source from the content-addressed store, hash-verified

651 }
652
653 findRangesForBlockAttribute(attributeName) {
654 let position = 0
655 const ranges = []
656
657 this.getBlocks().forEach((block) => {
658 const length = block.getLength()
659 if (block.hasAttribute(attributeName)) {
660 ranges.push([ position, position + length ])
661 }
662 position += length
663 })
664
665 return ranges
666 }
667
668 findRangesForTextAttribute(attributeName, { withValue } = {}) {
669 let position = 0

Callers 2

findRangesOfBlocksMethod · 0.80
findRangesOfBlocksMethod · 0.80

Calls 3

getBlocksMethod · 0.95
getLengthMethod · 0.45
hasAttributeMethod · 0.45

Tested by

no test coverage detected