From 658b47b72edaedffbee37dbec2ff00e1d5107ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Wed, 3 Jul 2024 11:07:50 +0800 Subject: [PATCH] Doc: update --- README.md | 4 +- simple-mind-map/package.json | 2 +- simple-mind-map/src/themes/default.js | 2 +- web/src/pages/Doc/catalogList.js | 1 + web/src/pages/Doc/en/changelog/index.md | 46 ++++++++ web/src/pages/Doc/en/changelog/index.vue | 31 ++++++ web/src/pages/Doc/en/constructor/index.md | 7 +- web/src/pages/Doc/en/constructor/index.vue | 25 ++++- web/src/pages/Doc/en/introduction/index.md | 4 +- web/src/pages/Doc/en/introduction/index.vue | 4 +- web/src/pages/Doc/en/miniMap/index.md | 27 +++-- web/src/pages/Doc/en/miniMap/index.vue | 21 +++- web/src/pages/Doc/en/outerFrame/index.md | 89 ++++++++++++++++ web/src/pages/Doc/en/outerFrame/index.vue | 112 ++++++++++++++++++++ web/src/pages/Doc/en/utils/index.md | 6 +- web/src/pages/Doc/en/utils/index.vue | 10 +- web/src/pages/Doc/routerList.js | 2 + web/src/pages/Doc/zh/changelog/index.md | 46 ++++++++ web/src/pages/Doc/zh/changelog/index.vue | 31 ++++++ web/src/pages/Doc/zh/constructor/index.md | 7 +- web/src/pages/Doc/zh/constructor/index.vue | 22 +++- web/src/pages/Doc/zh/course14/index.md | 28 ++++- web/src/pages/Doc/zh/course14/index.vue | 20 +++- web/src/pages/Doc/zh/introduction/index.md | 4 +- web/src/pages/Doc/zh/introduction/index.vue | 36 +++---- web/src/pages/Doc/zh/miniMap/index.md | 24 ++++- web/src/pages/Doc/zh/miniMap/index.vue | 20 +++- web/src/pages/Doc/zh/outerFrame/index.md | 89 ++++++++++++++++ web/src/pages/Doc/zh/outerFrame/index.vue | 112 ++++++++++++++++++++ web/src/pages/Doc/zh/utils/index.md | 6 +- web/src/pages/Doc/zh/utils/index.vue | 10 +- 31 files changed, 785 insertions(+), 63 deletions(-) create mode 100644 web/src/pages/Doc/en/outerFrame/index.md create mode 100644 web/src/pages/Doc/en/outerFrame/index.vue create mode 100644 web/src/pages/Doc/zh/outerFrame/index.md create mode 100644 web/src/pages/Doc/zh/outerFrame/index.vue diff --git a/README.md b/README.md index ccd202a3..f0f8ff03 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Github:[releases](https://github.com/wanglin2/mind-map/releases)。百度云 # 特性 - [x] 插件化架构,除核心功能外,其他功能作为插件提供,按需使用,减小打包体积 -- [x] 支持逻辑结构图、思维导图、组织结构图、目录组织图、时间轴(横向、竖向)、鱼骨图等结构 +- [x] 支持逻辑结构图(向左、向右逻辑结构图)、思维导图、组织结构图、目录组织图、时间轴(横向、竖向)、鱼骨图等结构 - [x] 内置多种主题,允许高度自定义样式,支持注册新主题 - [x] 节点内容支持文本(普通文本、富文本)、图片、图标、超链接、备注、标签、概要、数学公式 - [x] 节点支持拖拽(拖拽移动、自由调整)、多种节点形状;支持扩展节点内容、支持使用 DDM 完全自定义节点内容 @@ -42,7 +42,7 @@ Github:[releases](https://github.com/wanglin2/mind-map/releases)。百度云 官方提供了如下插件,可根据需求按需引入(某个功能不生效大概率是因为你没有引入对应的插件),具体使用方式请查看文档: -> RichText(节点富文本插件)、Select(鼠标多选节点插件)、Drag(节点拖拽插件)、AssociativeLine(关联线插件)、Export(导出插件)、KeyboardNavigation(键盘导航插件)、MiniMap(小地图插件)、Watermark(水印插件)、TouchEvent(移动端触摸事件支持插件)、NodeImgAdjust(拖拽调整节点图片大小插件)、Search(搜索插件)、Painter(节点格式刷插件)、Scrollbar(滚动条插件)、Formula(数学公式插件)、Cooperate(协同编辑插件)、RainbowLines(彩虹线条插件)、Demonstrate(演示模式插件)、HandDrawnLikeStyle(手绘风格插件)[收费]、Notation(节点标记插件)[收费] +> RichText(节点富文本插件)、Select(鼠标多选节点插件)、Drag(节点拖拽插件)、AssociativeLine(关联线插件)、Export(导出插件)、KeyboardNavigation(键盘导航插件)、MiniMap(小地图插件)、Watermark(水印插件)、TouchEvent(移动端触摸事件支持插件)、NodeImgAdjust(拖拽调整节点图片大小插件)、Search(搜索插件)、Painter(节点格式刷插件)、Scrollbar(滚动条插件)、Formula(数学公式插件)、Cooperate(协同编辑插件)、RainbowLines(彩虹线条插件)、Demonstrate(演示模式插件)、OuterFrame(外框插件)、HandDrawnLikeStyle(手绘风格插件)[收费]、Notation(节点标记插件)[收费] 本项目不会实现的特性: diff --git a/simple-mind-map/package.json b/simple-mind-map/package.json index 30c68cdd..e0d674bb 100644 --- a/simple-mind-map/package.json +++ b/simple-mind-map/package.json @@ -1,6 +1,6 @@ { "name": "simple-mind-map", - "version": "0.10.1", + "version": "0.10.2", "description": "一个简单的web在线思维导图", "authors": [ { diff --git a/simple-mind-map/src/themes/default.js b/simple-mind-map/src/themes/default.js index 032a896c..3b9edea0 100644 --- a/simple-mind-map/src/themes/default.js +++ b/simple-mind-map/src/themes/default.js @@ -20,7 +20,7 @@ export default { lineStyle: 'straight', // 曲线(curve)【仅支持logicalStructure、mindMap、verticalTimeline三种结构】、直线(straight)、直连(direct)【仅支持logicalStructure、mindMap、organizationStructure、verticalTimeline四种结构】 // 曲线连接时,根节点和其他节点的连接线样式保持统一,默认根节点为 ( 型,其他节点为 { 型,设为true后,都为 { 型。仅支持logicalStructure、mindMap两种结构 rootLineKeepSameInCurve: true, - // 曲线连接时,根节点和其他节点的连线起始位置保持统一,默认根节点的连线起始位置在节点中心,其他节点在节点右侧,如果该配置设为true,那么根节点的连线起始位置也会在节点右侧 + // 曲线连接时,根节点和其他节点的连线起始位置保持统一,默认根节点的连线起始位置在节点中心,其他节点在节点右侧(或左侧),如果该配置设为true,那么根节点的连线起始位置也会在节点右侧(或左侧) rootLineStartPositionKeepSameInCurve: false, // 直线连接(straight)时,连线的圆角大小,设置为0代表没有圆角,仅支持logicalStructure、mindMap、verticalTimeline三种结构 lineRadius: 5, diff --git a/web/src/pages/Doc/catalogList.js b/web/src/pages/Doc/catalogList.js index 33f8b46d..df3770e3 100644 --- a/web/src/pages/Doc/catalogList.js +++ b/web/src/pages/Doc/catalogList.js @@ -42,6 +42,7 @@ let APIList = [ 'handDrawnLikeStyle', 'demonstrate', 'notation', + 'outerFrame', 'xmind', 'markdown', 'utils' diff --git a/web/src/pages/Doc/en/changelog/index.md b/web/src/pages/Doc/en/changelog/index.md index 6674a30c..16beebed 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.10.2 + +> 2024.7.3 + +Fix: + +> 1.Fix the issue of node text and custom content with the createNodePrefixContent option not being vertically centered; +> +> 2.Fix the issue of selecting node text when dragging the endpoints of associated lines; + +New: + +> 1.Add external frame plugins; +> +> 2.Add a leftward logical structure diagram; +> +> 3.The mini map supports dragging and dropping view boxes to adjust the canvas position; +> +> 4.Add an instantiation option to intercept nodes and start dragging them; +> +> 5.Prevent default behavior for mousedown, mousemove, drag, and node.mousedown events; +> +> 6.The beforeDragEnd option of the drag plugin adds a callback parameter to the list of nodes that are currently being dragged; +> +> 7.Add an instantiation option that prohibits reading and writing to the user's clipboard; +> +> 8.Independently separate the canvas automatic movement function of the Select plugin to solve the problem of the Drag plugin being unable to use the canvas automatic movement function without registering the Select plugin; +> +> 9.Add callback parameters to the edited node for the hide_text_edit event; +> +> 10.Activate the node when clicking on the hyperlink icon; Add instantiation options for custom hyperlink redirection; + +Demo: + +> 1.Color selection supports transparency selection; +> +> 2.Add external frame setting function; +> +> 3.Add copy to clipboard function in the right-click menu; +> +> 4.Add a leftward logical structure diagram; +> +> 5.Fix the issue where the event does not end after the mouse is moved out of the mini map and then released; +> +> 6.The mini map supports dragging and dropping view boxes to adjust the canvas position; + ## 0.10.1 Fix: diff --git a/web/src/pages/Doc/en/changelog/index.vue b/web/src/pages/Doc/en/changelog/index.vue index e095e586..78aa2674 100644 --- a/web/src/pages/Doc/en/changelog/index.vue +++ b/web/src/pages/Doc/en/changelog/index.vue @@ -1,6 +1,37 @@ diff --git a/web/src/pages/Doc/en/outerFrame/index.md b/web/src/pages/Doc/en/outerFrame/index.md new file mode 100644 index 00000000..1dd77a7c --- /dev/null +++ b/web/src/pages/Doc/en/outerFrame/index.md @@ -0,0 +1,89 @@ +# OuterFrame plugin + +> v0.10.2+ + +This plugin is used to implement bounding box functionality. + +## Register + +```js +import MindMap from 'simple-mind-map' +import OuterFrame from 'simple-mind-map/src/plugins/OuterFrame.js' +MindMap.usePlugin(OuterFrame) +``` + +After registration and instantiation of `MindMap`, the instance can be obtained through `mindMap.outerFrame`. + +The application can refer to the code in this section of the demo: [NodeOuterFrame.vue](https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/components/NodeOuterFrame.vue)。 + +## Command + +This plugin will register the 'ADD_OUTER_FRAME' command with the mind map to add bounding boxes to nodes: + +```js +mindMap.execCommand('ADD_OUTER_FRAME', appointNodes, config = {}) +``` + +- `appointNodes`:Specify the node instance node to add the bounding box to, which can be a single node instance or an array of node instances. If passing '[]' or 'null', the bounding box will be added to the currently active node on the canvas + +- `config`:Outline configuration, object format, and fields are as follows: + +| Field | Type | Default | Desc | +| ------------------ | ------- | --------------- | ------------| +| radius | Number | 5 | Size of rounded corners on the outer frame | +| strokeWidth | Number | 2 | Outer border width | +| strokeColor | String | #0984e3 | Outer border color | +| strokeDasharray | String | 5,5 | Outer border dashed line | +| fill | String | rgba(9,132,227,0.05) | Outer frame fill color | + +## Event + +### outer_frame_active + +Triggered when clicking to activate a certain bounding box. The callback function takes three parameters: el(Outer frame elements,The rect element of library @svgdotjs/svg.js), node(The parent node instance of the node to which this scope belongs), range(Range interval, relative to node) + +The application can listen to this event to retrieve the currently activated bounding box, retrieve its configuration, and echo it to the page. Since the scope may contain multiple nodes, the first node instance is usually taken. If you want to retrieve the position of the bounding box on the page, you can call the 'el.rbox' method: + +```js +mindMap.on('outer_frame_active', (el, parentNode, range) => { + // Take the bounding box style of the first node within the range + const firstNode = parentNode.children[range[0]] + const firstNodeOuterFrame = firstNode.getData('outerFrame') + // Obtain the position and size information of the bounding box, where you can render your configuration float layer + const { x, y, width, height } = el.rbox() +}) +``` + +### outer_frame_delete + +Triggered when deleting the currently active bounding box on the canvas. + +## Methods + +### getActiveOuterFrame() + +Get the currently activated bounding box data. Return an object with the following structure: + +```js +{ + el, + node, + range +} +``` + +### updateActiveOuterFrame(config = {}) + +Update the currently active bounding box. After executing this method, please immediately hide your style panel as it will clear the currently active bounding box. + +### removeActiveOuterFrame() + +Delete the currently active bounding box. + +### getRangeNodeList(node, range) + +Get a list of boxed child nodes within a specified range of a node. + +### clearActiveOuterFrame() + +Clear the currently active bounding box. \ No newline at end of file diff --git a/web/src/pages/Doc/en/outerFrame/index.vue b/web/src/pages/Doc/en/outerFrame/index.vue new file mode 100644 index 00000000..620a0924 --- /dev/null +++ b/web/src/pages/Doc/en/outerFrame/index.vue @@ -0,0 +1,112 @@ + + + + + \ No newline at end of file diff --git a/web/src/pages/Doc/en/utils/index.md b/web/src/pages/Doc/en/utils/index.md index 3f629c59..06f510eb 100644 --- a/web/src/pages/Doc/en/utils/index.md +++ b/web/src/pages/Doc/en/utils/index.md @@ -101,7 +101,11 @@ and copying the `data` of the data object, example: copyNodeTree({}, node); ``` -#### imgToDataUrl(src) +#### imgToDataUrl(src, returnBlob = false) + +- `src`:Image url + +- `returnBlob`:v0.10.2+,Is the result returned in Blob format, defaulting to DataURL format Convert image to dataURL diff --git a/web/src/pages/Doc/en/utils/index.vue b/web/src/pages/Doc/en/utils/index.vue index 91443fdb..bca43834 100644 --- a/web/src/pages/Doc/en/utils/index.vue +++ b/web/src/pages/Doc/en/utils/index.vue @@ -66,7 +66,15 @@ basic data, otherwise it will throw an error

and copying the data of the data object, example:

copyNodeTree({}, node);
 
-

imgToDataUrl(src)

+

imgToDataUrl(src, returnBlob = false)

+

Convert image to dataURL

downloadFile(file, fileName)

Download file

diff --git a/web/src/pages/Doc/routerList.js b/web/src/pages/Doc/routerList.js index ae445be2..9c00f970 100644 --- a/web/src/pages/Doc/routerList.js +++ b/web/src/pages/Doc/routerList.js @@ -65,6 +65,7 @@ export default [ { path: 'cooperate', title: 'Cooperate插件' }, { path: 'rainbowLines', title: 'RainbowLines插件' }, { path: 'demonstrate', title: 'Demonstrate插件' }, + { path: 'outerFrame', title: 'OuterFrame插件' }, { path: 'handDrawnLikeStyle', title: 'HandDrawnLikeStyle收费插件' }, { path: 'notation', title: 'Notation收费插件' }, { path: 'help1', title: '概要/关联线' }, @@ -111,6 +112,7 @@ export default [ { path: 'cooperate', title: 'Cooperate plugin' }, { path: 'rainbowLines', title: 'RainbowLines plugin' }, { path: 'demonstrate', title: 'Demonstrate plugin' }, + { path: 'outerFrame', title: 'OuterFrame plugin' }, { path: 'handDrawnLikeStyle', title: 'HandDrawnLikeStyle chargeable plugin' diff --git a/web/src/pages/Doc/zh/changelog/index.md b/web/src/pages/Doc/zh/changelog/index.md index e3a84b32..3eb4a8fe 100644 --- a/web/src/pages/Doc/zh/changelog/index.md +++ b/web/src/pages/Doc/zh/changelog/index.md @@ -1,5 +1,51 @@ # Changelog +## 0.10.2 + +> 2024.7.3 + +修复: + +> 1.修复节点文本和createNodePrefixContent选项自定义的内容没有垂直居中的问题; +> +> 2.修复拖动关联线端点移动时会选中节点文字的问题; + +新增: + +> 1.新增外框插件; +> +> 2.新增向左逻辑结构图; +> +> 3.小地图支持拖拽视图框调整画布位置; +> +> 4.新增拦截节点开始拖拽的实例化选项; +> +> 5.阻止mousedown、mousemove、drag、node_mousedown事件的默认行为; +> +> 6.drag插件的beforeDragEnd选项新增当前被拖拽的节点列表的回调参数; +> +> 7.新增禁止读取和写入用户剪贴板的实例化选项; +> +> 8.将Select插件的画布自动移动功能独立出来,解决没有注册Select插件的情况下Drag插件无法使用画布自动移动功能的问题; +> +> 9.hide_text_edit事件增加被编辑节点的回调参数; +> +> 10.点击超链接图标时激活节点;新增自定义超链接跳转的实例化选项; + +Demo: + +> 1.颜色选择支持选择透明度; +> +> 2.新增外框设置功能; +> +> 3.右键菜单新增复制到剪贴板功能; +> +> 4.新增向左逻辑结构图; +> +> 5.修复鼠标移出小地图再松开后事件没有结束的问题; +> +> 6.小地图支持拖拽视图框调整画布位置; + ## 0.10.1 修复: diff --git a/web/src/pages/Doc/zh/changelog/index.vue b/web/src/pages/Doc/zh/changelog/index.vue index 0f748243..3630e5bc 100644 --- a/web/src/pages/Doc/zh/changelog/index.vue +++ b/web/src/pages/Doc/zh/changelog/index.vue @@ -1,6 +1,37 @@