From 0bdf9f3add759c10238fbb2100cb64e19e982491 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Wed, 2 Aug 2023 18:48:08 +0800 Subject: [PATCH 01/67] =?UTF-8?q?Fix:=E4=BF=AE=E5=A4=8D=E5=BD=93=E6=80=9D?= =?UTF-8?q?=E7=BB=B4=E5=AF=BC=E5=9B=BE=E5=85=A8=E9=83=A8=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=8F=AF=E8=A7=86=E5=8C=BA=E5=9F=9F=E5=90=8E=E5=B0=8F=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E4=B8=AD=E7=9A=84=E6=8C=87=E7=A4=BA=E5=99=A8=E4=B9=9F?= =?UTF-8?q?=E4=BC=9A=E7=A7=BB=E9=99=A4=E5=B0=8F=E5=9C=B0=E5=9B=BE=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/MiniMap.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/simple-mind-map/src/plugins/MiniMap.js b/simple-mind-map/src/plugins/MiniMap.js index a4033584..07f8a462 100644 --- a/simple-mind-map/src/plugins/MiniMap.js +++ b/simple-mind-map/src/plugins/MiniMap.js @@ -55,19 +55,28 @@ class MiniMap { bottom: 0 } viewBoxStyle.left = - Math.max(0, (-_rectX / _rectWidth) * actWidth) + miniMapBoxLeft + 'px' + Math.max(0, (-_rectX / _rectWidth) * actWidth) + miniMapBoxLeft viewBoxStyle.right = Math.max(0, ((_rectX2 - origWidth) / _rectWidth) * actWidth) + - miniMapBoxLeft + - 'px' + miniMapBoxLeft viewBoxStyle.top = - Math.max(0, (-_rectY / _rectHeight) * actHeight) + miniMapBoxTop + 'px' + Math.max(0, (-_rectY / _rectHeight) * actHeight) + miniMapBoxTop viewBoxStyle.bottom = Math.max(0, ((_rectY2 - origHeight) / _rectHeight) * actHeight) + - miniMapBoxTop + - 'px' - + miniMapBoxTop + + if (viewBoxStyle.top > miniMapBoxTop + actHeight) { + viewBoxStyle.top = miniMapBoxTop + actHeight + } + if (viewBoxStyle.left > miniMapBoxLeft + actWidth) { + viewBoxStyle.left = miniMapBoxLeft + actWidth + } + + Object.keys(viewBoxStyle).forEach((key) => { + viewBoxStyle[key] = viewBoxStyle[key] + 'px' + }) + this.removeNodeContent(svg) return { svgHTML: svg.svg(), // 小地图html From 803c83ac4fffbc5f80675281e8152267ca0064b8 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Wed, 2 Aug 2023 19:05:15 +0800 Subject: [PATCH 02/67] =?UTF-8?q?Feat=EF=BC=9A=E8=8A=82=E7=82=B9=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=BB=93=E6=9D=9F=E4=BA=8B=E4=BB=B6node=5Fdragend?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9B=9E=E8=B0=83=E5=8F=82=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E8=8E=B7=E5=8F=96=E5=88=B0=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E5=88=B0=E8=8A=82=E7=82=B9=E7=9A=84uid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/Drag.js | 9 ++++++++- web/src/pages/Doc/en/constructor/index.md | 2 +- web/src/pages/Doc/en/constructor/index.vue | 2 +- web/src/pages/Doc/zh/constructor/index.md | 2 +- web/src/pages/Doc/zh/constructor/index.vue | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/simple-mind-map/src/plugins/Drag.js b/simple-mind-map/src/plugins/Drag.js index 78a4b8aa..1e54dd84 100644 --- a/simple-mind-map/src/plugins/Drag.js +++ b/simple-mind-map/src/plugins/Drag.js @@ -105,6 +105,9 @@ class Drag extends Base { this.node.isDrag = false this.node.show() this.removeCloneNode() + let overlapNodeUid = this.overlapNode ? this.overlapNode.nodeData.data.uid : '' + let prevNodeUid = this.prevNode ? this.prevNode.nodeData.data.uid : '' + let nextNodeUid = this.nextNode ? this.nextNode.nodeData.data.uid : '' // 存在重叠子节点,则移动作为其子节点 if (this.overlapNode) { this.mindMap.renderer.setNodeActive(this.overlapNode, false) @@ -134,7 +137,11 @@ class Drag extends Base { this.mindMap.render() } this.reset() - this.mindMap.emit('node_dragend') + this.mindMap.emit('node_dragend', { + overlapNodeUid, + prevNodeUid, + nextNodeUid + }) } // 创建克隆节点 diff --git a/web/src/pages/Doc/en/constructor/index.md b/web/src/pages/Doc/en/constructor/index.md index b5a3eaca..0292ac46 100644 --- a/web/src/pages/Doc/en/constructor/index.md +++ b/web/src/pages/Doc/en/constructor/index.md @@ -242,7 +242,7 @@ Listen to an event. Event list: | 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 | | +| 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) | diff --git a/web/src/pages/Doc/en/constructor/index.vue b/web/src/pages/Doc/en/constructor/index.vue index c8f70d61..ec3adc28 100644 --- a/web/src/pages/Doc/en/constructor/index.vue +++ b/web/src/pages/Doc/en/constructor/index.vue @@ -697,7 +697,7 @@ poor performance and should be used sparingly.
Fix:
+++1.Fix the issue where the indicator in the mini map will also move out of the mini map area when the mind map is completely moved out of the visible area.
+2.Fix the issue of overly sensitive dual finger scaling on the mobile end.
+3.Fix the issue of holding down nodes while dragging the canvas in read-only mode.
+4.Fix the issue of incorrect rendering of the mini map when the distance between the mind map and the top left corner of the browser window is not 0.
+5.Fix the issue of the prompt block being too large for the new location when moving nodes.
+6.Fix the issue where search cannot be replaced with empty characters.
+7.Fixed the issue of missing line breaks after searching and replacing in rich text mode.
+8.Fixed the issue of missing focus in the input box when clicking on text editing in the outline.
+
New:
+++1.Adding a callback parameter to the node move end event (node_drag) can obtain the uid of the move to the node.
+2.Support specifying the location to which internal elements are added through configuration.
+3.Support the format brush function.
+4.Under the curve style, the connection line style of the root node supports consistency with other nodes.
+5.Search supports continuous replacement.
+6.Add and delete button for node image.
+7.Support dragging the canvas while holding down the middle mouse button.
+
Demo:
++1.Provide an application takeover mode to facilitate docking with one's own storage services; Supports setting static resource paths at runtime.
+2.Refactoring outline: 1. No longer use the text style that comes with the node; 2. Support full screen editing of the outline; 3. The outline supports dragging and moving nodes; 4. The outline supports deleting nodes.
+3.Fix the issue of interface dark mode not updating in the scenario of importing data.
+
Fix: 1.Fixed the issue of invisible editing when node text is white.
false
Modify a style of the node, a shortcut method for the SET_NODE_STYLE command
++v0.6.12+
+
Modify multiple styles of nodes, a shortcut method for the SET_NODE_STYLES command
Get the specified value in the data object of the node's real data nodeData,
if key is not passed, return the data object
++v0.6.12+
+
Node format brush plugin.
+import MindMap from 'simple-mind-map'
+import Painter from 'simple-mind-map/src/plugins/Painter.js'
+MindMap.usePlugin(Painter)
+
+After registration and instantiation of MindMap, the instance can be obtained through mindMap.painter.
++You can use mindMap.on('event name', () => {}) method to listen events.
+
The event of painter start.
+The event of painter end.
+Start painter.
+After calling this method, if there is currently an active node, the first active node will be taken as the specified node by default. After clicking on other nodes, the style of that node will be applied to the other nodes being clicked. When clicking on the canvas, the format brushing operation ends.
+ +Search for node content, which can be called repeatedly. Each call will search and locate to the next matching node. If the search text changes, it will be searched again.
End search.
-replaceText: Text to be replacedreplaceText: Text to be replaced
jumpNext: v0.6.12+, Whether to automatically jump to the next matching node
To replace the content of the current node, call the 'search' method after calling it to replace the content of the currently located matching node.
` into text wrapped in `
`.
+
+#### textToNodeRichTextWithWrap(html)
+
+> v0.6.12+
+
+Convert the wrapped text of `
` into node rich text content in the form of `
`.
+
## 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 1fa4504b..52d8b6fd 100644
--- a/web/src/pages/Doc/en/utils/index.vue
+++ b/web/src/pages/Doc/en/utils/index.vue
@@ -160,7 +160,20 @@ and copying the data of the data object, example:
Determine whether a color is white.
+v0.6.11+
+
Determine whether a color is transparent.
+++v0.6.12+
+
Convert the rich text content of nodes in the form of <p><span></span><p> into text wrapped in <br>.
++v0.6.12+
+
Convert the wrapped text of <br> into node rich text content in the form of <p><span></span><p>.
Import:
import drawBackgroundImageToCanvas from 'simple-mind-map/src/utils/simulateCSSBackgroundInCanvas'
diff --git a/web/src/pages/Doc/routerList.js b/web/src/pages/Doc/routerList.js
index dd4d9db7..000b972e 100644
--- a/web/src/pages/Doc/routerList.js
+++ b/web/src/pages/Doc/routerList.js
@@ -50,6 +50,7 @@ export default [
{ path: 'touchEvent', title: 'TouchEvent插件' },
{ path: 'nodeImgAdjust', title: 'NodeImgAdjust插件' },
{ path: 'search', title: 'Search插件' },
+ { path: 'painter', title: 'Painter插件' },
{ path: 'help1', title: '概要/关联线' },
{ path: 'help2', title: '客户端' }
]
@@ -82,7 +83,8 @@ export default [
{ path: 'deploy', title: 'Deploy' },
{ path: 'touchEvent', title: 'TouchEvent plugin' },
{ path: 'nodeImgAdjust', title: 'NodeImgAdjust plugin' },
- { path: 'search', title: 'Search plugin' }
+ { path: 'search', title: 'Search plugin' },
+ { path: 'painter', title: 'Painter plugin' }
]
}
]
diff --git a/web/src/pages/Doc/zh/changelog/index.md b/web/src/pages/Doc/zh/changelog/index.md
index a4c8e34f..ca82e5e1 100644
--- a/web/src/pages/Doc/zh/changelog/index.md
+++ b/web/src/pages/Doc/zh/changelog/index.md
@@ -1,5 +1,49 @@
# Changelog
+## 0.6.12
+
+修复:
+
+> 1.修复当思维导图全部移出可视区域后小地图中的指示器也会移出小地图区域的问题。
+>
+> 2.修复移动端双指缩放过于灵敏的问题。
+>
+> 3.修复只读模式下按住节点无法拖动画布的问题。
+>
+> 4.修复当思维导图距浏览器窗口左上角不为0时,小地图渲染不正确的问题。
+>
+> 5.修复移动节点时新位置的提示块过大的问题。
+>
+> 6.修复搜索不能替换为空字符的问题。
+>
+> 7.修复富文本模式下,搜索替换后换行会丢失的问题。
+>
+> 8.修复大纲里点击文字编辑时输入框焦点丢失的问题。
+
+新增:
+
+> 1.节点移动结束事件(node_dragend)增加回调参数,可以获取到移动到节点的uid。
+>
+> 2.支持通过配置指定内部一些元素添加到的位置。
+>
+> 3.支持格式刷功能。
+>
+> 4.曲线风格下,根节点的连接线样式支持和其他节点保持一致。
+>
+> 5.搜索支持连续替换。
+>
+> 6.节点图片新增删除按钮。
+>
+> 7.支持按住鼠标中键拖动画布。
+
+Demo:
+
+> 1.提供应用接管模式,方便对接自己的存储服务;支持运行时设置静态资源路径。
+>
+> 2.重构大纲:1.不再使用节点自带的文本样式;2.支持全屏编辑大纲;3.大纲支持拖拽移动节点;4.大纲支持删除节点。
+>
+> 3.修复导入数据场景下界面暗黑模式没有更新的问题。
+
## 0.6.11-fix.1
修复:1.修复节点文字为白色时编辑的时候看不见的问题。
diff --git a/web/src/pages/Doc/zh/changelog/index.vue b/web/src/pages/Doc/zh/changelog/index.vue
index 659371c1..44931f76 100644
--- a/web/src/pages/Doc/zh/changelog/index.vue
+++ b/web/src/pages/Doc/zh/changelog/index.vue
@@ -1,6 +1,34 @@
Changelog
+0.6.12
+修复:
+
+1.修复当思维导图全部移出可视区域后小地图中的指示器也会移出小地图区域的问题。
+2.修复移动端双指缩放过于灵敏的问题。
+3.修复只读模式下按住节点无法拖动画布的问题。
+4.修复当思维导图距浏览器窗口左上角不为0时,小地图渲染不正确的问题。
+5.修复移动节点时新位置的提示块过大的问题。
+6.修复搜索不能替换为空字符的问题。
+7.修复富文本模式下,搜索替换后换行会丢失的问题。
+8.修复大纲里点击文字编辑时输入框焦点丢失的问题。
+
+新增:
+
+1.节点移动结束事件(node_dragend)增加回调参数,可以获取到移动到节点的uid。
+2.支持通过配置指定内部一些元素添加到的位置。
+3.支持格式刷功能。
+4.曲线风格下,根节点的连接线样式支持和其他节点保持一致。
+5.搜索支持连续替换。
+6.节点图片新增删除按钮。
+7.支持按住鼠标中键拖动画布。
+
+Demo:
+
+1.提供应用接管模式,方便对接自己的存储服务;支持运行时设置静态资源路径。
+2.重构大纲:1.不再使用节点自带的文本样式;2.支持全屏编辑大纲;3.大纲支持拖拽移动节点;4.大纲支持删除节点。
+3.修复导入数据场景下界面暗黑模式没有更新的问题。
+
0.6.11-fix.1
修复:1.修复节点文字为白色时编辑的时候看不见的问题。
0.6.11
diff --git a/web/src/pages/Doc/zh/constructor/index.md b/web/src/pages/Doc/zh/constructor/index.md
index 45bba08b..94e34451 100644
--- a/web/src/pages/Doc/zh/constructor/index.md
+++ b/web/src/pages/Doc/zh/constructor/index.md
@@ -72,6 +72,7 @@ const mindMap = new MindMap({
| customCreateNodeContent(v0.6.3+) | Function/null | null | 如果`isUseCustomNodeContent`设为`true`,那么需要使用该选项传入一个方法,接收节点实例`node`为参数(如果要获取该节点的数据,可以通过`node.nodeData.data`),需要返回自定义节点内容元素,也就是DOM节点,如果某个节点不需要自定义,那么返回`null`即可 | |
| mouseScaleCenterUseMousePosition(v0.6.4-fix.1+) | Boolean | true | 鼠标缩放是否以鼠标当前位置为中心点,否则以画布中心点 | |
| customInnerElsAppendTo(v0.6.12+) | null/HTMLElement | null | 指定内部一些元素(节点文本编辑元素、节点备注显示元素、关联线文本编辑元素、节点图片调整按钮元素)添加到的位置,默认添加到document.body下 | |
+| nodeDragPlaceholderMaxSize(v0.6.12+) | Number | 20 | 拖拽元素时,指示元素新位置的块的最大高度 | |
### 水印配置
@@ -243,6 +244,7 @@ mindMap.setTheme('主题名称')
| svg_mouseenter(v0.5.1+) | 鼠标移入svg画布时触发 | e(事件对象) |
| svg_mouseleave(v0.5.1+) | 鼠标移出svg画布时触发 | e(事件对象) |
| node_icon_click(v0.6.10+) | 点击节点内的图标时触发 | this(节点实例)、item(点击的图标名称)、e(事件对象) |
+| view_theme_change(v0.6.12+) | 调用了setTheme方法设置主题后触发 | theme(设置的新主题名称) |
### emit(event, ...args)
@@ -320,7 +322,8 @@ mindMap.updateConfig({
| REMOVE_NODE | 删除节点,操作节点为当前激活的节点或指定节点 | appointNodes(v0.4.7+,可选,指定节点,指定多个节点可以传一个数组) |
| PASTE_NODE | 粘贴节点到节点,操作节点为当前激活的节点 | data(要粘贴的节点数据,一般通过`renderer.copyNode()`方法和`renderer.cutNode()`方法获取) |
| CUT_NODE | 剪切节点,操作节点为当前激活的节点,如果有多个激活节点,只会对第一个有效,对根节点使用无效 | callback(回调函数,剪切的节点数据会通过调用该函数并通过参数返回) |
-| SET_NODE_STYLE | 修改节点样式 | node(要设置样式的节点)、prop(样式属性)、value(样式属性值)、isActive(布尔值,是否设置的是激活状态的样式) |
+| SET_NODE_STYLE | 修改节点单个样式 | node(要设置样式的节点)、style(样式属性)、value(样式属性值)、isActive(布尔值,是否设置的是激活状态的样式) |
+| SET_NODE_STYLEs(v0.6.12+) | 修改节点多个样式 | node(要设置样式的节点)、style(样式对象,key为样式属性,value为样式值)、isActive(布尔值,是否设置的是激活状态的样式) |
| SET_NODE_ACTIVE | 设置节点是否激活 | node(要设置的节点)、active(布尔值,是否激活) |
| CLEAR_ACTIVE_NODE | 清除当前已激活节点的激活状态,操作节点为当前激活的节点 | |
| SET_NODE_EXPAND | 设置节点是否展开 | node(要设置的节点)、expand(布尔值,是否展开) |
diff --git a/web/src/pages/Doc/zh/constructor/index.vue b/web/src/pages/Doc/zh/constructor/index.vue
index 2d8b941c..60e82829 100644
--- a/web/src/pages/Doc/zh/constructor/index.vue
+++ b/web/src/pages/Doc/zh/constructor/index.vue
@@ -364,6 +364,13 @@
指定内部一些元素(节点文本编辑元素、节点备注显示元素、关联线文本编辑元素、节点图片调整按钮元素)添加到的位置,默认添加到document.body下
isActive:获取的是否是激活状态的样式值,默认false
修改节点的某个样式,SET_NODE_STYLE命令的快捷方法
++v0.6.12+
+
修改节点多个样式,SET_NODE_STYLES命令的快捷方法
获取该节点真实数据nodeData的data对象里的指定值,key不传返回这个data对象
++v0.6.12+
+
节点格式刷插件。
+import MindMap from 'simple-mind-map'
+import Painter from 'simple-mind-map/src/plugins/Painter.js'
+MindMap.usePlugin(Painter)
+
+注册完且实例化MindMap后可通过mindMap.painter获取到该实例。
++可以通过mindMap.on('事件名称', () => {})来监听事件。
+
开始格式刷事件。
+结束格式刷事件。
+开始格式刷。
+当调用了该方法后,如果当前存在激活节点,那么会默认取第一个激活的节点为指定节点,点击其他节点后,会把该节点的样式应用到被点击的其他节点,当点击画布后本次格式刷操作结束。
+ +搜索节点内容,可以重复调用,每调一次,会搜索和定位到下一个匹配的节点。如果搜索文本改变了,那么会重新搜索。
结束搜索。
-replaceText:要进行替换的文本replaceText:要进行替换的文本
jumpNext:v0.6.12+,是否自动跳转到下一个匹配节点
替换当前节点内容,要在调用了search方法之后调用,会替换当前定位到的匹配节点内容。
`形式的节点富文本内容转换成`
`换行的文本。
+
+#### textToNodeRichTextWithWrap(html)
+
+> v0.6.12+
+
+将`
`换行的文本转换成`
`形式的节点富文本内容。 ## 在canvas中模拟css的背景属性 diff --git a/web/src/pages/Doc/zh/utils/index.vue b/web/src/pages/Doc/zh/utils/index.vue index 6a37a0b1..ed6d2357 100644 --- a/web/src/pages/Doc/zh/utils/index.vue +++ b/web/src/pages/Doc/zh/utils/index.vue @@ -155,10 +155,20 @@
判断一个颜色是否是白色。
判断一个颜色是否是透明。
+v0.6.11+
判断一个颜色是否是透明。
+++v0.6.12+
+
将<p><span></span><p>形式的节点富文本内容转换成<br>换行的文本。
++v0.6.12+
+
将<br>换行的文本转换成<p><span></span><p>形式的节点富文本内容。
引入:
import drawBackgroundImageToCanvas from 'simple-mind-map/src/utils/simulateCSSBackgroundInCanvas'
From 2b6263acb4cc525979a65c8678da0b8fe39ec26c Mon Sep 17 00:00:00 2001
From: wanglin2 <1013335014@qq.com>
Date: Mon, 7 Aug 2023 18:07:58 +0800
Subject: [PATCH 25/67] =?UTF-8?q?=E6=89=93=E5=8C=850.6.12?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.html | 4 ++--
simple-mind-map/full.js | 4 ++--
web/.env.library | 1 +
web/package.json | 2 +-
web/vue.config.js | 12 ++++++++----
5 files changed, 14 insertions(+), 9 deletions(-)
create mode 100644 web/.env.library
diff --git a/index.html b/index.html
index 8ee26756..61d2334f 100644
--- a/index.html
+++ b/index.html
@@ -1,7 +1,7 @@
思绪思维导图
\ No newline at end of file
+ }