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

Method replaceBlock

src/trix/models/document.js:64–70  ·  view source on GitHub ↗
(oldBlock, newBlock)

Source from the content-addressed store, hash-verified

62 }
63
64 replaceBlock(oldBlock, newBlock) {
65 const index = this.blockList.indexOf(oldBlock)
66 if (index === -1) {
67 return this
68 }
69 return new this.constructor(this.blockList.replaceObjectAtIndex(newBlock, index))
70 }
71
72 insertDocumentAtRange(document, range) {
73 const { blockList } = document

Callers 4

decreaseNestingLevelMethod · 0.80
increaseNestingLevelMethod · 0.80
trix.jsFile · 0.80

Calls 2

indexOfMethod · 0.80
replaceObjectAtIndexMethod · 0.80

Tested by

no test coverage detected