diff --git a/README.md b/README.md index 27232255..0255d124 100644 --- a/README.md +++ b/README.md @@ -144,4 +144,8 @@ const mindMap = new MindMap({ 水车 + + + 仓鼠 +

\ No newline at end of file diff --git a/simple-mind-map/package.json b/simple-mind-map/package.json index 007c8ee4..0ef87aee 100644 --- a/simple-mind-map/package.json +++ b/simple-mind-map/package.json @@ -1,6 +1,6 @@ { "name": "simple-mind-map", - "version": "0.6.8", + "version": "0.6.9", "description": "一个简单的web在线思维导图", "authors": [ { diff --git a/web/src/assets/avatar/仓鼠.jpg b/web/src/assets/avatar/仓鼠.jpg new file mode 100644 index 00000000..1eabba76 Binary files /dev/null and b/web/src/assets/avatar/仓鼠.jpg differ diff --git a/web/src/assets/icon-font/iconfont.css b/web/src/assets/icon-font/iconfont.css index d216721f..5721282a 100644 --- a/web/src/assets/icon-font/iconfont.css +++ b/web/src/assets/icon-font/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 2479351 */ - src: url('iconfont.woff2?t=1689407546912') format('woff2'), - url('iconfont.woff?t=1689407546912') format('woff'), - url('iconfont.ttf?t=1689407546912') format('truetype'); + src: url('iconfont.woff2?t=1690506335310') format('woff2'), + url('iconfont.woff?t=1690506335310') format('woff'), + url('iconfont.ttf?t=1690506335310') format('truetype'); } .iconfont { @@ -13,6 +13,10 @@ -moz-osx-font-smoothing: grayscale; } +.iconsousuo:before { + content: "\e693"; +} + .iconjiantouyou:before { content: "\e62d"; } diff --git a/web/src/assets/icon-font/iconfont.ttf b/web/src/assets/icon-font/iconfont.ttf index 9c801c08..110b3d99 100644 Binary files a/web/src/assets/icon-font/iconfont.ttf and b/web/src/assets/icon-font/iconfont.ttf differ diff --git a/web/src/assets/icon-font/iconfont.woff b/web/src/assets/icon-font/iconfont.woff index 4d446856..45de5a0f 100644 Binary files a/web/src/assets/icon-font/iconfont.woff and b/web/src/assets/icon-font/iconfont.woff differ diff --git a/web/src/assets/icon-font/iconfont.woff2 b/web/src/assets/icon-font/iconfont.woff2 index 1d170d95..0e65009e 100644 Binary files a/web/src/assets/icon-font/iconfont.woff2 and b/web/src/assets/icon-font/iconfont.woff2 differ diff --git a/web/src/config/en.js b/web/src/config/en.js index 0c0bfbde..97aa75d4 100644 --- a/web/src/config/en.js +++ b/web/src/config/en.js @@ -271,6 +271,11 @@ export const shortcutKeyList = [ icon: 'iconzhengli', name: 'Arrange layout', value: 'Ctrl + L' + }, + { + icon: 'iconsousuo', + name: 'Search and Replace', + value: 'Ctrl + F' } ] }, diff --git a/web/src/config/zh.js b/web/src/config/zh.js index 57c6138c..6f8d0965 100644 --- a/web/src/config/zh.js +++ b/web/src/config/zh.js @@ -331,6 +331,11 @@ export const shortcutKeyList = [ icon: 'iconzhengli', name: '一键整理布局', value: 'Ctrl + L' + }, + { + icon: 'iconsousuo', + name: '搜索和替换', + value: 'Ctrl + F' } ] }, diff --git a/web/src/lang/en_us.js b/web/src/lang/en_us.js index 235ebd1d..a89f26ae 100644 --- a/web/src/lang/en_us.js +++ b/web/src/lang/en_us.js @@ -210,5 +210,12 @@ export default { mouseAction: { tip1: 'Current: Left click to drag the canvas, right click to box select nodes', tip2: 'Current: Left click to box select nodes, right click to drag the canvas', + }, + search: { + searchPlaceholder: 'Please enter the search content', + replacePlaceholder: 'Please enter replacement content', + replace: 'Replace', + replaceAll: 'Replace all', + cancel: 'Cancel' } } diff --git a/web/src/lang/zh_cn.js b/web/src/lang/zh_cn.js index c050b0f4..910dedfa 100644 --- a/web/src/lang/zh_cn.js +++ b/web/src/lang/zh_cn.js @@ -210,5 +210,12 @@ export default { mouseAction: { tip1: '当前:左键拖动画布,右键框选节点', tip2: '当前:左键框选节点,右键拖动画布', + }, + search: { + searchPlaceholder: '请输入查找内容', + replacePlaceholder: '请输入替换内容', + replace: '替换', + replaceAll: '全部替换', + cancel: '取消' } } diff --git a/web/src/pages/Doc/catalogList.js b/web/src/pages/Doc/catalogList.js index c48114f6..7aca8d52 100644 --- a/web/src/pages/Doc/catalogList.js +++ b/web/src/pages/Doc/catalogList.js @@ -32,6 +32,7 @@ let APIList = [ 'associativeLine', 'touchEvent', 'nodeImgAdjust', + 'search', 'xmind', 'markdown', 'utils' diff --git a/web/src/pages/Doc/en/changelog/index.md b/web/src/pages/Doc/en/changelog/index.md index 46429b41..f09ad06d 100644 --- a/web/src/pages/Doc/en/changelog/index.md +++ b/web/src/pages/Doc/en/changelog/index.md @@ -1,5 +1,13 @@ # Changelog +## 0.6.9 + +Fix: 1.Fixed an issue where setting styles to summary nodes would cause summary nodes to disappear. 2.Fixed the issue of node content not rendering when creating a root instance again when customizing node content. 3.Fix the issue of losing focus when adding a new node while the node is in editing. 2.Fix the issue of continuously pressing the tab key not being able to continuously create child nodes. + +New: 1.Replace existing ` ` in SVG when exporting Characters to avoid exporting SVG errors. 2.Support for search and replace. + +Demo: 1.When switching themes, it is supported to choose whether to overwrite the set basic style. + ## 0.6.8 Fix: 1.Change the shortcut key for inserting a summary to Ctrl+G to avoid conflicts with the save shortcut key. 2.Fix the issue of abnormal switching between rich text editing configuration input boxes while nodes are being edited. diff --git a/web/src/pages/Doc/en/changelog/index.vue b/web/src/pages/Doc/en/changelog/index.vue index 25fb9efb..00fd1d31 100644 --- a/web/src/pages/Doc/en/changelog/index.vue +++ b/web/src/pages/Doc/en/changelog/index.vue @@ -1,6 +1,10 @@ diff --git a/web/src/pages/Doc/en/render/index.md b/web/src/pages/Doc/en/render/index.md index 82f871cb..a76e1504 100644 --- a/web/src/pages/Doc/en/render/index.md +++ b/web/src/pages/Doc/en/render/index.md @@ -61,7 +61,9 @@ Delete a specific node 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 -### setNodeDataRender(node, data) +### setNodeDataRender(node, data, notRender) + +- `notRender`: v0.6.9+, `Boolean`, Default is `false`, Do not trigger rendering. 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` diff --git a/web/src/pages/Doc/en/render/index.vue b/web/src/pages/Doc/en/render/index.vue index 34956eb1..2819d97d 100644 --- a/web/src/pages/Doc/en/render/index.vue +++ b/web/src/pages/Doc/en/render/index.vue @@ -37,7 +37,10 @@ disable the enter key and delete key related shortcuts to prevent conflicts

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

-

setNodeDataRender(node, data)

+

setNodeDataRender(node, data, notRender)

+

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'}

diff --git a/web/src/pages/Doc/en/search/index.md b/web/src/pages/Doc/en/search/index.md new file mode 100644 index 00000000..9bb87174 --- /dev/null +++ b/web/src/pages/Doc/en/search/index.md @@ -0,0 +1,68 @@ +# Search plugin + +> v0.6.9+ + +This plugin provides the ability to search and replace node content. + +## Register + +```js +import MindMap from 'simple-mind-map' +import Search from 'simple-mind-map/src/plugins/Search.js' +MindMap.usePlugin(Search) +``` + +After registration and instantiation of `MindMap`, the instance can be obtained through `mindMap.Search`. + +## Event + +### search_info_change + +You can listen to 'search_info_change' event to get the number of current search results and the index currently located. + +```js +mindMap.on('search_info_change', (data) => { + /* + data: { + currentIndex,// Index, from zero + total + } + */ +}) +``` + +## Method + +### search(searchText, callback) + +- `searchText`: Text to search for + +- `callback`: The callback function that completes this search will be triggered after jumping to the node + +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. + +### endSearch() + +End search. + +### replace(replaceText) + +- `replaceText`: Text to be replaced + +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. + +### replaceAll(replaceText) + +- `replaceText`: Text to be replaced + +Replace all matching node contents, and call it after calling the 'search' method. + +### getReplacedText(node, searchText, replaceText) + +- `node`: Node instance + +- `searchText`: Text to search for + +- `replaceText`: Text to be replaced + +Return the text content of the node after search and replacement. Note that the node content will not be actually changed, but is only used to calculate the content of a node after replacement. \ No newline at end of file diff --git a/web/src/pages/Doc/en/search/index.vue b/web/src/pages/Doc/en/search/index.vue new file mode 100644 index 00000000..600bcaf8 --- /dev/null +++ b/web/src/pages/Doc/en/search/index.vue @@ -0,0 +1,74 @@ + + + + + \ 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 a2610595..80041030 100644 --- a/web/src/pages/Doc/en/utils/index.md +++ b/web/src/pages/Doc/en/utils/index.md @@ -196,6 +196,12 @@ Load image, return: } ``` +#### getType(data) + +> v0.6.9+ + +Get the type of a data, such as `Boolean`、`Array`. + ## 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 8d53434b..d812e14f 100644 --- a/web/src/pages/Doc/en/utils/index.vue +++ b/web/src/pages/Doc/en/utils/index.vue @@ -134,6 +134,11 @@ and copying the data of the data object, example:

size// { width, height } width and height of image } +

getType(data)

+
+

v0.6.9+

+
+

Get the type of a data, such as BooleanArray.

Simulate CSS background in Canvas

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 b2a0fcb4..dd4d9db7 100644
--- a/web/src/pages/Doc/routerList.js
+++ b/web/src/pages/Doc/routerList.js
@@ -49,6 +49,7 @@ export default [
       { path: 'client', title: '客户端' },
       { path: 'touchEvent', title: 'TouchEvent插件' },
       { path: 'nodeImgAdjust', title: 'NodeImgAdjust插件' },
+      { path: 'search', title: 'Search插件' },
       { path: 'help1', title: '概要/关联线' },
       { path: 'help2', title: '客户端' }
     ]
@@ -80,7 +81,8 @@ export default [
       { path: 'xmind', title: 'XMind parse' },
       { path: 'deploy', title: 'Deploy' },
       { path: 'touchEvent', title: 'TouchEvent plugin' },
-      { path: 'nodeImgAdjust', title: 'NodeImgAdjust plugin' }
+      { path: 'nodeImgAdjust', title: 'NodeImgAdjust plugin' },
+      { path: 'search', title: 'Search plugin' }
     ]
   }
 ]
diff --git a/web/src/pages/Doc/zh/changelog/index.md b/web/src/pages/Doc/zh/changelog/index.md
index 7e302272..eb8ed945 100644
--- a/web/src/pages/Doc/zh/changelog/index.md
+++ b/web/src/pages/Doc/zh/changelog/index.md
@@ -1,5 +1,13 @@
 # Changelog
 
+## 0.6.9
+
+修复:1.修复给概要节点设置样式概要节点会消失的问题。2.修复自定义节点内容时,二次创建根实例时节点内容不渲染的问题。3.修复节点处于编辑中时添加新节点时新节点的焦点丢失问题。 2.修复连续按tab键无法连续创建子节点的问题。
+
+新增:1.导出svg时替换svg中存在的` `字符,避免导出的svg报错。 2.支持搜索和替换。
+
+Demo:1.切换主题时支持选择是否覆盖设置过的基础样式。
+
 ## 0.6.8
 
 修复:1.修改插入概要的快捷键为Ctrl+G,避免和保存快捷键冲突。 2.修复节点正在编辑时切换富文本编辑配置输入框出现异常的问题。
diff --git a/web/src/pages/Doc/zh/changelog/index.vue b/web/src/pages/Doc/zh/changelog/index.vue
index 1652ac9f..098a4fa8 100644
--- a/web/src/pages/Doc/zh/changelog/index.vue
+++ b/web/src/pages/Doc/zh/changelog/index.vue
@@ -1,6 +1,10 @@
 
diff --git a/web/src/pages/Doc/zh/render/index.md b/web/src/pages/Doc/zh/render/index.md
index bcb9ee0f..ee32bdb6 100644
--- a/web/src/pages/Doc/zh/render/index.md
+++ b/web/src/pages/Doc/zh/render/index.md
@@ -54,7 +54,9 @@
 
 复制节点,操作节点为当前激活节点,有多个激活节点只会操作第一个节点
 
-### setNodeDataRender(node, data)
+### setNodeDataRender(node, data, notRender)
+
+- `notRender`:v0.6.9+,`Boolean`,默认为`false`,是否不要触发渲染。
 
 设置节点数据,即`data`字段的数据,并会根据节点大小是否变化来判断是否需要重新渲染该节点,`data`为对象,如:`{text: '我是新文本'}`
 
diff --git a/web/src/pages/Doc/zh/render/index.vue b/web/src/pages/Doc/zh/render/index.vue
index 3a2d5d2b..27ee69ae 100644
--- a/web/src/pages/Doc/zh/render/index.vue
+++ b/web/src/pages/Doc/zh/render/index.vue
@@ -28,7 +28,10 @@
 

删除某个指定节点

copyNode()

复制节点,操作节点为当前激活节点,有多个激活节点只会操作第一个节点

-

setNodeDataRender(node, data)

+

setNodeDataRender(node, data, notRender)

+

设置节点数据,即data字段的数据,并会根据节点大小是否变化来判断是否需要重新渲染该节点,data为对象,如:{text: '我是新文本'}

moveNodeTo(node, toNode)

diff --git a/web/src/pages/Doc/zh/search/index.md b/web/src/pages/Doc/zh/search/index.md new file mode 100644 index 00000000..736ef63f --- /dev/null +++ b/web/src/pages/Doc/zh/search/index.md @@ -0,0 +1,68 @@ +# Search 插件 + +> v0.6.9+ + +该插件提供搜索和替换节点内容的功能。 + +## 注册 + +```js +import MindMap from 'simple-mind-map' +import Search from 'simple-mind-map/src/plugins/Search.js' +MindMap.usePlugin(Search) +``` + +注册完且实例化`MindMap`后可通过`mindMap.search`获取到该实例。 + +## 事件 + +### search_info_change + +可以通过监听`search_info_change`事件来获取当前搜索结果的数量和当前定位到的索引。 + +```js +mindMap.on('search_info_change', (data) => { + /* + data: { + currentIndex,// 索引,从0开始 + total + } + */ +}) +``` + +## 方法 + +### search(searchText, callback) + +- `searchText`:要进行搜索的文本 + +- `callback`:本次搜索完成的回调函数,会在跳转到节点后触发 + +搜索节点内容,可以重复调用,每调一次,会搜索和定位到下一个匹配的节点。如果搜索文本改变了,那么会重新搜索。 + +### endSearch() + +结束搜索。 + +### replace(replaceText) + +- `replaceText`:要进行替换的文本 + +替换当前节点内容,要在调用了`search`方法之后调用,会替换当前定位到的匹配节点内容。 + +### replaceAll(replaceText) + +- `replaceText`:要进行替换的文本 + +替换所有匹配的节点内容,要在调用了`search`方法之后调用。 + +### getReplacedText(node, searchText, replaceText) + +- `node`:节点实例 + +- `searchText`:要进行搜索的文本 + +- `replaceText`:要进行替换的文本 + +返回该节点搜索和替换后的文本内容,注意,不会实际改变节点内容,只是用来计算一个节点替换后的内容。 \ No newline at end of file diff --git a/web/src/pages/Doc/zh/search/index.vue b/web/src/pages/Doc/zh/search/index.vue new file mode 100644 index 00000000..997de619 --- /dev/null +++ b/web/src/pages/Doc/zh/search/index.vue @@ -0,0 +1,74 @@ + + + + + \ No newline at end of file diff --git a/web/src/pages/Doc/zh/utils/index.md b/web/src/pages/Doc/zh/utils/index.md index a1f48086..814205e5 100644 --- a/web/src/pages/Doc/zh/utils/index.md +++ b/web/src/pages/Doc/zh/utils/index.md @@ -191,6 +191,12 @@ copyNodeTree({}, node) } ``` +#### getType(data) + +> v0.6.9+ + +获取一个数据的类型,比如`Boolean`、`Array`等。 + ## 在canvas中模拟css的背景属性 引入: diff --git a/web/src/pages/Doc/zh/utils/index.vue b/web/src/pages/Doc/zh/utils/index.vue index e874c85e..0552eabb 100644 --- a/web/src/pages/Doc/zh/utils/index.vue +++ b/web/src/pages/Doc/zh/utils/index.vue @@ -129,6 +129,11 @@ size// { width, height } 图片宽高 }
+

getType(data)

+
+

v0.6.9+

+
+

获取一个数据的类型,比如BooleanArray等。

在canvas中模拟css的背景属性

引入:

import drawBackgroundImageToCanvas from 'simple-mind-map/src/utils/simulateCSSBackgroundInCanvas'
diff --git a/web/src/pages/Edit/components/Search.vue b/web/src/pages/Edit/components/Search.vue
index 9fdda8a4..396ac1fe 100644
--- a/web/src/pages/Edit/components/Search.vue
+++ b/web/src/pages/Edit/components/Search.vue
@@ -6,7 +6,7 @@
     
替换{{ $t('search.replace') }}
@@ -26,19 +26,23 @@
- 取消 + {{ + $t('search.cancel') + }}
- 替换 - 全部替换 + {{ + $t('search.replace') + }} + {{ + $t('search.replaceAll') + }}