MCPcopy Index your code
hub / github.com/basecamp/trix / removeAttributeAtRange

Method removeAttributeAtRange

src/trix/models/document.js:253–265  ·  view source on GitHub ↗
(attribute, range)

Source from the content-addressed store, hash-verified

251 }
252
253 removeAttributeAtRange(attribute, range) {
254 let { blockList } = this
255 this.eachBlockAtRange(range, function(block, textRange, index) {
256 if (getBlockConfig(attribute)) {
257 blockList = blockList.editObjectAtIndex(index, () => block.removeAttribute(attribute))
258 } else if (textRange[0] !== textRange[1]) {
259 blockList = blockList.editObjectAtIndex(index, () =>
260 block.copyWithText(block.text.removeAttributeAtRange(attribute, textRange))
261 )
262 }
263 })
264 return new this.constructor(blockList)
265 }
266
267 updateAttributesForAttachment(attributes, attachment) {
268 const range = this.getRangeOfAttachment(attachment)

Callers 1

Calls 5

eachBlockAtRangeMethod · 0.95
getBlockConfigFunction · 0.90
editObjectAtIndexMethod · 0.80
removeAttributeMethod · 0.45
copyWithTextMethod · 0.45

Tested by

no test coverage detected