MCPcopy Index your code
hub / github.com/hizzgdev/jsmind / move_node

Method move_node

src/jsmind.js:756–774  ·  view source on GitHub ↗

* Move a node and optionally change direction. * @param {string} node_id * @param {string=} before_id - The ID of the node before which to place the moved node. Special values: "_first_", "_last_" * @param {string=} parent_id * @param {('left'|'center'|'right'|'-1'|'0'|'1'|number

(node_id, before_id, parent_id, direction)

Source from the content-addressed store, hash-verified

754 * @param {('left'|'center'|'right'|'-1'|'0'|'1'|number)=} direction - Direction for node placement. Supports string values ('left', 'center', 'right'), numeric strings ('-1', '0', '1'), and numbers (-1, 0, 1). Only effective for second-level nodes (children of root). If not provided, direction will be determined automatically.
755 */
756 move_node(node_id, before_id, parent_id, direction) {
757 if (this.get_editable()) {
758 var node = this.get_node(node_id);
759 var updated_node = this.mind.move_node(node, before_id, parent_id, direction);
760 if (!!updated_node) {
761 this.view.update_node(updated_node);
762 this.layout.layout();
763 this.view.show(false);
764 this.invoke_event_handle(EventType.edit, {
765 evt: 'move_node',
766 data: [node_id, before_id, parent_id, direction],
767 node: node_id,
768 });
769 }
770 } else {
771 logger.error('fail, this mind map is not editable');
772 return;
773 }
774 }
775 /**
776 * @param {string | import('./jsmind.node.js').Node} node
777 * @returns {void}

Callers 10

testDirectionTypesFunction · 0.95
move_to_firstFunction · 0.45
move_to_lastFunction · 0.45
move_nodeFunction · 0.45
jsmind.jsFile · 0.45
jsmind.test.jsFile · 0.45

Calls 6

get_editableMethod · 0.95
get_nodeMethod · 0.95
invoke_event_handleMethod · 0.95
layoutMethod · 0.80
update_nodeMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected