[Contents](index.md) 1. [Usage](1.usage.md) 2. [Options](2.options.md) 3. **Operation** 4. [Contribution](4.contribution.md) jsMind object === jsMind provides a set of APIs for manipulating the mindmap, all of which are based on the `jsMind` object processing, which can be obtained using the following code. ```javascript /* Method 1. jsMind objects are available when you create a mindmap */ var jm = new jsMind(options); /* Method 2. This jsMind object can be obtained directly if a mindmap already exists on the current page When multiple jsMind are created on a page, this method gets the last object created */ var jm = jsMind.current; ``` 3.1 Displaying a mindmap === Use the `jm.show(mind)` method to display a mindmap, see [1.1. Basic framework](1.usage.md) for specific usage. 3.2. Finding Nodes === **Get root** : Use `jm.get_root()` to get the root of the current mindmap. **Find node by id** : Use the `jm.get_node(nodeid)` method to find the node specified in the current mind map by id, and return `null` if it is not found. **Get selected node** : Use `jm.get_selected_node()` to get the currently selected node and return `null` if there is no selected node. **Find adjacent nodes** : Use `jm.find_node_before(node|nodeid)` and `find_node_after(node|nodeid)` to get the previous or next node of the specified node, and return `null` if there is no previous or next one. **Fetch parent** : Use `node.parent` to get the parent node, the parent of the root node is `null`. **Fetching a collection of child nodes** : A collection of child nodes can be obtained using `node.children`. Tips --- A mindmap diagram is composed of multiple nodes and connections between nodes, a mindmap diagram has a root node, the root node can have multiple child nodes on the periphery, and the child node can have multiple child nodes. Each node contains more than one of the following attributes. ```javascript node { id, // : string node id index, // : integer node number topic, // : string node topic isroot, // : boolean indicates whether this node is root or not parent, // : node The parent of this node, the parent program of the root node is null, but please do not judge whether this node is the root node based on this property. direction, // : enum(left,center,right) The distribution position of the node children, // : array of node The combination of children of the node expanded, // : boolean Is the next level of the node expanded or not data, // : object{string,object} Other additional data for this node } ``` 3.3 Operation on Nodes === **Select node** : Use the `jm.select_node(node) method to select the specified node. **Collapse child nodes** : Use the `jm.collapse_node(node|nodeid)` method to collapse the child nodes of the node. **Expand Child Node** : Use the `jm.expand_node(node|nodeid)` method to expand the child node of this node. **Collapse or expand child nodes** : Use the `jm.toggle_node(node|nodeid)` method to automatically expand or collapse child nodes. **Expand all child nodes** : All child nodes can be expanded using the `jm.expand_all()` method. **Expand to level** : Use the `jm.expand_to_depth(depth)` method to expand to a specified level. **Move Node** : Use the `jm.move_node(node|nodeid,beforeid)` method to move the node to beforeid node, and set beforeid to `_first_` or `_last` to move the node to first or last of the adjacent node. **Enable editing** : Use the `jm.enable_edit()` method to enable editing of the current mindmap. **Disable_edit** : Use the `jm.disable_edit()` method to disable editing of the current mindmap. **Edit Node** : The node can be adjusted to edit using the `jm.begin_edit(node|nodeid)` method. **Stop editing** : The node can be adjusted to read-only using the `jm.end_edit()` method. 3.4. Editing Nodes === **Add Node** : A node can be added using the `jm.add_node(parent_node, nodeid, topic, data)` method. **Insert node before specified location** : The `jm.insert_node_before(node_before, nodeid, topic, data)` method can be used to insert a node before a node_before node. **Insert node after specified location** : Node can be inserted after node_after using `jm.insert_node_after(node_after, nodeid, topic, data)` method. **Delete Node** : Use the `jm.remove_node(node|nodeid)` method to delete a specified node and all its children. **Update node** : Use the `jm.update_node(nodeid, topic)` method to update the topic of the specified node. 3.5 Setting Style === **Set the theme** : Use the `jm.set_theme(theme)` method to set the theme of the mind map. **Set background / foreground color** : Use the `jm.set_node_color(nodeid, bgcolor, fgcolor)` method to set the background and foreground color of the specified node. **Set Font** : Use the `jm.set_node_font_style(nodeid, size, weight, style)` method to set the font of the specified node. **Set background image** : Use the `jm.set_node_background_image(nodeid, image, width, height)` method to set the background image of the specified node. 3.6 Access to Data === **Get metadata** : Use the `jm.get_meta()` method to get metadata for the current mindmap. **Get Data** : The `jm.get_data(data_format)` method is used to get the data text in the specified format of the current mindmap. 3.7 Other Operations === **Clear selection of nodes** : Use the `jm.select_clear()` method to clear the current selected state. **Determine if the node is visible** : Use the `jm.is_node_visible(node)` method to determine if this node is visible. copyright notice === Reproduction and deduction are prohibited. The jsMind project is still being updated and the corresponding documentation is updated at the same time as the version is updated. In order to avoid confusion to the user, it is forbidden to reprint this document without written permission and to make changes of any kind to this document.