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

Method add_node

src/jsmind.js:461–483  ·  view source on GitHub ↗

* Add a new node to the mind map. * @param {string | import('./jsmind.node.js').Node} parent_node * @param {string} node_id * @param {string} topic * @param {Record =} data * @param {('left'|'center'|'right'|'-1'|'0'|'1'|number)=} direction - Direction for node p

(parent_node, node_id, topic, data, direction)

Source from the content-addressed store, hash-verified

459 * @returns {import('./jsmind.node.js').Node|null}
460 */
461 add_node(parent_node, node_id, topic, data, direction) {
462 if (!this.get_editable()) {
463 logger.error('fail, this mind map is not editable');
464 return null;
465 }
466
467 var the_parent_node = this.get_node(parent_node);
468 if (!the_parent_node) {
469 logger.error('parent node not found');
470 return null;
471 }
472
473 var node = this._add_node_data(the_parent_node, node_id, topic, data, direction);
474 if (!!node) {
475 this._refresh_node_ui(the_parent_node);
476 this.invoke_event_handle(EventType.edit, {
477 evt: 'add_node',
478 data: [the_parent_node.id, node_id, topic, data, Direction.of(direction)],
479 node: node_id,
480 });
481 }
482 return node;
483 }
484
485 /**
486 * Add multiple nodes to the mind map with optimized performance.

Callers 15

testDirectionTypesFunction · 0.95
add_nodeFunction · 0.45
2_features.jsFile · 0.45
jsmind.jsFile · 0.45
_add_node_dataMethod · 0.45
insert_node_beforeMethod · 0.45
insert_node_afterMethod · 0.45
handle_addchildMethod · 0.45
jsmind.format.jsFile · 0.45
typescript-test.tsFile · 0.45

Calls 5

get_editableMethod · 0.95
get_nodeMethod · 0.95
_add_node_dataMethod · 0.95
_refresh_node_uiMethod · 0.95
invoke_event_handleMethod · 0.95

Tested by 1

create_fake_mindFunction · 0.36