MCPcopy Create free account
hub / github.com/Easy-Editor/EasyEditor / insertBefore

Method insertBefore

packages/core/src/document/node/node.ts:526–529  ·  view source on GitHub ↗

* insert a node before a reference node(in current node's children)

(node: Node, ref?: Node, useMutator = true)

Source from the content-addressed store, hash-verified

524 * insert a node before a reference node(in current node's children)
525 */
526 insertBefore(node: Node, ref?: Node, useMutator = true) {
527 const nodeInstance = ensureNode(node, this.document)
528 this.children?.internalInsert(nodeInstance, ref ? ref.index : null, useMutator)
529 }
530
531 /**
532 * insert a node after a reference node(in current node's children)

Callers 2

replaceChildMethod · 0.95
executeOperationFunction · 0.80

Calls 2

ensureNodeFunction · 0.85
internalInsertMethod · 0.80

Tested by

no test coverage detected