diff --git a/simple-mind-map/index.js b/simple-mind-map/index.js index b29b234b..05c1e39e 100644 --- a/simple-mind-map/index.js +++ b/simple-mind-map/index.js @@ -14,7 +14,6 @@ import MiniMap from './src/MiniMap' import Watermark from './src/Watermark' import { layoutValueList } from './src/utils/constant' import { SVG } from '@svgdotjs/svg.js' -import xmind from './src/parse/xmind' import { simpleDeepClone } from './src/utils' import KeyboardNavigation from './src/KeyboardNavigation' import defaultTheme from './src/themes/default' @@ -357,8 +356,6 @@ class MindMap { } } -MindMap.xmind = xmind - // 定义新主题 MindMap.defineTheme = (name, config = {}) => { if (theme[name]) { diff --git a/simple-mind-map/package.json b/simple-mind-map/package.json index 8fa6e978..91732d6d 100644 --- a/simple-mind-map/package.json +++ b/simple-mind-map/package.json @@ -22,7 +22,7 @@ "format": "prettier --write ." }, "module": "index.js", - "main": "./dist/simpleMindMap.umd.min.js", + "__main": "./dist/simpleMindMap.umd.min.js", "dependencies": { "@svgdotjs/svg.js": "^3.0.16", "canvg": "^3.0.7", diff --git a/web/src/pages/Doc/catalogList.js b/web/src/pages/Doc/catalogList.js index 0693dcc0..d651c9d7 100644 --- a/web/src/pages/Doc/catalogList.js +++ b/web/src/pages/Doc/catalogList.js @@ -24,6 +24,7 @@ let APIList = [ 'command', 'select', 'batchExecution', + 'xmind', 'utils' ] diff --git a/web/src/pages/Doc/en/constructor/index.md b/web/src/pages/Doc/en/constructor/index.md index 13235650..dfcda5d2 100644 --- a/web/src/pages/Doc/en/constructor/index.md +++ b/web/src/pages/Doc/en/constructor/index.md @@ -20,50 +20,6 @@ const mindMap = new MindMap({ }); ``` -## Xmind Parsing Method - -> v0.2.7+ - -You can get the `Xmind` parsing method as follows: - -```js -import MindMap from "simple-mind-map"; - -console.log(MindMap.xmind); -``` - -The `MindMap.xmind` object has two methods attached: - -### parseXmindFile(file) - -Parsing the `.xmind` file and returning the parsed data. Note that this is -complete data, including the node tree, theme, and structure. You can use -`mindMap.setFullData(data)` to render the returned data to the canvas. - -`file`: `File` object - -### transformXmind(content) - -Convert `xmind` data. The `.xmind` file is essentially a `zip` file that can be -decompressed by changing the suffix to zip. Inside, there is a `content.json` -file. If you have parsed this file yourself, you can pass the contents of this -file to this method for conversion. The converted data is the complete data, -including the node tree, theme, structure, etc. You can use -`mindMap.setFullData(data)` to render the returned data to the canvas. - -`content`: the contents of the `content.json` file within the `.xmind` zip -package - -### transformOldXmind(content) - -> v0.2.8+ - -For data parsing of the `xmind8` version, because the `.xmind` file in this -version does not have a `content.json`, it corresponds to `content.xml`. - -`content`: the contents of the `content.xml` file within the `.xmind` zip -package - ## Instantiation options | Field Name | Type | Default Value | Description | Required | diff --git a/web/src/pages/Doc/en/constructor/index.vue b/web/src/pages/Doc/en/constructor/index.vue index efd72b97..4e242a3d 100644 --- a/web/src/pages/Doc/en/constructor/index.vue +++ b/web/src/pages/Doc/en/constructor/index.vue @@ -16,38 +16,6 @@ } }); -

Xmind Parsing Method

-
-

v0.2.7+

-
-

You can get the Xmind parsing method as follows:

-
import MindMap from "simple-mind-map";
-
-console.log(MindMap.xmind);
-
-

The MindMap.xmind object has two methods attached:

-

parseXmindFile(file)

-

Parsing the .xmind file and returning the parsed data. Note that this is -complete data, including the node tree, theme, and structure. You can use -mindMap.setFullData(data) to render the returned data to the canvas.

-

file: File object

-

transformXmind(content)

-

Convert xmind data. The .xmind file is essentially a zip file that can be -decompressed by changing the suffix to zip. Inside, there is a content.json -file. If you have parsed this file yourself, you can pass the contents of this -file to this method for conversion. The converted data is the complete data, -including the node tree, theme, structure, etc. You can use -mindMap.setFullData(data) to render the returned data to the canvas.

-

content: the contents of the content.json file within the .xmind zip -package

-

transformOldXmind(content)

-
-

v0.2.8+

-
-

For data parsing of the xmind8 version, because the .xmind file in this -version does not have a content.json, it corresponds to content.xml.

-

content: the contents of the content.xml file within the .xmind zip -package

Instantiation options

diff --git a/web/src/pages/Doc/en/xmind/index.md b/web/src/pages/Doc/en/xmind/index.md new file mode 100644 index 00000000..90934cfd --- /dev/null +++ b/web/src/pages/Doc/en/xmind/index.md @@ -0,0 +1,43 @@ +# XMind parse + +> v0.2.7+ + +Provides methods for importing `XMind` files. + +## Import + +```js +import xmind from 'simple-mind-map/src/parse/xmind.js' +``` + +## Methods + +### xmind.parseXmindFile(file) + +Parsing the `.xmind` file and returning the parsed data. Note that this is +complete data, including the node tree, theme, and structure. You can use +`mindMap.setFullData(data)` to render the returned data to the canvas. + +`file`: `File` object + +### xmind.transformXmind(content) + +Convert `xmind` data. The `.xmind` file is essentially a `zip` file that can be +decompressed by changing the suffix to zip. Inside, there is a `content.json` +file. If you have parsed this file yourself, you can pass the contents of this +file to this method for conversion. The converted data is the complete data, +including the node tree, theme, structure, etc. You can use +`mindMap.setFullData(data)` to render the returned data to the canvas. + +`content`: the contents of the `content.json` file within the `.xmind` zip +package + +### xmind.transformOldXmind(content) + +> v0.2.8+ + +For data parsing of the `xmind8` version, because the `.xmind` file in this +version does not have a `content.json`, it corresponds to `content.xml`. + +`content`: the contents of the `content.xml` file within the `.xmind` zip +package \ No newline at end of file diff --git a/web/src/pages/Doc/en/xmind/index.vue b/web/src/pages/Doc/en/xmind/index.vue new file mode 100644 index 00000000..ea52ae69 --- /dev/null +++ b/web/src/pages/Doc/en/xmind/index.vue @@ -0,0 +1,46 @@ + + + + + \ No newline at end of file diff --git a/web/src/pages/Doc/routerList.js b/web/src/pages/Doc/routerList.js index 5bbf360b..ddeba8b1 100644 --- a/web/src/pages/Doc/routerList.js +++ b/web/src/pages/Doc/routerList.js @@ -1,3 +1,3 @@ - export default [{"lang":"zh","children":[{"path":"batchExecution","title":"BatchExecution实例"},{"path":"changelog","title":"Changelog"},{"path":"command","title":"Command实例"},{"path":"constructor","title":"构造函数"},{"path":"doExport","title":"DoExport实例"},{"path":"introduction","title":"简介"},{"path":"keyboardNavigation","title":"KeyboardNavigation实例"},{"path":"keyCommand","title":"KeyCommand实例"},{"path":"miniMap","title":"MiniMap实例"},{"path":"node","title":"Node实例"},{"path":"render","title":"Render实例"},{"path":"select","title":"Select实例"},{"path":"start","title":"开始"},{"path":"translate","title":"参与翻译"},{"path":"utils","title":"内置工具方法"},{"path":"view","title":"View实例"},{"path":"watermark","title":"Watermark实例"}]},{"lang":"en","children":[{"path":"batchExecution","title":"batchExecution instance"},{"path":"changelog","title":"Changelog"},{"path":"command","title":"command instance"},{"path":"constructor","title":"Constructor"},{"path":"doExport","title":"DoExport instance"},{"path":"introduction","title":"Introduction"},{"path":"keyboardNavigation","title":"KeyboardNavigation instance"},{"path":"keyCommand","title":"KeyCommand instance"},{"path":"miniMap","title":"MiniMap instance"},{"path":"node","title":"Node instance"},{"path":"render","title":"Render instance"},{"path":"select","title":"Select instance"},{"path":"start","title":"Start"},{"path":"translate","title":"Participate in translation"},{"path":"utils","title":"Utility Methods"},{"path":"view","title":"View instance"},{"path":"watermark","title":"Watermark instance"}]}] + export default [{"lang":"zh","children":[{"path":"batchExecution","title":"BatchExecution实例"},{"path":"changelog","title":"Changelog"},{"path":"command","title":"Command实例"},{"path":"constructor","title":"构造函数"},{"path":"doExport","title":"DoExport实例"},{"path":"introduction","title":"简介"},{"path":"keyboardNavigation","title":"KeyboardNavigation实例"},{"path":"keyCommand","title":"KeyCommand实例"},{"path":"miniMap","title":"MiniMap实例"},{"path":"node","title":"Node实例"},{"path":"render","title":"Render实例"},{"path":"select","title":"Select实例"},{"path":"start","title":"开始"},{"path":"translate","title":"参与翻译"},{"path":"utils","title":"内置工具方法"},{"path":"view","title":"View实例"},{"path":"watermark","title":"Watermark实例"},{"path":"xmind","title":"XMind解析"}]},{"lang":"en","children":[{"path":"batchExecution","title":"batchExecution instance"},{"path":"changelog","title":"Changelog"},{"path":"command","title":"command instance"},{"path":"constructor","title":"Constructor"},{"path":"doExport","title":"DoExport instance"},{"path":"introduction","title":"Introduction"},{"path":"keyboardNavigation","title":"KeyboardNavigation instance"},{"path":"keyCommand","title":"KeyCommand instance"},{"path":"miniMap","title":"MiniMap instance"},{"path":"node","title":"Node instance"},{"path":"render","title":"Render instance"},{"path":"select","title":"Select instance"},{"path":"start","title":"Start"},{"path":"translate","title":"Participate in translation"},{"path":"utils","title":"Utility Methods"},{"path":"view","title":"View instance"},{"path":"watermark","title":"Watermark instance"},{"path":"xmind","title":"XMind parse"}]}] \ No newline at end of file diff --git a/web/src/pages/Doc/zh/constructor/index.md b/web/src/pages/Doc/zh/constructor/index.md index cf5fec4c..68db1720 100644 --- a/web/src/pages/Doc/zh/constructor/index.md +++ b/web/src/pages/Doc/zh/constructor/index.md @@ -20,40 +20,6 @@ const mindMap = new MindMap({ }); ``` -## Xmind解析方法 - -> v0.2.7+ - -可以通过如下方法获取解析`Xmind`文件的方法: - -```js -import MindMap from "simple-mind-map"; - -console.log(MindMap.xmind) -``` - -`MindMap.xmind`对象上挂载了两个方法: - -### parseXmindFile(file) - -解析`.xmind`文件,返回解析后的数据,注意是完整的数据,包含节点树、主题、结构等,可以使用`mindMap.setFullData(data)`来将返回的数据渲染到画布上 - -`file`:`File`对象 - -### transformXmind(content) - -转换`xmind`数据,`.xmind`文件本质上是一个压缩包,改成`zip`后缀可以解压缩,里面存在一个`content.json`文件,如果你自己解析出了这个文件,那么可以把这个文件内容传递给这个方法进行转换,转换后的数据,注意是完整的数据,包含节点树、主题、结构等,可以使用`mindMap.setFullData(data)`来将返回的数据渲染到画布上 - -`content`:`.xmind`压缩包内的`content.json`文件内容 - -### transformOldXmind(content) - -> v0.2.8+ - -针对`xmind8`版本的数据解析,因为该版本的`.xmind`文件内没有`content.json`,对应的是`content.xml`。 - -`content`:`.xmind`压缩包内的`content.xml`文件内容 - ## 实例化选项 | 字段名称 | 类型 | 默认值 | 描述 | 是否必填 | diff --git a/web/src/pages/Doc/zh/constructor/index.vue b/web/src/pages/Doc/zh/constructor/index.vue index 7312cab4..35cfe076 100644 --- a/web/src/pages/Doc/zh/constructor/index.vue +++ b/web/src/pages/Doc/zh/constructor/index.vue @@ -16,28 +16,6 @@ } }); -

Xmind解析方法

-
-

v0.2.7+

-
-

可以通过如下方法获取解析Xmind文件的方法:

-
import MindMap from "simple-mind-map";
-
-console.log(MindMap.xmind)
-
-

MindMap.xmind对象上挂载了两个方法:

-

parseXmindFile(file)

-

解析.xmind文件,返回解析后的数据,注意是完整的数据,包含节点树、主题、结构等,可以使用mindMap.setFullData(data)来将返回的数据渲染到画布上

-

fileFile对象

-

transformXmind(content)

-

转换xmind数据,.xmind文件本质上是一个压缩包,改成zip后缀可以解压缩,里面存在一个content.json文件,如果你自己解析出了这个文件,那么可以把这个文件内容传递给这个方法进行转换,转换后的数据,注意是完整的数据,包含节点树、主题、结构等,可以使用mindMap.setFullData(data)来将返回的数据渲染到画布上

-

content.xmind压缩包内的content.json文件内容

-

transformOldXmind(content)

-
-

v0.2.8+

-
-

针对xmind8版本的数据解析,因为该版本的.xmind文件内没有content.json,对应的是content.xml

-

content.xmind压缩包内的content.xml文件内容

实例化选项

diff --git a/web/src/pages/Doc/zh/xmind/index.md b/web/src/pages/Doc/zh/xmind/index.md new file mode 100644 index 00000000..a24e6ef1 --- /dev/null +++ b/web/src/pages/Doc/zh/xmind/index.md @@ -0,0 +1,33 @@ +# XMind解析 + +> v0.2.7+ + +提供导入`XMind`文件的方法。 + +## 引入 + +```js +import xmind from 'simple-mind-map/src/parse/xmind.js' +``` + +## 方法 + +### xmind.parseXmindFile(file) + +解析`.xmind`文件,返回解析后的数据,注意是完整的数据,包含节点树、主题、结构等,可以使用`mindMap.setFullData(data)`来将返回的数据渲染到画布上 + +`file`:`File`对象 + +### xmind.transformXmind(content) + +转换`xmind`数据,`.xmind`文件本质上是一个压缩包,改成`zip`后缀可以解压缩,里面存在一个`content.json`文件,如果你自己解析出了这个文件,那么可以把这个文件内容传递给这个方法进行转换,转换后的数据,注意是完整的数据,包含节点树、主题、结构等,可以使用`mindMap.setFullData(data)`来将返回的数据渲染到画布上 + +`content`:`.xmind`压缩包内的`content.json`文件内容 + +### xmind.transformOldXmind(content) + +> v0.2.8+ + +针对`xmind8`版本的数据解析,因为该版本的`.xmind`文件内没有`content.json`,对应的是`content.xml`。 + +`content`:`.xmind`压缩包内的`content.xml`文件内容 \ No newline at end of file diff --git a/web/src/pages/Doc/zh/xmind/index.vue b/web/src/pages/Doc/zh/xmind/index.vue new file mode 100644 index 00000000..0a9c6cbe --- /dev/null +++ b/web/src/pages/Doc/zh/xmind/index.vue @@ -0,0 +1,36 @@ + + + + + \ No newline at end of file diff --git a/web/src/pages/Edit/components/Import.vue b/web/src/pages/Edit/components/Import.vue index 08ef1002..90fd913c 100644 --- a/web/src/pages/Edit/components/Import.vue +++ b/web/src/pages/Edit/components/Import.vue @@ -32,7 +32,7 @@