MCPcopy Index your code
hub / github.com/SplootCode/splootcode / wrapNode

Method wrapNode

packages/editor/src/context/selection.ts:539–551  ·  view source on GitHub ↗
(childSet: ChildSet, index: number, node: SplootNode, childSetId: string)

Source from the content-addressed store, hash-verified

537
538 @action
539 wrapNode(childSet: ChildSet, index: number, node: SplootNode, childSetId: string) {
540 // Remove original child at index (sends mutations)
541 const child = childSet.removeChild(index)
542 const wrapChildSet = node.getChildSet(childSetId)
543 // Clear all children from that childset (this is a detached node so it won't send mutations)
544 while (wrapChildSet.getCount() !== 0) {
545 wrapChildSet.removeChild(0)
546 }
547 wrapChildSet.addChild(child)
548
549 // Insert the completed node
550 childSet.insertNode(node, index)
551 }
552
553 @action
554 exitEdit() {

Callers 2

onSelectedMethod · 0.80

Calls 5

removeChildMethod · 0.80
getCountMethod · 0.80
addChildMethod · 0.80
getChildSetMethod · 0.45
insertNodeMethod · 0.45

Tested by

no test coverage detected