MCPcopy
hub / github.com/codex-team/editor.js / replace

Method replace

src/components/modules/blockManager.ts:380–389  ·  view source on GitHub ↗

* Replace passed Block with the new one with specified Tool and data * * @param block - block to replace * @param newTool - new Tool name * @param data - new Tool data

(block: Block, newTool: string, data: BlockToolData)

Source from the content-addressed store, hash-verified

378 * @param data - new Tool data
379 */
380 public replace(block: Block, newTool: string, data: BlockToolData): Block {
381 const blockIndex = this.getBlockIndex(block);
382
383 return this.insert({
384 tool: newTool,
385 data,
386 index: blockIndex,
387 replace: true,
388 });
389 }
390
391 /**
392 * Insert pasted content. Call onPaste callback after insert.

Callers 2

convertMethod · 0.95
updateMethod · 0.45

Calls 2

getBlockIndexMethod · 0.95
insertMethod · 0.95

Tested by

no test coverage detected