jsMind

view.custom_node_render Option

Option Name Data Type Default Value Description
view.custom_node_render function null Custom node rendering method (Since 0.7.6)

Option Description

The custom_node_render option allows users to customize the rendering method of nodes in the mind map. By setting this option, users can fully control the drawing logic of the nodes, achieving more flexible and personalized visual effects. The data type for this option is function, and the function should follow this signature:

function custom_node_render(jm, element, node): boolean

The return value indicates whether the node has been rendered:

Usage Example

Below is an example of a custom node rendering method:

var options = {
    container: 'jsmind_container',
    editable: true,
    theme: 'primary',
    mode: 'full',
    support_html: true,
    view: {
        engine: 'canvas',
        custom_node_render: function(jm, element, node) {
            let emoji = pickRandomEmoji();
            element.innerHTML = `<img src="${emoji}">${node.topic}`;
            return true; // Indicate that this node has been rendered
        }
    }
};

Notes

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.