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

Method insertBlockBreakAtRange

src/trix/models/document.js:291–304  ·  view source on GitHub ↗
(range)

Source from the content-addressed store, hash-verified

289 }
290
291 insertBlockBreakAtRange(range) {
292 let blocks
293 range = normalizeRange(range)
294 const [ startPosition ] = range
295 const { offset } = this.locationFromPosition(startPosition)
296
297 const document = this.removeTextAtRange(range)
298 if (offset === 0) {
299 blocks = [ new Block() ]
300 }
301 return new this.constructor(
302 document.blockList.insertSplittableListAtPosition(new SplittableList(blocks), startPosition)
303 )
304 }
305
306 applyBlockAttributeAtRange(attributeName, value, range) {
307 const expanded = this.expandRangeToLineBreaksAndSplitBlocks(range)

Callers 6

applyBlockAttributeMethod · 0.80
insertBlockBreakMethod · 0.80
trix.jsFile · 0.80
applyBlockAttributeMethod · 0.80

Calls 4

locationFromPositionMethod · 0.95
removeTextAtRangeMethod · 0.95
normalizeRangeFunction · 0.90

Tested by

no test coverage detected