From 2a49dd91402890ef0a930f3aa4d1fec323c660d9 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Tue, 17 Oct 2023 11:13:06 +0800 Subject: [PATCH] Doc: update --- web/src/pages/Doc/en/associativeLine/index.md | 12 + .../pages/Doc/en/associativeLine/index.vue | 10 + web/src/pages/Doc/en/changelog/index.md | 46 + web/src/pages/Doc/en/changelog/index.vue | 29 + web/src/pages/Doc/en/constructor/index.md | 106 +- web/src/pages/Doc/en/constructor/index.vue | 1324 ++++++++++++++++- web/src/pages/Doc/en/node/index.md | 8 + web/src/pages/Doc/en/node/index.vue | 8 + web/src/pages/Doc/en/render/index.md | 70 +- web/src/pages/Doc/en/render/index.vue | 69 +- web/src/pages/Doc/en/richText/index.md | 8 + web/src/pages/Doc/en/richText/index.vue | 8 + web/src/pages/Doc/en/utils/index.md | 39 + web/src/pages/Doc/en/utils/index.vue | 33 + web/src/pages/Doc/zh/associativeLine/index.md | 14 +- .../pages/Doc/zh/associativeLine/index.vue | 10 + web/src/pages/Doc/zh/changelog/index.md | 46 + web/src/pages/Doc/zh/changelog/index.vue | 29 + web/src/pages/Doc/zh/constructor/index.md | 108 +- web/src/pages/Doc/zh/constructor/index.vue | 109 +- web/src/pages/Doc/zh/node/index.md | 8 + web/src/pages/Doc/zh/node/index.vue | 8 + web/src/pages/Doc/zh/render/index.md | 76 +- web/src/pages/Doc/zh/render/index.vue | 77 +- web/src/pages/Doc/zh/richText/index.md | 8 + web/src/pages/Doc/zh/richText/index.vue | 8 + web/src/pages/Doc/zh/utils/index.md | 39 + web/src/pages/Doc/zh/utils/index.vue | 33 + 28 files changed, 2263 insertions(+), 80 deletions(-) diff --git a/web/src/pages/Doc/en/associativeLine/index.md b/web/src/pages/Doc/en/associativeLine/index.md index 06685ee1..0b81bf04 100644 --- a/web/src/pages/Doc/en/associativeLine/index.md +++ b/web/src/pages/Doc/en/associativeLine/index.md @@ -88,3 +88,15 @@ Deletes the currently active associative line. Clicking on an associated line is ### clearActiveLine() Clears the active state of the currently active association line. + +### front() + +> v0.8.0+ + +The top-level display of the associated line. + +### back() + +> v0.8.0+ + +The associated line returns to its original level. \ No newline at end of file diff --git a/web/src/pages/Doc/en/associativeLine/index.vue b/web/src/pages/Doc/en/associativeLine/index.vue index bc39c6cf..0f645367 100644 --- a/web/src/pages/Doc/en/associativeLine/index.vue +++ b/web/src/pages/Doc/en/associativeLine/index.vue @@ -66,6 +66,16 @@ MindMap.usePlugin(AssociativeLine)
Deletes the currently active associative line. Clicking on an associated line is considered active.
Clears the active state of the currently active association line.
+++v0.8.0+
+
The top-level display of the associated line.
+++v0.8.0+
+
The associated line returns to its original level.
diff --git a/web/src/pages/Doc/en/changelog/index.md b/web/src/pages/Doc/en/changelog/index.md index b59bfffa..7ddd64be 100644 --- a/web/src/pages/Doc/en/changelog/index.md +++ b/web/src/pages/Doc/en/changelog/index.md @@ -1,5 +1,51 @@ # Changelog +## 0.8.0 + +Breaking change: Greatly optimize some of the code and slightly improve performance, mainly by using the 'render' class to remove useless logic, adjust unreasonable implementations, and extract duplicate code; Modify function names, functions, etc. + +Fix: + +> Fix the issue of the arrow of the associated line disappearing when exporting images and SVGs. +> +> Fix the issue of abnormal operation returning to the root node after resizing the container. +> +> Fix that the shortcut key operations for inserting summary, moving up, down, and organizing layout with one click did not trigger data_ The issue with the change event. + +New: + +> Optimize the canvas DOM structure and render nodes, lines, and associated lines in layers. +> +> Optimize the watermark plugin. +> +> The setTheme, setThemeConfig, and setLayout functions add parameters that do not trigger re rendering. +> +> Add a command to insert a parent node. +> +> Add a command to only delete the current node. +> +> Automatically expand child nodes when inserting a summary. +> +> Clear the current active node when right-clicking on the canvas. +> +> The folded active nodes are synchronously deleted from the list of active nodes. +> +> Pasting text with line breaks supports controlling whether nodes are split by line breaks. + +Demo: + +> Modify the method and copy to return to the root node. +> +> Fix the issue of ineffective first switching when switching themes in overlay mode. +> +> The right-click menu adds the function of inserting parent nodes and deleting only the current node. +> +> The top toolbar supports automatic folding into more according to the window width. +> +> Support manual input of zoom factor. +> +> Improve the English translation of the interface. + ## 0.7.3-fix.2 Fix some issues with collaborative editing: diff --git a/web/src/pages/Doc/en/changelog/index.vue b/web/src/pages/Doc/en/changelog/index.vue index 3881f6f7..25ae5d07 100644 --- a/web/src/pages/Doc/en/changelog/index.vue +++ b/web/src/pages/Doc/en/changelog/index.vue @@ -1,6 +1,35 @@Breaking change: Greatly optimize some of the code and slightly improve performance, mainly by using the 'render' class to remove useless logic, adjust unreasonable implementations, and extract duplicate code; Modify function names, functions, etc.
+Fix:
+++Fix the issue of the arrow of the associated line disappearing when exporting images and SVGs.
+Fix the issue of abnormal operation returning to the root node after resizing the container.
+Fix that the shortcut key operations for inserting summary, moving up, down, and organizing layout with one click did not trigger data_ The issue with the change event.
+
New:
+++Optimize the canvas DOM structure and render nodes, lines, and associated lines in layers.
+Optimize the watermark plugin.
+The setTheme, setThemeConfig, and setLayout functions add parameters that do not trigger re rendering.
+Add a command to insert a parent node.
+Add a command to only delete the current node.
+Automatically expand child nodes when inserting a summary.
+Clear the current active node when right-clicking on the canvas.
+The folded active nodes are synchronously deleted from the list of active nodes.
+Pasting text with line breaks supports controlling whether nodes are split by line breaks.
+
Demo:
++Modify the method and copy to return to the root node.
+Fix the issue of ineffective first switching when switching themes in overlay mode.
+The right-click menu adds the function of inserting parent nodes and deleting only the current node.
+The top toolbar supports automatic folding into more according to the window width.
+Support manual input of zoom factor.
+Improve the English translation of the interface.
+
Fix some issues with collaborative editing:
1.The position of the new node is incorrect when inserting peer nodes;
diff --git a/web/src/pages/Doc/en/constructor/index.md b/web/src/pages/Doc/en/constructor/index.md index 17226a02..e7c3114f 100644 --- a/web/src/pages/Doc/en/constructor/index.md +++ b/web/src/pages/Doc/en/constructor/index.md @@ -82,7 +82,8 @@ const mindMap = new MindMap({ | errorHandler(v0.6.15+) | Function | | 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 object | | | disableMouseWheelZoom(v0.6.15+) | Boolean | false | Prohibit mouse wheel scaling, you can still use the API for scaling | | | 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 | | -| enableDblclickReset(v0.6.17+) | Boolean | true(v0.7.0+changed to false) | Turn on the mouse and double-click to reset the position and zoom of the mind map | | +| enableDblclickReset(v0.6.17+)(v0.8.0+this attribute has been deleted) | Boolean | true(v0.7.0+changed to false) | Turn on the mouse and double-click to reset the position and zoom of the mind map | | +| enableDblclickBackToRootNode(v0.8.0+) | Boolean | false | Whether to return to the root node when double clicking with the mouse, that is, to center the display of the root node | | | minExportImgCanvasScale(v0.7.0+) | Number | 2 | The scaling factor of canvas when exporting images and PDFs, which is set to the maximum value of window.devicePixelRatio to improve image clarity | | | hoverRectColor(v0.7.0+) | String | rgb(94, 200, 248) | The node mouse hover and the rectangular border color displayed when activated will add a transparency of 0.6 when hovering | | | hoverRectPadding(v0.7.0+) | Number | 2 | The distance between the node mouse hover and the displayed rectangular border when activated and the node content | | @@ -95,6 +96,9 @@ const mindMap = new MindMap({ | dragOpacityConfig(v0.7.2+) | Object | { cloneNodeOpacity: 0.5, beingDragNodeOpacity: 0.3 } | 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 node | | | tagsColorMap(v0.7.2+) | Object | {} | 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 content | | | cooperateStyle(v0.7.3+) | Object | { avatarSize: 22, fontSize: 12 } | 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 text | | +| associativeLineIsAlwaysAboveNode(v0.8.0+) | Boolean | true | Is 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 | | +| defaultGeneralizationText(v0.8.0+) | String | 概要 | Insert default text for summary | | +| handleIsSplitByWrapOnPasteCreateNewNode(v0.8.0+) | Function | null | null | 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 breaks | | ### Data structure @@ -210,10 +214,96 @@ Get whether a plugin is registered, The index of the plugin in the registered pl List of all currently registered plugins. +## Instance props +### el + +Container element. + +### opt + +Config options object. + +### svg + +> @svgdotjs/svg.js library calls the node instance returned by the SVG() method + +Canvas SVG element. + +### draw + +> @svgdotjs/svg.js library calls the node instance returned by the group() method +> +> Child node of SVG node + +Container element, used to carry content such as nodes and connections. + +### lineDraw + +> v0.8.0+ +> +> @svgdotjs/svg.js library calls the node instance returned by the group() method +> +> Child node of draw node + +Container for node wiring elements. + +### nodeDraw + +> v0.8.0+ +> +> @svgdotjs/svg.js library calls the node instance returned by the group() method +> +> Child node of draw node + +Container for node elements. + +### associativeLineDraw + +> v0.8.0+ +> +> @svgdotjs/svg.js library calls the node instance returned by the group() method +> +> Available when the associated line plugin is registered +> +> Child node of draw node + +Container for associative line content. + +### otherDraw + +> v0.8.0+ +> +> @svgdotjs/svg.js library calls the node instance returned by the group() method +> +> Child node of draw node + +Container for other content. + +### elRect + +The size and position information of the container element 'el'. The return result of calling the 'getBoundingClientRect()' method. + +### width + +The width of the container element 'el'. + +### height + +The height of the container element 'el'. + +### themeConfig + +Current Theme Configuration. ## Instance methods +### clearDraw() + +> v0.8.0+ + +Clear `lineDraw`、`associativeLineDraw`、`nodeDraw`、`otherDraw` containers. + ### destroy() > v0.6.0+ @@ -323,7 +413,9 @@ Trigger an event, which can be one of the events listed above or a custom event. Unbind an event. -### setTheme(theme) +### setTheme(theme, notRender = false) + +- `notRender`: v0.8.0+, Is not call the render method to update the canvas. Switches the theme. Available themes can be found in the options table above. @@ -331,7 +423,9 @@ Switches the theme. Available themes can be found in the options table above. Gets the current theme. -### setThemeConfig(config) +### setThemeConfig(config, notRender = false) + +- `notRender`: v0.8.0+, Is not call the render method to update the canvas. Sets the theme configuration. `config` is the same as the `themeConfig` option in the options table above. @@ -372,7 +466,9 @@ This method only updates the configuration and has no other side effects, such a Gets the current layout structure. -### setLayout(layout) +### setLayout(layout, notRender = false) + +- `notRender`: v0.8.0+, Is not call the render method to update the canvas. Sets the layout structure. Available values can be found in the `layout` field in the options table above. @@ -420,6 +516,8 @@ redo. All commands are as follows: | INSERT_MULTI_NODE(v0.7.2+) | Insert multiple sibling nodes into the specified node at the same time, with the operating node being the currently active node or the specified node | appointNodes(Optional, specify nodes, specify multiple nodes to pass an array), nodeList(Data list of newly inserted nodes, array type) | | INSERT_MULTI_CHILD_NODE(v0.7.2+) | Insert multiple child nodes into the specified node simultaneously, with the operation node being the currently active node or the specified node | appointNodes(Optional, specify nodes, specify multiple nodes to pass an array), childList(Data list of newly inserted nodes, array type) | | INSERT_FORMULA(v0.7.2+) | Insert mathematical formulas into nodes, operate on the currently active node or specified node | formula(Mathematical formula to insert, LaText syntax), appointNodes(Optional, specify the node to insert the formula into. Multiple nodes can be passed as arrays, otherwise it defaults to the currently active node) | +| INSERT_PARENT_NODE(v0.8.0+) | Insert a parent node into the specified node, with the operation node being the currently active node or the specified node | openEdit(Activate the newly inserted node and enter editing mode, default to 'true'`)、 appointNodes(Optional, specify the node to insert into the parent node, and specify that multiple nodes can pass an array)、 appointData(Optional, specify the data for the newly created node, such as {text: 'xxx', ...}, Detailed structure can be referenced [exampleData.js](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/example/exampleData.js)) | +| REMOVE_CURRENT_NODE(v0.8.0+) | Delete only the current node, operate on the currently active node or specified node | appointNodes(Optional, specify the nodes to be deleted, and multiple nodes can be passed as an array) | ### setData(data) diff --git a/web/src/pages/Doc/en/constructor/index.vue b/web/src/pages/Doc/en/constructor/index.vue index 85fadc3a..f9254f26 100644 --- a/web/src/pages/Doc/en/constructor/index.vue +++ b/web/src/pages/Doc/en/constructor/index.vue @@ -1,6 +1,1328 @@<div id="mindMapContainer"></div>
+
+import MindMap from "simple-mind-map";
+
+const mindMap = new MindMap({
+ el: document.getElementById("mindMapContainer"),
+ data: {
+ "data": {
+ "text": "Root Node"
+ },
+ "children": []
+ }
+});
+
+| Field Name | +Type | +Default Value | +Description | +Required | +
|---|---|---|---|---|
| el | +Element | ++ | Container element, must be a DOM element | +Yes | +
| data | +Object | +{} | +Mind map data, Please refer to the introduction of 【Data structure】 below | ++ |
| layout | +String | +logicalStructure | +Layout type, options: logicalStructure (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) | ++ |
| fishboneDeg(v0.5.4+) | +Number | +45 | +Set the diagonal angle of the fishbone structure diagram | ++ |
| theme | +String | +default | +Theme, 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+) | ++ |
| themeConfig | +Object | +{} | +Theme configuration, will be merged with the selected theme, available fields refer to: default.js | ++ |
| scaleRatio | +Number | +0.1 | +The incremental scaling ratio | ++ |
| maxTag | +Number | +5 | +The maximum number of tags displayed in the node, any additional tags will be discarded | ++ |
| exportPadding | +Number | +20 | +The padding for exporting images | ++ |
| imgTextMargin | +Number | +5 | +The spacing between the image and text in the node | ++ |
| textContentMargin | +Number | +2 | +The spacing between various text information in the node, such as the spacing between the icon and text | ++ |
| selectTranslateStep | +Number | +3 | +The canvas offset when mouse moves to the edge during multi-select node | ++ |
| selectTranslateLimit | +Number | +20 | +The distance from the edge when the canvas begins to offset during multi-select node | ++ |
| customNoteContentShow(v0.1.6+) | +Object | +null | +Custom node note content display, object type, structure: {show: (noteContent, left, top) => {// your display node note logic }, hide: () => {// your hide node note logic }} | ++ |
| readonly(v0.1.7+) | +Boolean | +false | +Whether it is read-only mode | ++ |
| enableFreeDrag(v0.2.4+) | +Boolean | +false | +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) drag | ++ |
| watermarkConfig(v0.2.4+) | +Object | ++ | Watermark config, Please refer to the table 【Watermark config】 below for detailed configuration | ++ |
| textAutoWrapWidth(v0.3.4+) | +Number | +500 | +Each line of text in the node will wrap automatically when it reaches the width | ++ |
| customHandleMousewheel(v0.4.3+) | +Function | +null | +User-defined mouse wheel event processing can pass a function, and the callback parameter is the event object | ++ |
| mousewheelAction(v0.4.3+) | +String | +zoom | +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 effect |
++ |
| mousewheelMoveStep(v0.4.3+) | +Number | +100 | +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 px |
++ |
| mousewheelZoomActionReverse(v0.6.5+) | +Boolean | +false | +When mousewheelAction is set to zoom, 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 reversed |
++ |
| defaultInsertSecondLevelNodeText(v0.4.7+) | +String | +二级节点 | +Text of the default inserted secondary node | ++ |
| defaultInsertBelowSecondLevelNodeText(v0.4.7+) | +String | +分支主题 | +Text for nodes below the second level inserted by default | ++ |
| expandBtnStyle(v0.5.0+) | +Object | +{ color: '#808080', fill: '#fff', fontSize: 13, strokeColor: '#333333' } | +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) | ++ |
| expandBtnIcon(v0.5.0+) | +Object | +{ open: '', close: '' } | +Customize the icon of the expand/collapse button, and you can transfer the svg string of the icon | ++ |
| expandBtnNumHandler(v0.7.0+) | +Function | ++ | Used to customize the content of displaying the number of nodes when folding, receiving a parameter that represents the instance of the folding node, and returning a number or string that represents the final displayed content. For example, when the number is greater than 99, 99 can be displayed+ | ++ |
| isShowExpandNum(v0.7.0+) | +Boolean | +true | +Display the number of folded nodes when they are folded up | ++ |
| enableShortcutOnlyWhenMouseInSvg(v0.5.1+) | +Boolean | +true | +Only respond to shortcut key events when the mouse is inside the canvas | ++ |
| enableNodeTransitionMove(v0.5.1+)(v0.6.7+ is remove this feature) | +Boolean | +true | +Whether to enable node animation transition | ++ |
| nodeTransitionMoveDuration(v0.5.1+)(v0.6.7+ is remove this feature) | +Number | +300 | +If node animation transition is enabled, the transition time can be set using this attribute, in milliseconds | ++ |
| initRootNodePosition(v0.5.3+) | +Array | +null | +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 height |
++ |
| exportPaddingX(v0.5.5+) | +Number | +10 | +Horizontal padding of graphics when exporting PNG, SVG, and PDF | ++ |
| exportPaddingY(v0.5.5+) | +Number | +10 | +Vertical padding of graphics when exporting PNG, SVG, and PDF | ++ |
| nodeTextEditZIndex(v0.5.5+) | +Number | +3000 | ++ | z-index of node text edit box elements | +
| nodeNoteTooltipZIndex(v0.5.5+) | +Number | +3000 | +z-index of floating layer elements in node comments | ++ |
| isEndNodeTextEditOnClickOuter(v0.5.5+) | +Boolean | +true | +Whether to end the editing status of node text when clicking on an area outside the canvas | ++ |
| maxHistoryCount(v0.5.6+) | +Number | +1000 | ++ | Maximum number of history records | +
| alwaysShowExpandBtn(v0.5.8+) | +Boolean | +false | +Whether to always display the expand and collapse buttons of nodes, which are only displayed when the mouse is moved up and activated by default | ++ |
| iconList(v0.5.8+) | +Array | +[] | +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 object | ++ |
| maxNodeCacheCount(v0.5.10+) | +Number | +1000 | +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 pool | ++ |
| defaultAssociativeLineText(v0.5.11+) | +String | +关联 | +Association Line Default Text | ++ |
| fitPadding(v0.6.0+) | +Number | +50 | +The padding of mind mapping when adapting to canvas size, Unit: px | ++ |
| enableCtrlKeyNodeSelection(v0.6.0+) | +Boolean | +true | +Whether to enable the function of holding down the Ctrl key to select multiple nodes | ++ |
| useLeftKeySelectionRightKeyDrag(v0.6.0+) | +Boolean | +false | +Setting to left click to select multiple nodes and right click to drag the canvas. | ++ |
| beforeTextEdit(v0.6.0+) | +Function/null | +null | +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 instance | ++ |
| isUseCustomNodeContent(v0.6.3+) | +Boolean | +false | +Whether to customize node content | ++ |
| customCreateNodeContent(v0.6.3+) | +Function/null | +null | +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 null |
++ |
| mouseScaleCenterUseMousePosition(v0.6.4-fix.1+) | +Boolean | +true | +Is the mouse zoom centered around the current position of the mouse, otherwise centered around the canvas | ++ |
| customInnerElsAppendTo(v0.6.12+) | +null/HTMLElement | +null | +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.body | ++ |
| nodeDragPlaceholderMaxSize(v0.6.12+) | +Number | +20 | +When dragging an element, the maximum height of the block indicating the new position of the element | ++ |
| enableCreateHiddenInput(v0.6.13+)(v0.6.14+ remove this feature) | +Boolean | +true | +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 state | ++ |
| enableAutoEnterTextEditWhenKeydown(v0.6.13+) | +Boolean | +true | +Does it automatically enter text editing mode when pressing the Chinese, English, or numeric buttons when there is an activation node? | ++ |
| richTextEditFakeInPlace(v0.6.13+) | +Boolean | +false | +Set 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 | ++ |
| customHandleClipboardText(v0.6.14+) | +Function | +null | +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 promise | ++ |
| errorHandler(v0.6.15+) | +Function | ++ | 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 object | ++ |
| disableMouseWheelZoom(v0.6.15+) | +Boolean | +false | +Prohibit mouse wheel scaling, you can still use the API for scaling | ++ |
| 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 | ++ |
| enableDblclickReset(v0.6.17+)(v0.8.0+this attribute has been deleted) | +Boolean | +true(v0.7.0+changed to false) | +Turn on the mouse and double-click to reset the position and zoom of the mind map | ++ |
| enableDblclickBackToRootNode(v0.8.0+) | +Boolean | +false | +Whether to return to the root node when double clicking with the mouse, that is, to center the display of the root node | ++ |
| minExportImgCanvasScale(v0.7.0+) | +Number | +2 | +The scaling factor of canvas when exporting images and PDFs, which is set to the maximum value of window.devicePixelRatio to improve image clarity | ++ |
| hoverRectColor(v0.7.0+) | +String | +rgb(94, 200, 248) | +The node mouse hover and the rectangular border color displayed when activated will add a transparency of 0.6 when hovering | ++ |
| hoverRectPadding(v0.7.0+) | +Number | +2 | +The distance between the node mouse hover and the displayed rectangular border when activated and the node content | ++ |
| selectTextOnEnterEditText(v0.7.0+) | +Boolean | +true | +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 node | ++ |
| deleteNodeActive(v0.7.1+) | +Boolean | +true | +Enable the function of automatically activating adjacent nodes or parent nodes after deleting nodes | ++ |
| autoMoveWhenMouseInEdgeOnDrag(v0.7.1+) | +Boolean | +true | +Whether to enable automatic canvas movement when the mouse moves to the edge of the canvas while dragging nodes | ++ |
| fit(v0.7.1-fix.2+) | +Boolean | +false | +Is the first rendering scaled to fit the canvas size | ++ |
| dragMultiNodeRectConfig(v0.7.2+) | +Object | +{ width: 40, height: 20, fill: '' } | +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 rectangle | ++ |
| dragPlaceholderRectFill(v0.7.2+) | +String | ++ | The filling color of the schematic rectangle for the new position when dragging nodes. If not transmitted, the default color for the connected line is used | ++ |
| dragOpacityConfig(v0.7.2+) | +Object | +{ cloneNodeOpacity: 0.5, beingDragNodeOpacity: 0.3 } | +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 node | ++ |
| tagsColorMap(v0.7.2+) | +Object | +{} | +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 content | ++ |
| cooperateStyle(v0.7.3+) | +Object | +{ avatarSize: 22, fontSize: 12 } | +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 text | ++ |
| associativeLineIsAlwaysAboveNode(v0.8.0+) | +Boolean | +true | +Is 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 | ++ |
| defaultGeneralizationText(v0.8.0+) | +String | +概要 | +Insert default text for summary | ++ |
| handleIsSplitByWrapOnPasteCreateNewNode(v0.8.0+) | +Function | +null | +null | +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 breaks | +
The basic data structure is as follows:
+{
+ 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
+ generalization: {// The summary of the node, if there is no summary, the generalization can be set to null
+ text: ''// Summary Text
+ },
+ 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.
| Field Name | +Type | +Default Value | +Description | +
|---|---|---|---|
| text | +String | +'' | +Watermark text. If it is an empty string, the watermark will not be displayed | +
| lineSpacing | +Number | +100 | +Spacing between watermark lines | +
| textSpacing | +Number | +100 | +Spacing between watermarks in the same row | +
| angle | +Number | +30 | +Tilt angle of watermark, range: [0, 90] | +
| textStyle | +Object | +{color: '#999', opacity: 0.5, fontSize: 14} | +Watermark text style | +
| Field Name | +Type | +Default Value | +Description | +
|---|---|---|---|
| name | +String | ++ | The name of the icon group | +
| type | +String | ++ | Values for icon grouping | +
| list | +Array | ++ | A 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,... |
+
++v0.2.23+
+
Define new theme.
+name:New theme name
config:New theme config
Simple-mind-map Built-in many themes. In addition, you can register new theme. It is recommended to register before instantiation, so that you can directly use the newly registered theme during instantiation. Use example:
import MindMap from 'simple-mind-map'
+// 注册新主题
+MindMap.defineTheme('Theme name', {})
+
+// 1.实例化时使用新注册的主题
+const mindMap = new MindMap({
+ theme: 'Theme name'
+})
+
+// 2.动态切换新主题
+mindMap.setTheme('Theme name')
+
+For all configurations of theme, please refer to Default Topic. The defineThememethod will merge the configuration you passed in with the default configuration. Most of the themes do not need custom many parts. For a typical customized theme configuration, please refer to blueSky.
++v0.3.0+
+
opt:v0.4.0+,Plugin options. If a plugin supports custom options, it can be passed in through this parameter.If you need to use some non-core functions, such as mini map, watermark, etc, you can register plugin through this method. Can be called in chain.
+Note: The plugin needs to be registered before instantiating MindMap.
++v0.4.0+
+
Get whether a plugin is registered, The index of the plugin in the registered plugin list is returned, If it is -1, it means that the plugin is not registered.
++v0.3.0+
+
List of all currently registered plugins.
+Container element.
+Config options object.
+++@svgdotjs/svg.js library calls the node instance returned by the SVG() method
+
Canvas SVG element.
+++@svgdotjs/svg.js library calls the node instance returned by the group() method
+Child node of SVG node
+
Container element, used to carry content such as nodes and connections.
+++v0.8.0+
+@svgdotjs/svg.js library calls the node instance returned by the group() method
+Child node of draw node
+
Container for node wiring elements.
+++v0.8.0+
+@svgdotjs/svg.js library calls the node instance returned by the group() method
+Child node of draw node
+
Container for node elements.
+++v0.8.0+
+@svgdotjs/svg.js library calls the node instance returned by the group() method
+Available when the associated line plugin is registered
+Child node of draw node
+
Container for associative line content.
+++v0.8.0+
+@svgdotjs/svg.js library calls the node instance returned by the group() method
+Child node of draw node
+
Container for other content.
+The size and position information of the container element 'el'. The return result of calling the 'getBoundingClientRect()' method.
+The width of the container element 'el'.
+The height of the container element 'el'.
+Current Theme Configuration.
+++v0.8.0+
+
Clear lineDraw、associativeLineDraw、nodeDraw、otherDraw containers.
++v0.6.0+
+
Destroy mind maps. It will remove registered plugins, remove listening events, and delete all nodes on the canvas.
+++v0.3.0+
+
paddingX: Padding x
paddingY: Padding y
Get the svg data and return an object. The detailed structure is as follows:
{
+ svg, // Element, the overall svg element of the mind map graphics, including: svg (canvas container), g (actual mind map group)
+ svgHTML, // String, svg string, i.e. html string, can be directly rendered to the small map container you prepared
+ rect: // Object, position, size, etc. of mind map graphics before zoom
+ origWidth, // Number, canvas width
+ origHeight, // Number, canvas height
+ scaleX, // Number, horizontal zoom value of mind map graphics
+ scaleY, // Number, vertical zoom value of mind map graphics
+}
+
+callback: v0.3.2+, Function, Called when the re-rendering is completeTriggers a full rendering, which will reuse nodes for better performance. If
+only the node positions have changed, this method can be called to reRender.
callback: v0.3.2+, Function, Called when the re-rendering is completePerforms a full re-render, clearing the canvas and creating new nodes. This has +poor performance and should be used sparingly.
+After the container size has changed, this method should be called to adjust.
+++v0.1.7+
+
Switches between readonly and edit mode.
+mode:readonly、edit
Listen to an event. Event list:
+| Event Name | +Description | +Callback Parameters | +
|---|---|---|
| data_change | +Tree rendering data change, listen to this method to get the latest data | +data (current tree rendering data) | +
| view_data_change(v0.1.1+) | +View change data, such as when dragging or zooming | +data (current view state data) | +
| back_forward | +Forward or backward | +activeHistoryIndex (current index in the history data array), length (current length of the history data array) | +
| draw_click | +Canvas click event | +e (event object) | +
| svg_mousedown | +svg canvas mouse down event | +e (event object) | +
| mousedown | +el element mouse down event | +e (event object), this (Event event class instance) | +
| mousemove | +el element mouse move event | +e (event object), this (Event event class instance) | +
| drag | +If it is a drag event while holding down the left button | +e (event object), this (Event event class instance) | +
| mouseup | +el element mouse up event | +e (event object), this (Event event class instance) | +
| mousewheel | +Mouse scroll event | +e (event object), dir (up or down scroll), this (Event event class instance) 、isTouchPad(v0.6.1+, Is it an event triggered by the touchpad) | +
| contextmenu | +svg canvas right mouse button menu event | +e (event object) | +
| node_click | +Node click event | +this (node instance), e (event object) | +
| node_mousedown | +Node mouse down event | +this (node instance), e (event object) | +
| node_mouseup | +node mouseup event | +this (node instance), e (event object) | +
| node_mouseup | +Node mouseup event | +this (node instance), e (event object) | +
| node_dblclick | +Node double-click event | +this (node instance), e (event object) | +
| node_contextmenu | +Node right-click menu event | +e (event object), this (node instance) | +
| node_mouseenter(v0.4.1+) | +Node mouseenter event | +this (node instance), e (event object) | +
| node_mouseleave(v0.4.1+) | +Node mouseleave event | +this (node instance), e (event object) | +
| before_node_active | +Event before node activation | +this (node instance), activeNodeList (current list of active nodes) | +
| node_active | +Node activation event | +this (node instance), activeNodeList (current list of active nodes) | +
| expand_btn_click | +Node expand or collapse event | +this (node instance) | +
| before_show_text_edit | +Event before node text edit box opens | ++ |
| hide_text_edit | +Node text edit box close event | +textEditNode (text edit box DOM node), activeNodeList (current list of active nodes) | +
| scale | +Zoom event | +scale (zoom ratio) | +
| node_img_dblclick(v0.2.15+) | +Node image double-click event | +this (node instance), e (event object) | +
| node_img_mouseenter(v0.6.5+) | +Node image mouseenter event | +this(node instance)、imgNode(img node)、e(event object) | +
| node_img_mouseleave(v0.6.5+) | +Node image mouseleave event | +this(node instance)、imgNode(img node)、e(event object) | +
| node_img_mousemove(v0.6.5+) | +Node image mousemove event | +this(node instance)、imgNode(img node)、e(event object) | +
| node_tree_render_end(v0.2.16+) | +Node tree render end event | ++ |
| rich_text_selection_change(v0.4.0+) | +Available when the RichText plugin is registered. Triggered when the text selection area changes when the node is edited |
+hasRange(Whether there is a selection)、rectInfo(Size and location information of the selected area)、formatInfo(Text formatting information of the selected area) | +
| transforming-dom-to-images(v0.4.0+) | +Available when the RichText plugin is registered. When there is a DOM node in svg, the DOM node will be converted to an image when exporting to an image. This event will be triggered during the conversion process. You can use this event to prompt the user about the node to which you are currently converting |
+index(Index of the node currently converted to)、len(Total number of nodes to be converted) | +
| node_dragging(v0.4.5+) | +Triggered when a node is dragged | +node(The currently dragged node) | +
| node_dragend(v0.4.5+) | +Triggered when the node is dragged and ends | +{ overlapNodeUid, prevNodeUid, nextNodeUid }(v0.6.12+,The node uid to which the node is moved this time, for example, if it is moved to node A, then the overlayNodeUid is the uid of node A. If it is moved to the front of node B, then the nextNodeUid is the uid of node B. You can obtain the node instance through the mindMap. extender.findNodeByUid(uid) method) | +
| associative_line_click(v0.4.5+) | +Triggered when an associated line is clicked | +path(Connector node)、clickPath(Invisible click line node)、node(Start node)、toNode(Target node) | +
| svg_mouseenter(v0.5.1+) | +Triggered when the mouse moves into the SVG canvas | +e(event object) | +
| svg_mouseleave(v0.5.1+) | +Triggered when the mouse moves out of the SVG canvas | +e(event object) | +
| node_icon_click(v0.6.10+) | +Triggered when clicking on an icon within a node | +this(node instance)、item(Click on the icon name)、e(event object) | +
| view_theme_change(v0.6.12+) | +Triggered after calling the setTheme method to set the theme | +theme(theme name) | +
| set_data(v0.7.3+) | +Triggered when the setData method is called to dynamically set mind map data | +data(New Mind Map Data) | +
Trigger an event, which can be one of the events listed above or a custom event.
+Unbind an event.
+notRender: v0.8.0+, Is not call the render method to update the canvas.Switches the theme. Available themes can be found in the options table above.
+Gets the current theme.
+notRender: v0.8.0+, Is not call the render method to update the canvas.Sets the theme configuration. config is the same as the themeConfig option
+in the options table above.
Gets the custom theme configuration.
+Gets the value of a specific theme configuration property.
+++0.2.24+
+
prop:Get the value of the specified configuration, and return the entire configuration if not passed
Get config, That is, opt of new MindMap (opt)
++0.2.24+
+
opt:Configuration to update
Update config,That is update opt of new MindMap(opt),You can only update some data, such as:
mindMap.updateConfig({
+ enableFreeDrag: true// 开启节点自由拖拽
+})
+
+This method only updates the configuration and has no other side effects, such as triggering canvas re-rendering
+Gets the current layout structure.
+notRender: v0.8.0+, Is not call the render method to update the canvas.Sets the layout structure. Available values can be found in the layout field
+in the options table above.
Executes a command, which will add a record to the history stack for undo or +redo. All commands are as follows:
+| Command name | +Description | +Parameters | +
|---|---|---|
| SELECT_ALL | +Select all | ++ |
| BACK | +Go back a specified number of steps | +step (the number of steps to go back, default is 1) | +
| FORWARD | +Go forward a specified number of steps | +step (the number of steps to go forward, default is 1) | +
| INSERT_NODE | +Insert a sibling node, the active node or appoint node will be the operation node. If there are multiple active nodes, only the first one will be effective(v0.7.2+Supports simultaneous insertion of sibling nodes into multiple active nodes) | +openEdit(v0.4.6+, Whether to activate the newly inserted node and enter editing mode, default is true) 、 appointNodes(v0.4.7+, Optional, appoint node, Specifying multiple nodes can pass an array)、 appointData(Optional, Specify the data for the newly created node, Such as {text: 'xxx', ...}, Detailed structure can be referred to exampleData.js )、 appointChildren(v0.6.14+, Optional, Specify the child nodes of the newly created node, array type) |
+
| INSERT_CHILD_NODE | +Insert a child node, the active node or appoint node will be the operation node | +openEdit(v0.4.6+, Whether to activate the newly inserted node and enter editing mode, default is true)、 appointNodes(v0.4.7+, Optional, appoint node, Specifying multiple nodes can pass an array)、 appointData(Optional, Specify the data for the newly created node, Such as {text: 'xxx', ...}, Detailed structure can be referred to exampleData.js )、 appointChildren(v0.6.14+, Optional, Specify the child nodes of the newly created node, array type) |
+
| UP_NODE | +Move node up, the active node will be the operation node. If there are multiple active nodes, only the first one will be effective. Using this command on the root node or the first node in the list will be invalid | ++ |
| DOWN_NODE | +Move node down, the active node will be the operation node. If there are multiple active nodes, only the first one will be effective. Using this command on the root node or the last node in the list will be invalid | ++ |
| REMOVE_NODE | +Remove node, the active node or appoint node will be the operation node | +appointNodes(v0.4.7+, Optional, appoint node, Specifying multiple nodes can pass an array) | +
| PASTE_NODE | +Paste node to a node, the active node will be the operation node | +data (the node data to paste, usually obtained through the renderer.copyNode() and renderer.cutNode() methods) | +
| SET_NODE_STYLE | +Modify node single style | +node (the node to set the style of), prop (style property), value (style property value), isActive (v0.7.0+has been abandoned, boolean, whether the style being set is for the active state) | +
| SET_NODE_STYLEs(v0.6.12+) | +Modify multiple styles of nodes | +node(the node to set the style of)、style(Style object,key is style prop,value is style value)、isActive(v0.7.0+has been abandoned, boolean, whether the style being set is for the active state) | +
| SET_NODE_ACTIVE | +Set whether the node is active | +node (the node to set), active (boolean, whether to activate) | +
| CLEAR_ACTIVE_NODE | +Clear the active state of the currently active node(s), the active node will be the operation node | ++ |
| SET_NODE_EXPAND | +Set whether the node is expanded | +node (the node to set), expand (boolean, whether to expand) | +
| EXPAND_ALL | +Expand all nodes | ++ |
| UNEXPAND_ALL | +Collapse all nodes | ++ |
| UNEXPAND_TO_LEVEL (v0.2.8+) | +Expand to a specified level | +level (the level to expand to, 1, 2, 3...) | +
| SET_NODE_DATA | +Update node data, that is, update the data in the data object of the node data object | +node (the node to set), data (object, the data to update, e.g. {expand: true}) |
+
| SET_NODE_TEXT | +Set node text | +node (the node to set), text (the new text for the node), richText(v0.4.0+, If you want to set a rich text character, you need to set it to true)、resetRichText(v0.6.10+Do you want to reset rich text? The default is false. If true is passed, the style of the rich text node will be reset) |
+
| SET_NODE_IMAGE | +Set Node Image | +node (node to set), imgData (object, image information, structured as: {url, title, width, height}, the width and height of the image must be passed) |
+
| SET_NODE_ICON | +Set Node Icon | +node (node to set), icons (array, predefined image names array, available icons can be obtained in the nodeIconList list in the icons.js file, icon name is type_name, such as ['priority_1']) | +
| SET_NODE_HYPERLINK | +Set Node Hyperlink | +node (node to set), link (hyperlink address), title (hyperlink name, optional) | +
| SET_NODE_NOTE | +Set Node Note | +node (node to set), note (note text) | +
| SET_NODE_TAG | +Set Node Tag | +node (node to set), tag (string array, built-in color information can be obtained in constant.js) | +
| INSERT_AFTER (v0.1.5+) | +Move Node to After Another Node | +node (node to move, (v0.7.2+supports passing node arrays to move multiple nodes simultaneously)), exist (target node) | +
| INSERT_BEFORE (v0.1.5+) | +Move Node to Before Another Node | +node (node to move, (v0.7.2+supports passing node arrays to move multiple nodes simultaneously)), exist (target node) | +
| MOVE_NODE_TO (v0.1.5+) | +Move a node as a child of another node | +node (the node to move, (v0.7.2+supports passing node arrays to move multiple nodes simultaneously)), toNode (the target node) | +
| ADD_GENERALIZATION (v0.2.0+) | +Add a node summary | +data (the data for the summary, in object format, all numerical fields of the node are supported, default is {text: 'summary'}) |
+
| REMOVE_GENERALIZATION (v0.2.0+) | +Remove a node summary | ++ |
| SET_NODE_CUSTOM_POSITION (v0.2.0+) | +Set a custom position for a node | +node (the node to set), left (custom x coordinate, default is undefined), top (custom y coordinate, default is undefined) | +
| RESET_LAYOUT (v0.2.0+) | +Arrange layout with one click | ++ |
| SET_NODE_SHAPE (v0.2.4+) | +Set the shape of a node | +node (the node to set), shape (the shape, all shapes: Shape.js) | +
| GO_TARGET_NODE(v0.6.7+) | +Navigate to a node, and if the node is collapsed, it will automatically expand to that node | +node(Node instance or node uid to locate)、callback(v0.6.9+, Callback function after positioning completion) | +
| INSERT_MULTI_NODE(v0.7.2+) | +Insert multiple sibling nodes into the specified node at the same time, with the operating node being the currently active node or the specified node | +appointNodes(Optional, specify nodes, specify multiple nodes to pass an array), nodeList(Data list of newly inserted nodes, array type) | +
| INSERT_MULTI_CHILD_NODE(v0.7.2+) | +Insert multiple child nodes into the specified node simultaneously, with the operation node being the currently active node or the specified node | +appointNodes(Optional, specify nodes, specify multiple nodes to pass an array), childList(Data list of newly inserted nodes, array type) | +
| INSERT_FORMULA(v0.7.2+) | +Insert mathematical formulas into nodes, operate on the currently active node or specified node | +formula(Mathematical formula to insert, LaText syntax), appointNodes(Optional, specify the node to insert the formula into. Multiple nodes can be passed as arrays, otherwise it defaults to the currently active node) | +
| INSERT_PARENT_NODE(v0.8.0+) | +Insert a parent node into the specified node, with the operation node being the currently active node or the specified node | +openEdit(Activate the newly inserted node and enter editing mode, default to 'true'`)、 appointNodes(Optional, specify the node to insert into the parent node, and specify that multiple nodes can pass an array)、 appointData(Optional, specify the data for the newly created node, such as {text: 'xxx', ...}, Detailed structure can be referenced exampleData.js) | +
| REMOVE_CURRENT_NODE(v0.8.0+) | +Delete only the current node, operate on the currently active node or specified node | +appointNodes(Optional, specify the nodes to be deleted, and multiple nodes can be passed as an array) | +
Dynamic setting of mind map data, pure node data
+data: mind map structure data
++v0.2.7+
+
Dynamic setting of mind map data, including node data, layout, theme, view
+data: complete data, structure can refer to
+exportFullData
++v0.2.9+
+
Gets mind map data
+withConfig: Boolean, default is false, that is, the obtained data only
+includes the node tree, if true is passed, it will also include theme, layout,
+view, etc. data
++You need to register the
+Exportplugin first
Export
+type: the type to be exported, optional values: png, svg, json, pdf (v0.2.1+),
+smm (essentially also json)
isDownload: whether to directly trigger download, Boolean value, default is
+false
fileName: (v0.1.6+) the name of the exported file, default is 思维导图 (mind
+map).
If it is exported as png, the fourth parameter can be passed:
transparent: v0.5.7+, Boolean, default is false, Specify whether the background of the exported image is transparent
If it is exported as svg, the fourth parameter can be passed:
plusCssText: Additional CSS style. If there is a dom node in svg, you can pass in some styles specific to the node through this parameter
If it is exported as json or smm, the fourth parameter can be passed:
withConfig: Boolean, default is true, Specify whether the exported data includes configuration data, otherwise only pure node tree data will be exported
++v0.1.5+
+
Convert the coordinates of the browser's visible window to coordinates relative +to the canvas.
+++v0.4.0+
+
Register plugin, Use MindMap.usePlugin to register plugin only before instantiation, The registered plugin will not take effect after instantiation, So if you want to register the plugin after instantiation, you can use the addPlugin method of the instance.
++v0.4.0+
+
Remove registered plugin, Plugins registered through the usePlugin or addPlugin methods can be removed.
Whether the node is currently being dragged
++v0.8.0+
+
active:Boolean, active status.Update nodes based on whether they are activated or not. The main task is to update the display and hiding of the expand and collapse buttons for nodes.
v0.7.2+
diff --git a/web/src/pages/Doc/en/render/index.md b/web/src/pages/Doc/en/render/index.md index cbb4bb67..fb941c4a 100644 --- a/web/src/pages/Doc/en/render/index.md +++ b/web/src/pages/Doc/en/render/index.md @@ -7,14 +7,20 @@ accessed through `mindMap.renderer`. ### activeNodeList -Gets the current list of active nodes +Gets the current list of active nodes. ### root -Gets the root node of the node tree +Gets the root node of the node tree. ## Methods +### setRootNodeCenter() + +> v0.8.0+ + +Return to the central theme, that is, set the root node to the center of the canvas. + ### setData(data) > v0.7.3+ @@ -23,49 +29,81 @@ Dynamically set mind map data. ### clearActive() -Clears the currently active node +> v0.8.0+ abandoned + +Clears the currently active node. ### clearAllActive() -Clears all currently active nodes and triggers the `node_active` event +> v0.8.0+ abandoned + +Clears all currently active nodes and triggers the `node_active` event. + +### clearActiveNode() + +> v0.8.0+ + +Clears all currently active nodes and triggers the `node_active` event. + +### clearActiveNodeList() + +> v0.8.0+ + +Clears all currently active nodes but not triggers the `node_active` event. ### startTextEdit() > v0.1.6+ If there is a text editing requirement, this method can be called to -disable the enter key and delete key related shortcuts to prevent conflicts +disable the enter key and delete key related shortcuts to prevent conflicts. ### endTextEdit() > v0.1.6+ -End text editing, restore enter key and delete key related shortcuts +End text editing, restore enter key and delete key related shortcuts. ### addActiveNode(node) -Add a node to the active list +> v0.8.0+ abandoned + +Add a node to the active list. + +### addNodeToActiveList(node) + +> v0.8.0+ + +Add a node to the active list. ### removeActiveNode(node) -Remove a node from the active list +> v0.8.0+ abandoned + +Remove a node from the active list. + +### removeNodeFromActiveList(node) + +> v0.8.0+ + +Remove a node from the active list. ### findActiveNodeIndex(node) -Search for the index of a node in the active list +Search for the index of a node in the active list. ### getNodeIndex(node) -Get the position index of a node among its siblings +Get the position index of a node among its siblings. ### removeOneNode(node) -Delete a specific node +Delete a specific node. ### copyNode() Copy a node, the active node is the node to be operated on, if there are -multiple active nodes, only the first node will be operated on +multiple active nodes, only the first node will be operated on. ### setNodeDataRender(node, data, notRender) @@ -73,25 +111,25 @@ multiple active nodes, only the first node will be operated on Set node `data`, i.e. the data in the data field, and will determine whether the node needs to be re-rendered based on whether the node size has changed, `data` -is an object, e.g. `{text: 'I am new text'}` +is an object, e.g. `{text: 'I am new text'}`. ### moveNodeTo(node, toNode) > v0.1.5+ -Move a node as a child of another node +Move a node as a child of another node. ### insertBefore(node, exist) > v0.1.5+ -Move a node in front of another node +Move a node in front of another node. ### insertAfter(node, exist) > v0.1.5+ -Move a node behind another node +Move a node behind another node. ### moveNodeToCenter(node) diff --git a/web/src/pages/Doc/en/render/index.vue b/web/src/pages/Doc/en/render/index.vue index ba6463a5..e1086789 100644 --- a/web/src/pages/Doc/en/render/index.vue +++ b/web/src/pages/Doc/en/render/index.vue @@ -5,65 +5,102 @@ accessed throughmindMap.renderer.Properties
activeNodeList
-Gets the current list of active nodes
+Gets the current list of active nodes.
root
-Gets the root node of the node tree
+Gets the root node of the node tree.
Methods
+setRootNodeCenter()
+++v0.8.0+
+Return to the central theme, that is, set the root node to the center of the canvas.
setData(data)
v0.7.3+
Dynamically set mind map data.
clearActive()
-Clears the currently active node
+++v0.8.0+ abandoned
+Clears the currently active node.
clearAllActive()
-Clears all currently active nodes and triggers the
+node_activeevent++v0.8.0+ abandoned
+Clears all currently active nodes and triggers the
+node_activeevent.clearActiveNode()
+++v0.8.0+
+Clears all currently active nodes and triggers the
+node_activeevent.clearActiveNodeList()
+++v0.8.0+
+Clears all currently active nodes but not triggers the
node_activeevent.startTextEdit()
v0.1.6+
If there is a text editing requirement, this method can be called to -disable the enter key and delete key related shortcuts to prevent conflicts
+disable the enter key and delete key related shortcuts to prevent conflicts.endTextEdit()
-v0.1.6+
End text editing, restore enter key and delete key related shortcuts
+End text editing, restore enter key and delete key related shortcuts.
addActiveNode(node)
-Add a node to the active list
+++v0.8.0+ abandoned
+Add a node to the active list.
+addNodeToActiveList(node)
+++v0.8.0+
+Add a node to the active list.
removeActiveNode(node)
-Remove a node from the active list
+++v0.8.0+ abandoned
+Remove a node from the active list.
+removeNodeFromActiveList(node)
+++v0.8.0+
+Remove a node from the active list.
findActiveNodeIndex(node)
-Search for the index of a node in the active list
+Search for the index of a node in the active list.
getNodeIndex(node)
-Get the position index of a node among its siblings
+Get the position index of a node among its siblings.
removeOneNode(node)
-Delete a specific node
+Delete a specific node.
copyNode()
Copy a node, the active node is the node to be operated on, if there are -multiple active nodes, only the first node will be operated on
+multiple active nodes, only the first node will be operated on.setNodeDataRender(node, data, notRender)
notRender: v0.6.9+,Boolean, Default isfalse, Do not trigger rendering.Set node
+is an object, e.g.data, i.e. the data in the data field, and will determine whether the node needs to be re-rendered based on whether the node size has changed,data-is an object, e.g.{text: 'I am new text'}{text: 'I am new text'}.moveNodeTo(node, toNode)
-v0.1.5+
Move a node as a child of another node
+Move a node as a child of another node.
insertBefore(node, exist)
-v0.1.5+
Move a node in front of another node
+Move a node in front of another node.
insertAfter(node, exist)
-v0.1.5+
Move a node behind another node
+Move a node behind another node.
moveNodeToCenter(node)
v0.2.17+
diff --git a/web/src/pages/Doc/en/richText/index.md b/web/src/pages/Doc/en/richText/index.md index f5b1db5e..59f58340 100644 --- a/web/src/pages/Doc/en/richText/index.md +++ b/web/src/pages/Doc/en/richText/index.md @@ -68,6 +68,14 @@ Replace the built-in font size list during rich text editing. The built-in list ## Method +### setNotActiveNodeStyle(node, style) + +> v0.8.0+ + +- `style`:Object, style object. + +Set rich text style for inactive nodes. + ### selectAll() Select All. When the node is being edited, you can select all the text in the node through this method. diff --git a/web/src/pages/Doc/en/richText/index.vue b/web/src/pages/Doc/en/richText/index.vue index ef38081d..a33c7ec1 100644 --- a/web/src/pages/Doc/en/richText/index.vue +++ b/web/src/pages/Doc/en/richText/index.vue @@ -56,6 +56,14 @@ MindMap.usePlugin(RichText, opt?)[1, 2, 3, ...100]Method
+setNotActiveNodeStyle(node, style)
+++v0.8.0+
++
+- +
style:Object, style object.Set rich text style for inactive nodes.
selectAll()
Select All. When the node is being edited, you can select all the text in the node through this method.
focus()
diff --git a/web/src/pages/Doc/en/utils/index.md b/web/src/pages/Doc/en/utils/index.md index 43073a34..13014cca 100644 --- a/web/src/pages/Doc/en/utils/index.md +++ b/web/src/pages/Doc/en/utils/index.md @@ -363,6 +363,45 @@ Generate colors based on incoming content, and the same content will generate th Determine whether two objects are the same, only handling objects or arrays. +#### getNodeDataIndex(node) + +> v0.8.0+ + +Gets the position index of a node within its sibling nodes. + +#### getNodeIndexInNodeList(node, nodeList) + +> v0.8.0+ + +Find the index of a node from a list of nodes. + +#### setDataToClipboard(data) + +> v0.8.0+ + +- `data`:Object | Array + +Set data to the user clipboard. + +#### getDataFromClipboard() + +> v0.8.0+ + +Reading text and images from the user's clipboard returns: + +```js +{ + text, + img +} +``` + +#### removeFromParentNodeData(node) + +> v0.8.0+ + +Remove the data of a node from its parent node's `nodeData.children` list. + ## Simulate CSS background in Canvas Import: diff --git a/web/src/pages/Doc/en/utils/index.vue b/web/src/pages/Doc/en/utils/index.vue index 4becf706..c801f080 100644 --- a/web/src/pages/Doc/en/utils/index.vue +++ b/web/src/pages/Doc/en/utils/index.vue @@ -295,6 +295,39 @@ and copying thedataof the data object, example:a、b: Object | Array, Two objects to compareDetermine whether two objects are the same, only handling objects or arrays.
+getNodeDataIndex(node)
+++v0.8.0+
+Gets the position index of a node within its sibling nodes.
+getNodeIndexInNodeList(node, nodeList)
+++v0.8.0+
+Find the index of a node from a list of nodes.
+setDataToClipboard(data)
+++v0.8.0+
++
+- +
data:Object | ArraySet data to the user clipboard.
+getDataFromClipboard()
+++v0.8.0+
+Reading text and images from the user's clipboard returns:
++{ + text, + img +} +removeFromParentNodeData(node)
+++v0.8.0+
+Remove the data of a node from its parent node's
nodeData.childrenlist.Simulate CSS background in Canvas
Import:
import drawBackgroundImageToCanvas from 'simple-mind-map/src/utils/simulateCSSBackgroundInCanvas' diff --git a/web/src/pages/Doc/zh/associativeLine/index.md b/web/src/pages/Doc/zh/associativeLine/index.md index 1507e037..7757f98b 100644 --- a/web/src/pages/Doc/zh/associativeLine/index.md +++ b/web/src/pages/Doc/zh/associativeLine/index.md @@ -87,4 +87,16 @@ MindMap.usePlugin(AssociativeLine) ### clearActiveLine() -清除当前激活的关联线的激活状态。 \ No newline at end of file +清除当前激活的关联线的激活状态。 + +### front() + +> v0.8.0+ + +关联线顶层显示。 + +### back() + +> v0.8.0+ + +关联线回到原有层级。 \ No newline at end of file diff --git a/web/src/pages/Doc/zh/associativeLine/index.vue b/web/src/pages/Doc/zh/associativeLine/index.vue index 8f4b704b..7339f8a6 100644 --- a/web/src/pages/Doc/zh/associativeLine/index.vue +++ b/web/src/pages/Doc/zh/associativeLine/index.vue @@ -66,6 +66,16 @@ MindMap.usePlugin(AssociativeLine)删除当前激活的关联线。点击某条关联线则视为激活。
clearActiveLine()
清除当前激活的关联线的激活状态。
+front()
+++v0.8.0+
+关联线顶层显示。
+back()
+++v0.8.0+
+关联线回到原有层级。
破坏性更新:大幅优化部分代码,小幅提升性能,主要是render类,删除无用逻辑、调整不合理的实现、提取重复代码;修改函数名称、函数功能等。
修复:
+++修复导出图片和svg时关联线的箭头消失的问题。
+修复调整容器大小后回到根节点的操作异常的问题。
+修复插入概要、上移、下移、一键整理布局的快捷键操作没有触发data_change事件的问题。
+
新增:
+++优化画布DOM结构,将节点、连线、关联线分层渲染。
+优化水印插件。
+setTheme、setThemeConfig、setLayout函数增加不触发重新渲染的参数。
+新增插入父节点的命令。
+新增仅删除当前节点的命令。
+插入概要时自动展开子节点。
+鼠标右键单击画布时清除当前激活节点。
+被收起的激活节点同步从激活节点列表里删除。
+粘贴带换行的文本支持控制是否按换行分割节点。
+
Demo:
++修改回到根节点的方法及文案。
+修复覆盖方式切换主题时第一次切换不生效的问题。
+右键菜单新增插入父节点和仅删除当前节点的功能。
+顶部工具栏支持根据窗口宽度自动收起到更多中。
+支持手动输入缩放倍数。
+完善界面英文翻译。
+
修复协同编辑的一些问题:
1.插入同级节点时新节点位置不正确;
diff --git a/web/src/pages/Doc/zh/constructor/index.md b/web/src/pages/Doc/zh/constructor/index.md index 7b3080ef..f92d6aac 100644 --- a/web/src/pages/Doc/zh/constructor/index.md +++ b/web/src/pages/Doc/zh/constructor/index.md @@ -82,7 +82,8 @@ const mindMap = new MindMap({ | errorHandler(v0.6.15+) | Function | | 自定义错误处理函数,目前只会抛出一些异步逻辑出错的情况。可以传递一个函数,会接收两个参数,第一个为错误的类型,第二个为错误对象 | | disableMouseWheelZoom(v0.6.15+) | Boolean | false | 禁止鼠标滚轮缩放,你仍旧可以使用api进行缩放 | | resetCss(v0.6.16+) | String | * { margin: 0; padding: 0; box-sizing: border-box; } | 设置导出图片和svg时,针对富文本节点内容,也就是嵌入到svg中的html节点的默认样式覆盖,如果不覆盖,节点内容会发生偏移 | -| enableDblclickReset(v0.6.17+) | Boolean | true(v0.7.0+改为false) | 开启鼠标双击复位思维导图位置及缩放 | +| enableDblclickReset(v0.6.17+)(v0.8.0+已删除该属性) | Boolean | true(v0.7.0+改为false) | 开启鼠标双击复位思维导图位置及缩放 | +| enableDblclickBackToRootNode(v0.8.0+) | Boolean | false | 是否在鼠标双击时回到根节点,也就是让根节点居中显示 | | minExportImgCanvasScale(v0.7.0+) | Number | 2 | 导出图片和pdf时canvas的缩放倍数,该配置会和window.devicePixelRatio值取最大值,用于提升图片清晰度 | | hoverRectColor(v0.7.0+) | String | rgb(94, 200, 248) | 节点鼠标hover和激活时显示的矩形边框颜色,hover时会添加0.6的透明度 | | hoverRectPadding(v0.7.0+) | Number | 2 | 节点鼠标hover和激活时显示的矩形边框距节点内容的距离 | @@ -95,6 +96,9 @@ const mindMap = new MindMap({ | dragOpacityConfig(v0.7.2+) | Object | { cloneNodeOpacity: 0.5, beingDragNodeOpacity: 0.3 } | 节点拖拽时的透明度配置,传递一个对象,字段含义分别为:跟随鼠标移动的克隆节点或矩形的透明度、被拖拽节点的透明度 | | tagsColorMap(v0.7.2+) | Object | {} | 自定义节点标签的颜色,可传一个对象,key为要指定颜色的标签内容,value为该标签内容的颜色,如果不传内部会根据标签内容生成对应的颜色 | | cooperateStyle(v0.7.3+) | Object | { avatarSize: 22, fontSize: 12 } | 节点协作编辑时的人员头像样式配置,字段含义分别为:头像大小、如果是文字头像,那么文字的大小 | +| associativeLineIsAlwaysAboveNode(v0.8.0+) | Boolean | true | 关联线是否始终显示在节点上层,如果设为false,那么创建关联线和激活关联线时处于最顶层,其他情况下处于节点下方 | +| defaultGeneralizationText(v0.8.0+) | String | 概要 | 插入概要的默认文本 | +| handleIsSplitByWrapOnPasteCreateNewNode(v0.8.0+) | Function | null | null | 粘贴文本的方式创建新节点时,控制是否按换行自动分割节点,即如果存在换行,那么会根据换行创建多个节点,否则只会创建一个节点,可以传递一个函数,返回promise,resolve代表根据换行分割,reject代表忽略换行 | ### 数据结构 @@ -210,8 +214,96 @@ mindMap.setTheme('主题名称') 当前注册的所有插件列表。 +## 实例属性 + +### el + +容器元素。 + +### opt + +配置选项对象。 + +### svg + +> @svgdotjs/svg.js库调用SVG()方法返回的节点实例 + +画布svg元素。 + +### draw + +> @svgdotjs/svg.js库调用group()方法返回的节点实例 +> +> svg节点的子节点 + +容器元素,用于承载节点、连线等内容。 + +### lineDraw + +> v0.8.0+ +> +> @svgdotjs/svg.js库调用group()方法返回的节点实例 +> +> draw节点的子节点 + +节点连线元素的容器。 + +### nodeDraw + +> v0.8.0+ +> +> @svgdotjs/svg.js库调用group()方法返回的节点实例 +> +> draw节点的子节点 + +节点元素的容器。 + +### associativeLineDraw + +> v0.8.0+ +> +> @svgdotjs/svg.js库调用group()方法返回的节点实例 +> +> 在注册了关联线插件的情况下可用 +> +> draw节点的子节点 + +关联线内容的容器。 + +### otherDraw + +> v0.8.0+ +> +> @svgdotjs/svg.js库调用group()方法返回的节点实例 +> +> draw节点的子节点 + +其他内容的容器。 + +### elRect + +容器元素`el`的尺寸、位置信息。调用`getBoundingClientRect()`方法的返回结果。 + +### width + +容器元素`el`的宽度。 + +### height + +容器元素`el`的高度。 + +### themeConfig + +当前主题配置。 + ## 实例方法 +### clearDraw() + +> v0.8.0+ + +清空`lineDraw`、`associativeLineDraw`、`nodeDraw`、`otherDraw`容器。 + ### destroy() > v0.6.0+ @@ -318,7 +410,9 @@ mindMap.setTheme('主题名称') 解绑事件 -### setTheme(theme) +### setTheme(theme, notRender = false) + +- `notRender`:v0.8.0+,是否不要调用render方法更新画布。 切换主题,可选主题见上面的选项表格 @@ -326,7 +420,9 @@ mindMap.setTheme('主题名称') 获取当前主题 -### setThemeConfig(config) +### setThemeConfig(config, notRender = false) + +- `notRender`:v0.8.0+,是否不要调用render方法更新画布。 设置主题配置,`config`同上面选项表格里的选项`themeConfig` @@ -366,7 +462,9 @@ mindMap.updateConfig({ 获取当前的布局结构 -### setLayout(layout) +### setLayout(layout, notRender = false) + +- `notRender`:v0.8.0+,是否不要调用render方法更新画布。 设置布局结构,可选值见上面选项表格的`layout`字段 @@ -413,6 +511,8 @@ mindMap.updateConfig({ | INSERT_MULTI_NODE(v0.7.2+) | 给指定的节点同时插入多个同级节点,操作节点为当前激活的节点或指定节点 | appointNodes(可选,指定节点,指定多个节点可以传一个数组), nodeList(新插入节点的数据列表,数组类型) | | INSERT_MULTI_CHILD_NODE(v0.7.2+) | 给指定的节点同时插入多个子节点,操作节点为当前激活的节点或指定节点 | appointNodes(可选,指定节点,指定多个节点可以传一个数组), childList(新插入节点的数据列表,数组类型) | | INSERT_FORMULA(v0.7.2+) | 给节点插入数学公式,操作节点为当前激活的节点或指定节点 | formula(要插入的数学公式,LaText语法), appointNodes(可选,指定要插入公式的节点,多个节点可以传数组,否则默认为当前激活的节点) | +| INSERT_PARENT_NODE(v0.8.0+) | 给指定的节点插入父节点,操作节点为当前激活的节点或指定节点 | openEdit(是否激活新插入的节点并进入编辑模式,默认为`true`)、 appointNodes(可选,指定要插入父节点的节点,指定多个节点可以传一个数组)、 appointData(可选,指定新创建节点的数据,比如{text: 'xxx', ...},详细结构可以参考[exampleData.js](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/example/exampleData.js)) | +| REMOVE_CURRENT_NODE(v0.8.0+) | 仅删除当前节点,操作节点为当前激活的节点或指定节点 | appointNodes(可选,指定要删除的节点,指定多个节点可以传一个数组) | ### setData(data) diff --git a/web/src/pages/Doc/zh/constructor/index.vue b/web/src/pages/Doc/zh/constructor/index.vue index 36dd2044..f03a1065 100644 --- a/web/src/pages/Doc/zh/constructor/index.vue +++ b/web/src/pages/Doc/zh/constructor/index.vue @@ -376,12 +376,18 @@v0.3.0+
当前注册的所有插件列表。
+容器元素。
+配置选项对象。
+++@svgdotjs/svg.js库调用SVG()方法返回的节点实例
+
画布svg元素。
+++@svgdotjs/svg.js库调用group()方法返回的节点实例
+svg节点的子节点
+
容器元素,用于承载节点、连线等内容。
+++v0.8.0+
+@svgdotjs/svg.js库调用group()方法返回的节点实例
+draw节点的子节点
+
节点连线元素的容器。
+++v0.8.0+
+@svgdotjs/svg.js库调用group()方法返回的节点实例
+draw节点的子节点
+
节点元素的容器。
+++v0.8.0+
+@svgdotjs/svg.js库调用group()方法返回的节点实例
+在注册了关联线插件的情况下可用
+draw节点的子节点
+
关联线内容的容器。
+++v0.8.0+
+@svgdotjs/svg.js库调用group()方法返回的节点实例
+draw节点的子节点
+
其他内容的容器。
+容器元素el的尺寸、位置信息。调用getBoundingClientRect()方法的返回结果。
容器元素el的宽度。
容器元素el的高度。
当前主题配置。
++v0.8.0+
+
清空lineDraw、associativeLineDraw、nodeDraw、otherDraw容器。
v0.6.0+
@@ -860,11 +942,17 @@ mindMap.setTheme('主题名称')触发事件,可以是上面表格里的事件,也可以是自定义事件
off(event, fn)
解绑事件
-setTheme(theme)
+setTheme(theme, notRender = false)
++
- +
notRender:v0.8.0+,是否不要调用render方法更新画布。切换主题,可选主题见上面的选项表格
getTheme()
获取当前主题
-setThemeConfig(config)
+setThemeConfig(config, notRender = false)
++
- +
notRender:v0.8.0+,是否不要调用render方法更新画布。设置主题配置,
config同上面选项表格里的选项themeConfiggetCustomThemeConfig()
获取自定义主题配置
@@ -889,7 +977,10 @@ mindMap.setTheme('主题名称')该方法只做更新配置的事情,没有其他副作用,比如触发画布重新渲染之类的
getLayout()
获取当前的布局结构
-setLayout(layout)
+setLayout(layout, notRender = false)
++
- +
notRender:v0.8.0+,是否不要调用render方法更新画布。设置布局结构,可选值见上面选项表格的
layout字段execCommand(name, ...args)
执行命令,每执行一个命令就会在历史堆栈里添加一条记录用于回退或前进。所有命令如下:
@@ -1087,6 +1178,16 @@ mindMap.setTheme('主题名称')给节点插入数学公式,操作节点为当前激活的节点或指定节点 formula(要插入的数学公式,LaText语法), appointNodes(可选,指定要插入公式的节点,多个节点可以传数组,否则默认为当前激活的节点) ++ +INSERT_PARENT_NODE(v0.8.0+) +给指定的节点插入父节点,操作节点为当前激活的节点或指定节点 +openEdit(是否激活新插入的节点并进入编辑模式,默认为 +true)、 appointNodes(可选,指定要插入父节点的节点,指定多个节点可以传一个数组)、 appointData(可选,指定新创建节点的数据,比如{text: 'xxx', ...},详细结构可以参考exampleData.js)+ REMOVE_CURRENT_NODE(v0.8.0+) +仅删除当前节点,操作节点为当前激活的节点或指定节点 +appointNodes(可选,指定要删除的节点,指定多个节点可以传一个数组) +setData(data)
diff --git a/web/src/pages/Doc/zh/node/index.md b/web/src/pages/Doc/zh/node/index.md index d3af436f..7c02538c 100644 --- a/web/src/pages/Doc/zh/node/index.md +++ b/web/src/pages/Doc/zh/node/index.md @@ -56,6 +56,14 @@ ## 方法 +### updateNodeByActive(active) + +> v0.8.0+ + +- `active`:Boolean,激活状态。 + +根据是否激活更新节点。主要是更新节点的展开收起按钮的显示隐藏。 + ### setOpacity(val) > v0.7.2+ diff --git a/web/src/pages/Doc/zh/node/index.vue b/web/src/pages/Doc/zh/node/index.vue index acbf5a30..3166063f 100644 --- a/web/src/pages/Doc/zh/node/index.vue +++ b/web/src/pages/Doc/zh/node/index.vue @@ -31,6 +31,14 @@
节点是否正在拖拽中
++v0.8.0+
+
active:Boolean,激活状态。根据是否激活更新节点。主要是更新节点的展开收起按钮的显示隐藏。
v0.7.2+
diff --git a/web/src/pages/Doc/zh/render/index.md b/web/src/pages/Doc/zh/render/index.md index b6162941..64082bfb 100644 --- a/web/src/pages/Doc/zh/render/index.md +++ b/web/src/pages/Doc/zh/render/index.md @@ -1,19 +1,25 @@ # Render实例 -`render`实例负载整个渲染过程,可通过`mindMap.renderer`获取到 +`render`实例负载整个渲染过程,可通过`mindMap.renderer`获取到。 ## 属性 ### activeNodeList -获取当前激活的节点列表 +获取当前激活的节点列表。 ### root -获取节点树的根节点 +获取节点树的根节点。 ## 方法 +### setRootNodeCenter() + +> v0.8.0+ + +回到中心主题,即设置根节点到画布中心。 + ### setData(data) > v0.7.3+ @@ -22,67 +28,103 @@ ### clearActive() -清除当前激活的节点 +> v0.8.0+已废弃 + +清除当前激活的节点。 ### clearAllActive() -清除当前所有激活节点,并会触发`node_active`事件 +> v0.8.0+已废弃 + +清除当前所有激活节点,并会触发`node_active`事件 。 + +### clearActiveNode() + +> v0.8.0+ + +清除当前所有激活节点,并会触发`node_active`事件 。 + +### clearActiveNodeList() + +> v0.8.0+ + +清除当前激活的节点列表。不会触发`node_active`事件 。 ### startTextEdit() -(v0.1.6+)若有文字编辑需求可调用该方法,会禁用回车键和删除键相关快捷键防止冲突 +> v0.1.6+ + +若有文字编辑需求可调用该方法,会禁用回车键和删除键相关快捷键防止冲突 。 ### endTextEdit() -(v0.1.6+)结束文字编辑,会恢复回车键和删除键相关快捷键 +> v0.1.6+ + +结束文字编辑,会恢复回车键和删除键相关快捷键。 ### addActiveNode(node) -添加节点到激活列表里 +> v0.8.0+已废弃 + +添加节点到激活列表里。 + +### addNodeToActiveList(node) + +> v0.8.0+ + +添加节点到激活列表里。 ### removeActiveNode(node) -在激活列表里移除某个节点 +> v0.8.0+已废弃 + +在激活列表里移除某个节点。 + +### removeNodeFromActiveList(node) + +> v0.8.0+ + +在激活列表里移除某个节点。 ### findActiveNodeIndex(node) -检索某个节点在激活列表里的索引 +检索某个节点在激活列表里的索引。 ### getNodeIndex(node) -获取节点在同级里的位置索引 +获取节点在同级里的位置索引。 ### removeOneNode(node) -删除某个指定节点 +删除某个指定节点。 ### copyNode() -复制节点,操作节点为当前激活节点,有多个激活节点只会操作第一个节点 +复制节点,操作节点为当前激活节点,有多个激活节点只会操作第一个节点。 ### setNodeDataRender(node, data, notRender) - `notRender`:v0.6.9+,`Boolean`,默认为`false`,是否不要触发渲染。 -设置节点数据,即`data`字段的数据,并会根据节点大小是否变化来判断是否需要重新渲染该节点,`data`为对象,如:`{text: '我是新文本'}` +设置节点数据,即`data`字段的数据,并会根据节点大小是否变化来判断是否需要重新渲染该节点,`data`为对象,如:`{text: '我是新文本'}`。 ### moveNodeTo(node, toNode) > v0.1.5+ -移动一个节点作为另一个节点的子节点 +移动一个节点作为另一个节点的子节点。 ### insertBefore(node, exist) > v0.1.5+ -将节点移动到另一个节点的前面 +将节点移动到另一个节点的前面。 ### insertAfter(node, exist) > v0.1.5+ -将节点移动到另一个节点的后面 +将节点移动到另一个节点的后面。 ### moveNodeToCenter(node) diff --git a/web/src/pages/Doc/zh/render/index.vue b/web/src/pages/Doc/zh/render/index.vue index 6c23b515..6cc35ee9 100644 --- a/web/src/pages/Doc/zh/render/index.vue +++ b/web/src/pages/Doc/zh/render/index.vue @@ -1,58 +1,101 @@Render实例
-+
render实例负载整个渲染过程,可通过mindMap.renderer获取到
render实例负载整个渲染过程,可通过mindMap.renderer获取到。属性
activeNodeList
-获取当前激活的节点列表
+获取当前激活的节点列表。
root
-获取节点树的根节点
+获取节点树的根节点。
方法
+setRootNodeCenter()
+++v0.8.0+
+回到中心主题,即设置根节点到画布中心。
setData(data)
v0.7.3+
动态设置思维导图数据。
clearActive()
-清除当前激活的节点
+++v0.8.0+已废弃
+清除当前激活的节点。
clearAllActive()
-清除当前所有激活节点,并会触发
+node_active事件++v0.8.0+已废弃
+清除当前所有激活节点,并会触发
+node_active事件 。clearActiveNode()
+++v0.8.0+
+清除当前所有激活节点,并会触发
+node_active事件 。clearActiveNodeList()
+++v0.8.0+
+清除当前激活的节点列表。不会触发
node_active事件 。startTextEdit()
-(v0.1.6+)若有文字编辑需求可调用该方法,会禁用回车键和删除键相关快捷键防止冲突
+++v0.1.6+
+若有文字编辑需求可调用该方法,会禁用回车键和删除键相关快捷键防止冲突 。
endTextEdit()
-(v0.1.6+)结束文字编辑,会恢复回车键和删除键相关快捷键
+++v0.1.6+
+结束文字编辑,会恢复回车键和删除键相关快捷键。
addActiveNode(node)
-添加节点到激活列表里
+++v0.8.0+已废弃
+添加节点到激活列表里。
+addNodeToActiveList(node)
+++v0.8.0+
+添加节点到激活列表里。
removeActiveNode(node)
-在激活列表里移除某个节点
+++v0.8.0+已废弃
+在激活列表里移除某个节点。
+removeNodeFromActiveList(node)
+++v0.8.0+
+在激活列表里移除某个节点。
findActiveNodeIndex(node)
-检索某个节点在激活列表里的索引
+检索某个节点在激活列表里的索引。
getNodeIndex(node)
-获取节点在同级里的位置索引
+获取节点在同级里的位置索引。
removeOneNode(node)
-删除某个指定节点
+删除某个指定节点。
copyNode()
-复制节点,操作节点为当前激活节点,有多个激活节点只会操作第一个节点
+复制节点,操作节点为当前激活节点,有多个激活节点只会操作第一个节点。
setNodeDataRender(node, data, notRender)
-
notRender:v0.6.9+,Boolean,默认为false,是否不要触发渲染。设置节点数据,即
+data字段的数据,并会根据节点大小是否变化来判断是否需要重新渲染该节点,data为对象,如:{text: '我是新文本'}设置节点数据,即
data字段的数据,并会根据节点大小是否变化来判断是否需要重新渲染该节点,data为对象,如:{text: '我是新文本'}。moveNodeTo(node, toNode)
-v0.1.5+
移动一个节点作为另一个节点的子节点
+移动一个节点作为另一个节点的子节点。
insertBefore(node, exist)
-v0.1.5+
将节点移动到另一个节点的前面
+将节点移动到另一个节点的前面。
insertAfter(node, exist)
-v0.1.5+
将节点移动到另一个节点的后面
+将节点移动到另一个节点的后面。
moveNodeToCenter(node)
v0.2.17+
diff --git a/web/src/pages/Doc/zh/richText/index.md b/web/src/pages/Doc/zh/richText/index.md index 4c59770a..2e20ac5f 100644 --- a/web/src/pages/Doc/zh/richText/index.md +++ b/web/src/pages/Doc/zh/richText/index.md @@ -68,6 +68,14 @@ MindMap.usePlugin(RichText, opt?) ## 方法 +### setNotActiveNodeStyle(node, style) + +> v0.8.0+ + +- `style`:Object,样式对象。 + +给未激活的节点设置富文本样式。 + ### selectAll() 选中全部。当节点正在编辑中可以通过该方法选中节点内的所有文本。 diff --git a/web/src/pages/Doc/zh/richText/index.vue b/web/src/pages/Doc/zh/richText/index.vue index dd71a9ed..b1de90a4 100644 --- a/web/src/pages/Doc/zh/richText/index.vue +++ b/web/src/pages/Doc/zh/richText/index.vue @@ -56,6 +56,14 @@ MindMap.usePlugin(RichText, opt?)[1, 2, 3, ...100]方法
+setNotActiveNodeStyle(node, style)
+++v0.8.0+
++
+- +
style:Object,样式对象。给未激活的节点设置富文本样式。
selectAll()
选中全部。当节点正在编辑中可以通过该方法选中节点内的所有文本。
focus()
diff --git a/web/src/pages/Doc/zh/utils/index.md b/web/src/pages/Doc/zh/utils/index.md index 799eea8b..745c5e45 100644 --- a/web/src/pages/Doc/zh/utils/index.md +++ b/web/src/pages/Doc/zh/utils/index.md @@ -358,6 +358,45 @@ copyNodeTree({}, node) 判断两个对象是否相同,只处理对象或数组。 +#### getNodeDataIndex(node) + +> v0.8.0+ + +获取节点在兄弟节点中的位置索引。 + +#### getNodeIndexInNodeList(node, nodeList) + +> v0.8.0+ + +从一个节点列表里找出某个节点的索引。 + +#### setDataToClipboard(data) + +> v0.8.0+ + +- `data`:Object | Array + +将数据设置到用户剪切板中。 + +#### getDataFromClipboard() + +> v0.8.0+ + +从用户剪贴板中读取文字和图片,返回: + +```js +{ + text, + img +} +``` + +#### removeFromParentNodeData(node) + +> v0.8.0+ + +从节点的父节点的`nodeData.children`列表中移除该节点的数据。 + ## 在canvas中模拟css的背景属性 引入: diff --git a/web/src/pages/Doc/zh/utils/index.vue b/web/src/pages/Doc/zh/utils/index.vue index 8e2822d5..d0f7d18b 100644 --- a/web/src/pages/Doc/zh/utils/index.vue +++ b/web/src/pages/Doc/zh/utils/index.vue @@ -290,6 +290,39 @@a、b:Object | Array, 要进行对比的两个对象判断两个对象是否相同,只处理对象或数组。
+getNodeDataIndex(node)
+++v0.8.0+
+获取节点在兄弟节点中的位置索引。
+getNodeIndexInNodeList(node, nodeList)
+++v0.8.0+
+从一个节点列表里找出某个节点的索引。
+setDataToClipboard(data)
+++v0.8.0+
++
+- +
data:Object | Array将数据设置到用户剪切板中。
+getDataFromClipboard()
+++v0.8.0+
+从用户剪贴板中读取文字和图片,返回:
++{ + text, + img +} +removeFromParentNodeData(node)
+++v0.8.0+
+从节点的父节点的
nodeData.children列表中移除该节点的数据。在canvas中模拟css的背景属性
引入:
import drawBackgroundImageToCanvas from 'simple-mind-map/src/utils/simulateCSSBackgroundInCanvas'