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

Method getRangeOfCommonAttributeAtPosition

src/trix/models/document.js:577–585  ·  view source on GitHub ↗
(attributeName, position)

Source from the content-addressed store, hash-verified

575 }
576
577 getRangeOfCommonAttributeAtPosition(attributeName, position) {
578 const { index, offset } = this.locationFromPosition(position)
579 const text = this.getTextAtIndex(index)
580 const [ startOffset, endOffset ] = Array.from(text.getExpandedRangeForAttributeAtOffset(attributeName, offset))
581
582 const start = this.positionFromLocation({ index, offset: startOffset })
583 const end = this.positionFromLocation({ index, offset: endOffset })
584 return normalizeRange([ start, end ])
585 }
586
587 getBaseBlockAttributes() {
588 let baseBlockAttributes = this.getBlockAtIndex(0).getAttributes()

Callers 2

trix.jsFile · 0.80

Calls 5

locationFromPositionMethod · 0.95
getTextAtIndexMethod · 0.95
positionFromLocationMethod · 0.95
normalizeRangeFunction · 0.90

Tested by

no test coverage detected