in src/plugin/fieldViews/RepeaterFieldView.ts [204:227]
public moveChildDownOne(index: number) {
if (index < 0 || index > this.node.childCount - 2) {
console.error(
`Cannot move index ${index} down: index out of range. Minimum 0, Maximum ${
this.node.childCount - 2
}`
);
return;
}
const tr = this.outerView.state.tr;
const nodeToMove = this.node.child(index);
const startOfNodeToMove = this.getStartOfChildNode(
this.node,
index,
this.getPos(),
this.offset
);
const endOfNodeToMove = startOfNodeToMove + nodeToMove.nodeSize;
const nextNode = this.node.child(index + 1);
tr.insert(endOfNodeToMove + nextNode.nodeSize, nodeToMove);
tr.deleteRange(startOfNodeToMove, endOfNodeToMove);
this.outerView.dispatch(tr);
}