Skip to content

Constructor

Basic use

html
<div id="mindMapContainer"></div>
js
import MindMap from "simple-mind-map";

const mindMap = new MindMap({
  el: document.getElementById("mindMapContainer"),
  data: {
    "data": {
        "text": "Root Node"
    },
    "children": []
  }
});

Special Reminder

Node tree rendering is an asynchronous operation, so it is not possible to immediately call some operations that require node rendering to be completed after instantiation, otherwise errors and unknown phenomena may occur, You need to listen for the 'node_tree_render_end' event and wait until the node tree rendering is complete before proceeding. In addition to instantiation, other methods such as 'setData', 'updateData', 'render', etc. are asynchronous and need to be handled in this way.

Instantiation options

1.Base

Field NameDescriptionTypeDefault Value
elContainer element, must be a DOM element(When the position of container elements on the page has changed but the size has not changed, the 'getElRectInfo()' method must be called to update the relevant information inside the library; When the size also changes, the 'resize()' method must be called, otherwise it will cause some functional exceptions)Element
dataMind map data, Please refer to the introduction of 【Data structure】 below. V0.9.9+supports passing empty objects or null, and the canvas will display blank spaceObject 、null
layoutLayout type, options: logicalStructure (logical structure diagram), logicalStructureLeft(v0.10.2+, Leftward logical structure diagram), mindMap (mind map), catalogOrganization (catalog organization diagram), organizationStructure (organization structure diagram)、timeline(v0.5.4+, timeline)、timeline2(v0.5.4+, up down alternating timeline)、fishbone(v0.5.4+, fishbone diagram)StringlogicalStructure
fishboneDeg(v0.5.4+)Set the diagonal angle of the fishbone structure diagramNumber45
themeTheme, options: default, classic, minions, pinkGrape, mint, gold, vitalityOrange, greenLeaf, dark2, skyGreen, classic2, classic3, classic4(v0.2.0+), classicGreen, classicBlue, blueSky, brainImpairedPink, dark, earthYellow, freshGreen, freshRed, romanticPurple, simpleBlack(v0.5.4+), courseGreen(v0.5.4+), coffee(v0.5.4+), redSpirit(v0.5.4+), blackHumour(v0.5.4+), lateNightOffice(v0.5.4+), blackGold(v0.5.4+)、、avocado(v.5.10-fix.2+)、autumn(v.5.10-fix.2+)、orangeJuice(v.5.10-fix.2+)Stringdefault
themeConfigTheme configuration, will be merged with the selected theme, available fields refer to: default.jsObject{}
scaleRatioThe incremental scaling ratioNumber0.1
maxTagThe maximum number of tags displayed in the node, any additional tags will be discardedNumber5
tagPosition(v0.10.3+)The position of the tag display relative to the node text,bottom(Below the text)、right(On the right side of the text)Stringright
imgTextMarginThe spacing between the image and text in the nodeNumber5
textContentMarginThe spacing between various text information in the node, such as the spacing between the icon and textNumber2
customNoteContentShow(v0.1.6+)Custom node note content display, object type, structure: {show: (noteContent, left, top, node) => {// your display node note logic. node is a new parameter added in v0.8.1+ version, representing node instances }, hide: () => {// your hide node note logic }}Objectnull
readonly(v0.1.7+)Whether it is read-only modeBooleanfalse
textAutoWrapWidth(v0.3.4+)Each line of text in the node will wrap automatically when it reaches the widthNumber500
customHandleMousewheel(v0.4.3+)User-defined mouse wheel event processing can pass a function, and the callback parameter is the event objectFunctionnull
mousewheelAction(v0.4.3+)The behavior of the mouse wheel, zoom(Zoom in and out)、move(Move up and down). If customHandleMousewheel passes a custom function, this property will not take effectStringzoom(v0.9.1+ default is move)
mousewheelMoveStep(v0.4.3+)When the mousewheelAction is set to move, you can use this attribute to control the step length of the view movement when the mouse scrolls. The unit is pxNumber100
mousewheelZoomActionReverse(v0.6.5+)When mousewheelAction is set to zoom, Or when holding down the Ctrl key, the default scrolling forward is to zoom out, and scrolling backward is to zoom in. If this property is set to true, it will be reversedBooleanfalse(v0.9.1+ default is true)
defaultInsertSecondLevelNodeText(v0.4.7+)Text of the default inserted secondary nodeString二级节点
defaultInsertBelowSecondLevelNodeText(v0.4.7+)Text for nodes below the second level inserted by defaultString分支主题
expandBtnStyle(v0.5.0+)Expand the color of the stow button, (The fontSize and strokeColor fields were added in version 0.7.0+to set the text style for displaying the number of nodes when folded)Object{ color: '#808080', fill: '#fff', fontSize: 13, strokeColor: '#333333' }
expandBtnIcon(v0.5.0+)Customize the icon of the expand/collapse button, and you can transfer the svg string of the icon (When the node is collapsed, render the open icon, and when it is expanded, render the close icon)Object{ open: '', close: '' }
expandBtnNumHandler(v0.7.0+)Used to customize the display of the number of nodes when collapsed, a function can be passed. Versions before v0.11.1 receive a parameter representing the total number of all descendant nodes of the collapsed node, while versions v0.11.1+receive two parameters. The first parameter still has the total number of descendant nodes, and the second parameter is the instance of the node. Need return a number or string that represents the final displayed content. For example, when the number is greater than 99, 99 can be displayed+Function
isShowExpandNum(v0.7.0+)Display the number of folded nodes when they are folded upBooleantrue
enableShortcutOnlyWhenMouseInSvg(v0.5.1+)Only respond to shortcut key events when the mouse is inside the canvasBooleantrue
enableNodeTransitionMove(v0.5.1+)(v0.6.7+ is remove this feature)Whether to enable node animation transitionBooleantrue
nodeTransitionMoveDuration(v0.5.1+)(v0.6.7+ is remove this feature)If node animation transition is enabled, the transition time can be set using this attribute, in millisecondsNumber300
initRootNodePosition(v0.5.3+)The position of the initial root node can be passed as an array, default is ['center', 'center'], Represents the root node at the center of the canvas, In addition to center, keywords can also be set to left, top, right, and bottom, In addition to passing keywords, each item in the array can also pass a number representing a specific pixel, Can pass a percentage string, such as ['40%', '60%'], Represents a horizontal position at 40% of the canvas width, and a vertical position at 60% of the canvas heightArraynull
nodeTextEditZIndex(v0.5.5+)z-index of node text edit box elementsNumber3000
nodeNoteTooltipZIndex(v0.5.5+)z-index of floating layer elements in node commentsNumber3000
isEndNodeTextEditOnClickOuter(v0.5.5+)Whether to end the editing status of node text when clicking on an area outside the canvasBooleantrue
maxHistoryCount(v0.5.6+)Maximum number of history recordsNumber1000(v0.9.2+ changed 500)
alwaysShowExpandBtn(v0.5.8+)Whether to always display the expand and collapse buttons of nodes, which are only displayed when the mouse is moved up and activated by defaultBooleanfalse
iconList(v0.5.8+)The icons that can be inserted into the extension node, and each item in the array is an object. Please refer to the "Icon Configuration" table below for the detailed structure of the objectArray[]
maxNodeCacheCount(v0.5.10+)The maximum number of cached nodes. To optimize performance, an internal node cache pool is maintained to reuse nodes. This attribute allows you to specify the maximum number of caches in the poolNumber1000
fitPadding(v0.6.0+)The padding of mind mapping when adapting to canvas size, Unit: pxNumber50
enableCtrlKeyNodeSelection(v0.6.0+)Whether to enable the function of holding down the Ctrl key to select multiple nodesBooleantrue
useLeftKeySelectionRightKeyDrag(v0.6.0+)Setting to left click to select multiple nodes and right click to drag the canvas.Booleanfalse
beforeTextEdit(v0.6.0+)The callback method before the node is about to enter editing. If the method returns a value other than true, the editing will be canceled. The function can return a value or a promise, and the callback parameter is the node instanceFunction/nullnull
isUseCustomNodeContent(v0.6.3+)Whether to customize node contentBooleanfalse
customCreateNodeContent(v0.6.3+)If isUseCustomNodeContent is set to true, then this option needs to be used to pass in a method that receives the node instance node as a parameter (if you want to obtain data for that node, you can use node.nodeData.data). You need to return the custom node content element, which is the DOM node. If a node does not require customization, you can return nullFunction/nullnull
mouseScaleCenterUseMousePosition(v0.6.4-fix.1+)Is the mouse zoom centered around the current position of the mouse, otherwise centered around the canvasBooleantrue
customInnerElsAppendTo(v0.6.12+)Specify the location where some internal elements (node text editing element, node note display element, associated line text editing element, node image adjustment button element) are added, and default to document.bodynull/HTMLElementnull
enableCreateHiddenInput(v0.6.13+)(v0.6.14+ remove this feature)Is it allowed to create a hidden input box that will be focused when the node is activated for pasting data and automatically entering the text editing stateBooleantrue
enableAutoEnterTextEditWhenKeydown(v0.6.13+)Does it automatically enter text editing mode when pressing the Chinese, English, or numeric buttons when there is an activation node?Booleantrue
customHandleClipboardText(v0.6.14+)Customize the processing of clipboard text. When pressing ctrl+v to paste, it will read the text and images from the user's clipboard. By default, it will only determine whether the text is regular text and node data in simple mind map format. If you want to process data from other mind maps, such as process, zhixi, etc., you can pass a function that takes the text from the current clipboard as a parameter and returns the processed data, which can be of two types: 1.If a pure text is returned, a child node will be directly created with that text; 2.Returns a node object in the following format: { simpleMindMap: true, data: { data: { text: '' }, children: [] } }, The representative is data in simple bind map format, and the node data is in the same format as the simple bind map node data. If your processing logic has asynchronous logic, you can also return a promiseFunctionnull
errorHandler(v0.6.15+)Custom error handling functions currently only throw some asynchronous logic errors. Can pass a function that takes two parameters, the first being the wrong type and the second being the wrong objectFunction
disableMouseWheelZoom(v0.6.15+)Prohibit mouse wheel scaling, you can still use the API for scalingBooleanfalse
enableDblclickReset(v0.6.17+)(v0.8.0+this attribute has been deleted)Turn on the mouse and double-click to reset the position and zoom of the mind mapBooleantrue(v0.7.0+changed to false)
enableDblclickBackToRootNode(v0.8.0+)Whether to return to the root node when double clicking with the mouse, that is, to center the display of the root nodeBooleanfalse
hoverRectColor(v0.7.0+)The node mouse hover and the rectangular border color displayed when activated will add a transparency of 0.6 when hoveringStringrgb(94, 200, 248)
hoverRectPadding(v0.7.0+)The distance between the node mouse hover and the displayed rectangular border when activated and the node contentNumber2
selectTextOnEnterEditText(v0.7.0+)Is the text selected by default when double-clicking a node to enter node text editing? By default, it will only be selected when creating a new nodeBooleantrue
deleteNodeActive(v0.7.1+)Enable the function of automatically activating adjacent nodes or parent nodes after deleting nodesBooleantrue
fit(v0.7.1-fix.2+)Is the first rendering scaled to fit the canvas sizeBooleanfalse
tagsColorMap(v0.7.2+)The color of a custom node label can be transferred to an object, where key is the label content to be assigned a color, and value is the color of the label content. If not transferred internally, a corresponding color will be generated based on the label contentObject{}
cooperateStyle(v0.7.3+)The configuration of personnel avatar style during node collaboration editing, with field meanings as follows: avatar size, and if it is a text avatar, the size of the textObject{ avatarSize: 22, fontSize: 12 }
onlyOneEnableActiveNodeOnCooperate(v0.9.8+)During collaborative editing, the same node cannot be selected by multiple people at the same timeBooleanfalse
defaultGeneralizationText(v0.8.0+)Insert default text for summaryString概要
handleIsSplitByWrapOnPasteCreateNewNode(v0.8.0+)When creating a new node by pasting text, control whether to automatically split the nodes based on line breaks. If there is a line break, multiple nodes will be created based on the line break. Otherwise, only one node will be created, and a function can be passed to return promise. resolve represents splitting based on line breaks, and reject represents ignoring line breaksFunction / nullnull
addHistoryTime(v0.8.0+)Only one historical record can be added within the specified time to avoid adding unnecessary intermediate states. Unit: msNumber100
isDisableDrag(v0.8.1+)Is disable dragging the canvasBooleanfalse
highlightNodeBoxStyle(v0.9.0+)(v0.11.1+ has been removed)Highlight box style when the mouse moves into the summary to highlight the node it belongs toObject{ stroke: 'rgb(94, 200, 248)', fill: 'transparent' }
createNewNodeBehavior(v0.9.1+)Behavior when creating a new node. default(By default, newly created nodes will be activated and enter editing mode. If multiple new nodes are created simultaneously, they will only be activated and will not enter editing mode)、notActive(Do not activate newly created nodes)、activeOnly(Only activate newly created nodes and do not enter editing mode)Stringdefault
defaultNodeImage(v0.9.1-fix.2+)Image address, the default image displayed when node image loading failsString
handleNodePasteImg(v0.9.2+)The processing method for pasting images from the clipboard on a node is to convert them into data:URL data and insert them into the node by default. You can use this method to upload image data to the server and save the URL of the image. An asynchronous method can be passed to receive image data of Blob type, and the specified structure needs to be returned: { url, size: {width, height} }null or Functionnull
isLimitMindMapInCanvas(v0.9.2+)Whether to limit the mind map within the canvas. For example, when dragging to the right, the leftmost part of the mind map graphic will not be able to continue dragging to the right when it reaches the center of the canvas, and the same applies to other thingsBooleanfalse
beforeShortcutRun(v0.9.9+)The lifecycle function before the shortcut operation is about to be executed, returning true can prevent the operation from executing. The function takes two parameters: key(Shortcut key)、activeNodeList(List of currently activated nodes)Function、nullnull
resetScaleOnMoveNodeToCenter(v0.9.12+)Whether to reset the scaling level to 100% when moving nodes to the canvas center, returning to the root node, and other operations(This option actually affects the render. moveNodeToCenter method, and the moveNodeToCenter method itself also has a second parameter, resetScale, to set whether to reset. If the resetScale parameter is not passed, then use resetScaleOnMoveNodeToCenter configuration; otherwise, use resetScale configuration)Booleanfalse
createNodePrefixContent(v0.9.12+)Add additional node pre content.Pre content refers to the pre content in the area of the same line as the text, excluding the node image section.You can pass a function that takes the parameters of a node instance, Can return objects in {el, width, height} format, el is a DOM node object, width and height represent the width, height, and numerical type of the content. If custom content is not required, null can also be returnedFunction、nullnull
createNodePostfixContent(v0.9.12+)Add additional node post content.Post content refers to the post content in the area of the same line as the text, excluding the node image section. The usage is the same as createNodePrefixContentFunction、nullnull
disabledClipboard(v0.10.2+)Is prohibit pasting data from the user's clipboard and writing copied node data to the user's clipboard. At this time, only node data from the canvas can be copied and pastedBooleanfalse
customHyperlinkJump(v0.10.2+)Customize the jump of hyperlinks. If not passed, the hyperlink will be opened as a new window by default, and a function can be passed, The function takes two parameters: link(The URL of the hyperlink)、node(Node instance to which it belongs), As long as a function is passed, it will block the default jumpnull、Functionfalse
openPerformance(v0.10.4+)Whether to enable performance mode or not, by default, all nodes will be rendered directly, regardless of whether they are in the visible area of the canvas. This will cause a lag when there are a large number of nodes (1000+). If your data volume is large, you can enable performance mode through this configuration, that is, only rendering nodes within the visible area of the canvas, and not rendering nodes beyond it. This will greatly improve rendering speed, but of course, it will also bring some other problems, such as: 1. When dragging or scaling the canvas, real-time calculation and rendering of nodes without nodes will be performed, which will bring some lag; When exporting images, SVG, and PDF, all nodes need to be rendered first, so it may be slower; 3. Other currently undiscovered issuesBooleanfalse
performanceConfig(v0.10.4+)Performance optimization mode configuration. time(How often do nodes refresh after a view change. Unit:ms)、padding(Still rendering nodes beyond the specified range around the canvas)、removeNodeWhenOutCanvas(Is the node deleted from the canvas after being moved out of the visible area of the canvas)Object{ time: 250, padding: 100, removeNodeWhenOutCanvas: true }
notShowExpandBtn(v0.10.6+)Is not display the expand/collapse button, higher priority than the 'alwaysShowExpandBtn' configurationBooleanfalse
emptyTextMeasureHeightText(v0.11.1+)If the node text is empty, in order to avoid the collapse of the height of the blank node, a height will be measured using the text specified in this fieldStringabc123我和你
openRealtimeRenderOnNodeTextEdit(v0.11.1+)Is the node size and position updated in real-time during node text editing? Enabling it may cause lag when there are a large number of nodesBooleanfalse

1.1 Data structure

The basic data structure is as follows:

js
{
  data: {
    text: '', // The text of the node can be rich text, which is in HTML format. In this case, richText should be set to true
    richText: false, // Is the text of the node in rich text mode
    expand: true, // Whether the node is expanded
    uid: '',// The unique ID of the node, which may not be passed, will be generated internally
    icon: [], // The format of the icon can be found in the "插入和扩展节点图标" section of the tutorial
    image: '', // URL of the image
    imageTitle: '', // The title of the image can be blank
    imageSize: { // The size of the image
      width: 100, // The width of the image, mandatory
      height: 100, // The height of the image is mandatory
      custom: false // If set to true, the display size of the image is not controlled by the theme, and is based on imageSize.width and imageSize.height
    },
    hyperlink: '', // Hyperlink address
    hyperlinkTitle: '', // Title of hyperlink
    note: '', // Content of remarks
    tag: [], // Tag list, Prior to v0.10.3, only string arrays, i.e. ['tag'], were supported. However, v0.10.3+versions support object arrays, i.e. [{text: 'tag', style: {}}]. The specific supported label styles can refer to the "Tag Styles" below
    generalization: [{// (Arrays are not supported in versions below 0.9.0, and only a single summary data can be set)The summary of the node, if there is no summary, the generalization can be set to null
      text: '', // Summary Text
      richText: false, // Is the text of the node in rich text mode
      // ...The fields of other ordinary nodes are supported, But it does not support children
    }],
    associativeLineTargets: [''],// If there are associated lines, then it is the uid list of the target node
    associativeLineText: '',// Association Line Text
    // ...For other style fields, please refer to the topic
  },
  children [// Child nodes, with consistent structure and root nodes
    {
      data: {},
      children: []
    }
  ]
}

If you want to add custom fields, you can add them to the same level as 'data' and 'children'. If you want to add them to the 'data' object, please use the _ Name your custom field at the beginning, and it will be used internally to determine whether it is a custom field.

Tag Styles

The style object of the tag supports the following properties:

Field NameTypeDefault ValueDescription
radiusNumber3The corner size of the tag rectangle
fontSizeNumber12Font size, it is recommended that the height of the text should not exceed height
fillStringBackground color of tag rectangle
heightNumber20Height of tag rectangle
paddingXNumber8Horizontal margin, if width is set, this configuration will be ignored
widthNumberThe width of the tag rectangle, if not set, defaults to the width of the text plus paddingX * 2

1.2 Icon Configuration

Field NameTypeDefault ValueDescription
nameStringThe name of the icon group
typeStringValues for icon grouping
listArrayA list of icons under grouping, with each item in the array being an object, { name: '', icon: '' }namerepresents the name of the icon, iconrepresents the icon, Can be an svg icon, such as <svg ...><path></path></svg>, also can be a image url, or base64 icon, such as data:image/png;base64,...

2.Export plugin

Field NameTypeDefault ValueDescription
exportPaddingNumber20The padding for exporting images
exportPaddingX(v0.5.5+)Number10Horizontal padding of graphics when exporting PNG, SVG, and PDF
exportPaddingY(v0.5.5+)Number10Vertical padding of graphics when exporting PNG, SVG, and PDF
resetCss(v0.6.16+)String* { margin: 0; padding: 0; box-sizing: border-box; }When exporting images and SVGs, the default style overlay for rich text node content, which is embedded in HTML nodes in SVGs, will occur. If not overlaid, the node content will be offset
minExportImgCanvasScale(v0.7.0+)Number2The scaling factor of canvas when exporting images and PDFs, which is set to the maximum value of window.devicePixelRatio to improve image clarity
addContentToHeader(v0.9.9+)Function、nullnullAdd custom content to the header when exporting PNG, SVG, and PDF. Can pass a function that can return null to indicate no content is added, or it can return an object, For a detailed introduction, please refer to section 【How to add custom content when exporting】 below
addContentToFooter(v0.9.9+)Function、nullnullThe basic definition is the same as addContentToHeader, adding custom content at the end
handleBeingExportSvg(v0.10.1+)Function、nullnullWhen exporting PNG, SVG, and PDF, the SVG data on the canvas will be obtained for cloning, and then exported through the cloned elements. If you want to do some processing on the cloned elements, such as adding, replacing, or modifying some of them, you can pass a processing function through this parameter to receive the SVG element object. After processing, you need to return the original SVG element object.(It should be noted that the node object refers to the element object of the @ svgdotjs/svg. js library, so you need to read the documentation of the library to operate this object)

2.1 How to add custom content when exporting

The two instantiation options addContentToHeader and addContentToFooter can be used to add custom content at the beginning and end when exporting pngsvgpdf, The default value is null, which means no configuration. A function can be passed and can return null, which means no content will be added. If you want to add content, you need to return the following structure:

{
  el,// Custom DOM node to be added, styles can be inline
  cssText,// Optional, if the style does not want to be inlined, you can pass this value as a CSS string
  height: 50// The height of the returned DOM node must be passed
}

A simple example:

js
new MindMap({
  addContentToFooter: () => {
    const el = document.createElement('div')
    el.className = 'footer'
    el.innerHTML = 'From: simple-mind-map'
    const cssText = `
      .footer {
        width: 100%;
        height: 30px;
      }
    `
    return {
      el,
      cssText,
      height: 30
    }
  }
})

3.Select plugin

Field NameTypeDefault ValueDescription
selectTranslateStepNumber3The canvas offset when mouse moves to the edge during multi-select node
selectTranslateLimitNumber20The distance from the edge when the canvas begins to offset during multi-select node

4.Drag plugin

Field NameDescriptionTypeDefault Value
enableFreeDrag(v0.2.4+)Enable node free(Free drag means that nodes can be dragged to any position on the canvas. Please note that it is not a function of dragging nodes to become siblings of other nodes. The connection of free drag may have certain problems, so it is best not to use this feature) dragBooleanfalse
nodeDragPlaceholderMaxSize(v0.6.12+)(v0.10.0+ has been abolished)When dragging an element, the maximum height of the block indicating the new position of the elementNumber20
autoMoveWhenMouseInEdgeOnDrag(v0.7.1+)Whether to enable automatic canvas movement when the mouse moves to the edge of the canvas while dragging nodesBooleantrue
dragMultiNodeRectConfig(v0.7.2+)The style configuration of the schematic rectangle that moves with the mouse when dragging multiple nodes, passing an object, and the field meanings are the width, height, and fill color of the rectangleObject{ width: 40, height: 20, fill: 'rgb(94, 200, 248)' }
dragPlaceholderRectFill(v0.7.2+)The filling color of the schematic rectangle for the new position when dragging nodes.Stringrgb(94, 200, 248)
dragPlaceholderLineConfig(v0.10.0+)Style configuration of schematic lines for new positions when dragging nodesObject{ color: 'rgb(94, 200, 248)', width: 2 }
dragOpacityConfig(v0.7.2+)The transparency configuration during node dragging, passing an object, and the field meanings are: the transparency of the cloned node or rectangle that follows the mouse movement, and the transparency of the dragged nodeObject{ cloneNodeOpacity: 0.5, beingDragNodeOpacity: 0.3 }
beforeDragEnd(v0.10.1+)This function is called just before the drag is completed. The function receives an object as a parameter: {overlapNodeUid,prevNodeUid,nextNodeUid,beingDragNodeList}, represents drag and drop information. If you want to prevent this drag and drop, you can return true. At this time, the node.drag event will not be triggered again. Functions can be asynchronous and return Promise instances. 'beingDragNodeList' is a newly added callback parameter for v0.10.2+, which is the list of nodes that are currently being draggednull、Functionnull
handleDragCloneNode(v0.10.1+)When dragging a single node, the dragged node will be cloned. If you want to modify the cloned node, you can provide a processing function through this option, which receives the cloned node object.(It should be noted that the node object refers to the element object of the @svgdotjs/svg.js library, so you need to read the documentation of the library to operate this object)null、Functionnull
beforeDragStart(v0.10.2+)This function is called just before the node is dragged. The function receives the list of node instances to be dragged as parameters. If you want to prevent this drag, you can return true. It can be an asynchronous function that returns a Promise instancenull、Function((nodeList) => {})null

5.Watermark plugin

Field NameTypeDefault ValueDescription
watermarkConfig(v0.2.4+)ObjectWatermark config, Please refer to the table 【Watermark config】 below for detailed configuration

5.1Watermark config

Field NameTypeDefault ValueDescription
textString''Watermark text. If it is an empty string, the watermark will not be displayed
lineSpacingNumber100Spacing between watermark lines
textSpacingNumber100Spacing between watermarks in the same row
angleNumber30Tilt angle of watermark, range: [0, 90]
textStyleObject{color: '#999', opacity: 0.5, fontSize: 14}Watermark text style
onlyExport(v0.9.2+)BooleanfalseIs only add watermarks during export
belowNode(v0.10.0+)BooleanfalseIs the watermark displayed below the node

6.AssociativeLine plugin

Field NameTypeDefault ValueDescription
defaultAssociativeLineText(v0.5.11+)String关联Association Line Default Text
associativeLineIsAlwaysAboveNode(v0.8.0+)BooleantrueIs the associated line always displayed above the node? If set to false, it will be at the top level when creating and activating the associated line, and in other cases, it will be below the node
associativeLineInitPointsPosition(v0.9.5+)null / { from, to }{ from: '', to: '' }By default, the position of the two endpoints of a newly created association line is calculated based on the relative position of the center points of the two nodes. If you want to fix the position, you can configure it through this option. If neither from nor to is transmitted, they will be automatically calculated. If only one is transmitted, the other will be automatically calculated. from and to optional values
:left、top、bottom、right
enableAdjustAssociativeLinePoints(v0.9.5+)BooleantrueIs it allowed to adjust the position of the two endpoints of the associated line

7.RichText plugin

Field NameTypeDefault ValueDescription
richTextEditFakeInPlace(v0.6.13+)BooleanfalseSet the rich text node edit box to match the size of the node, creating a pseudo in place editing effect. It should be noted that only when there is only text within the node and the shape is rectangular, can the effect be better
transformRichTextOnEnterEdit(v0.10.0+)null、FunctionnullTo convert rich text content, you can pass a function that will be called when entering rich text editing. The function receives the rich text content that is about to be edited and needs to return the processed rich text content
beforeHideRichTextEdit(v0.10.0+)null、FunctionnullYou can pass a function that will be executed before the end of rich text editing. The function receives a richText instance, so you can update the kill document data at this time

8.TouchEvent plugin

Field NameTypeDefault ValueDescription
disableTouchZoom(v0.8.1+)BooleanfalseProhibit double finger scaling, you can still use the API for scaling, which takes effect on the TouchEvent plugin
minTouchZoomScale(v0.10.1+)Number20Allow maximum and minimum scaling values, percentage, pass -1 to indicate no restrictions
maxTouchZoomScale(v0.10.1+)Number-1Same as minTouchZoomScale

9.Scrollbar plugin

Field NameDescriptionTypeDefault Value
isLimitMindMapInCanvasWhenHasScrollbar(v0.9.2+)When registering the Scrollbar plugin, will the mind map be limited to the canvas and the isLimitMindMapInCanvas configuration no longer workBooleantrue

10.Search plugin

Field NameTypeDefault ValueDescription
isOnlySearchCurrentRenderNodes(v0.9.8+)BooleanfalseIs it necessary to only search for the current rendered node, and nodes that have been collapsed will not be searched for

11.Cooperate plugin

Field NameTypeDefault ValueDescription
beforeCooperateUpdate(v0.9.8+)Function、nullnullDuring collaborative editing, node operations are about to be updated to the lifecycle functions of other clients. The function takes an object as a parameter:{ type: 【createOrUpdate(Create or update nodes)、delete(Delete node)】, list: 【Array type, 1.When type=createOrUpdate, it represents the node data that has been created or updated, which will be synchronized to other clients, so you can modify the data; 2.When type=delete, represents the deleted node data】 }

12.RainbowLines plugin

Field NameTypeDefault ValueDescription
rainbowLinesConfig(v0.9.9+)Object{ open: false, colorsList: [] }Rainbow line configuration requires registering the RainbowLines plugin first. Object type, Structure: { open: false【Is turn on rainbow lines】, colorsList: []【Customize the color list for rainbow lines. If not set, the default color list will be used】 }

13.Demonstrate plugin

Field NameTypeDefault ValueDescription
demonstrateConfig(v0.9.11+)Object、nullnullDemonstration plugin configuration. If not transmitted, the default configuration will be used. An object can be transmitted. If only a certain property is configured, only that property can be set. Other properties that have not been set will also use the default configuration. For complete configuration, please refer to the 【Demonstration Plugin Configuration】 section below

13.1Demonstration Plugin Configuration

Field NameTypeDefault ValueDescription
boxShadowColorStringrgba(0, 0, 0, 0.8)The color of the area around the highlighted box
borderRadiusString5pxThe size of the rounded corners of the highlighted box
transitionStringall 0.3s ease-outTransition properties of highlight box animation and CSS transition properties
zIndexNumber9999The hierarchy of highlighted box elements
paddingNumber20The inner margin of the highlighted box
marginNumber50The outer margin of the highlighted box
openBlankMode(v0.9.12+)BooleantrueIs enable fill in the blank mode, where underlined text is not displayed by default and only displayed sequentially by pressing the enter key

14.Formula plugin

Field NameDescriptionTypeDefault Value
enableEditFormulaInRichTextEdit(v0.10.0+)Is enable direct editing of mathematical formulas in the rich text editing boxBooleantrue
katexFontPath(v0.10.3+)The request path for font files in the Katex library. Font files will only be requested when Katex's output is configured as html. The current configuration can be obtained through the mindMap.formula.getKatexConfig() method. The font file can be found in node_modules: katex/dist/fonts/. You can upload it to your server or CDN. The final font request path is ${katexFontPath}fonts/KaTeX_AMS-Regular.woff2, which can be concatenated by oneself to test whether it can be accessedStringhttps://unpkg.com/katex@0.16.11/dist
getKatexOutputType(v0.10.3+)Customize the output mode of the Katex library. By default, when the Chrome kernel is below 100, html mode will be used. Otherwise, mathml mode will be used. If you have your own rules, you can pass a function that returns either mathml or htmlFunction、nullnull

15.OuterFrame plugin

Field NameTypeDefault ValueDescription
outerFramePaddingX(v0.10.3+)Number10Horizontal inner margin of the outer frame
outerFramePaddingY(v0.10.3+)Number10Vertical inner margin of the outer frame

16.Painter plugin

Field NameTypeDefault ValueDescription
onlyPainterNodeCustomStyles(v0.11.1+)BooleanfalseIs only format the manually set styles for brushing nodes and ignore the styles applied by nodes through themes

17.NodeImgAdjust plugin

Field NameTypeDefault ValueDescription
beforeDeleteNodeImg(v0.11.1+)FunctionnullIntercept the deletion of node images. Clicking the delete button on the node image will call this function before deleting the image. If the function returns true, the deletion will be canceled, can be an asynchronous function that returns a Promise instance

MIT License.