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

Method getExpandedRangeInDirection

src/trix/models/composition.js:564–580  ·  view source on GitHub ↗
(direction, { length } = {})

Source from the content-addressed store, hash-verified

562 }
563
564 getExpandedRangeInDirection(direction, { length } = {}) {
565 let [ startPosition, endPosition ] = Array.from(this.getSelectedRange())
566 if (direction === "backward") {
567 if (length) {
568 startPosition -= length
569 } else {
570 startPosition = this.translateUTF16PositionFromOffset(startPosition, -1)
571 }
572 } else {
573 if (length) {
574 endPosition += length
575 } else {
576 endPosition = this.translateUTF16PositionFromOffset(endPosition, 1)
577 }
578 }
579 return normalizeRange([ startPosition, endPosition ])
580 }
581
582 shouldManageMovingCursorInDirection(direction) {
583 if (this.editingAttachment) {

Callers 5

deleteInDirectionMethod · 0.95
moveCursorInDirectionMethod · 0.95
trix.jsFile · 0.80

Calls 3

getSelectedRangeMethod · 0.95
normalizeRangeFunction · 0.90

Tested by

no test coverage detected