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

Method insertToDOM

src/components/blocks.ts:348–356  ·  view source on GitHub ↗

* Insert new Block into DOM * * @param {Block} block - Block to insert * @param {InsertPosition} position — insert position (if set, will use insertAdjacentElement) * @param {Block} target — Block related to position

(block: Block, position?: InsertPosition, target?: Block)

Source from the content-addressed store, hash-verified

346 * @param {Block} target — Block related to position
347 */
348 private insertToDOM(block: Block, position?: InsertPosition, target?: Block): void {
349 if (position) {
350 target.holder.insertAdjacentElement(position, block.holder);
351 } else {
352 this.workingArea.appendChild(block.holder);
353 }
354
355 block.call(BlockToolAPI.RENDERED);
356 }
357
358 /**
359 * Composes Block event with passed type and details

Callers 3

pushMethod · 0.95
moveMethod · 0.95
insertMethod · 0.95

Calls 1

callMethod · 0.65

Tested by

no test coverage detected