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

Method updateAttributesForAttachment

src/trix/models/document.js:267–278  ·  view source on GitHub ↗
(attributes, attachment)

Source from the content-addressed store, hash-verified

265 }
266
267 updateAttributesForAttachment(attributes, attachment) {
268 const range = this.getRangeOfAttachment(attachment)
269 const [ startPosition ] = Array.from(range)
270 const { index } = this.locationFromPosition(startPosition)
271 const text = this.getTextAtIndex(index)
272
273 return new this.constructor(
274 this.blockList.editObjectAtIndex(index, (block) =>
275 block.copyWithText(text.updateAttributesForAttachment(attributes, attachment))
276 )
277 )
278 }
279
280 removeAttributeForAttachment(attribute, attachment) {
281 const range = this.getRangeOfAttachment(attachment)

Callers

nothing calls this directly

Calls 5

getRangeOfAttachmentMethod · 0.95
locationFromPositionMethod · 0.95
getTextAtIndexMethod · 0.95
editObjectAtIndexMethod · 0.80
copyWithTextMethod · 0.45

Tested by

no test coverage detected