diff --git a/README.md b/README.md index f424d638..434ee328 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,15 @@ [![GitHub forks](https://img.shields.io/github/forks/wanglin2/mind-map)](https://github.com/wanglin2/mind-map/network/members) ![license](https://img.shields.io/npm/l/express.svg) -> 一个简单&强大的Web思维导图库 +> 一个简单&强大的Web思维导图库,不依赖任何框架。 -Demo:[https://wanglin2.github.io/mind-map/](https://wanglin2.github.io/mind-map/) +在线Demo:[https://wanglin2.github.io/mind-map/](https://wanglin2.github.io/mind-map/) -文档:[https://wanglin2.github.io/mind-map/#/doc/zh/](https://wanglin2.github.io/mind-map/#/doc/zh/) +开发文档:[https://wanglin2.github.io/mind-map/#/doc/zh/](https://wanglin2.github.io/mind-map/#/doc/zh/) # 特性 -- [x] 插件化架构,除核心功能外,其他功能作为插件提供,按需使用,减小整体体积 +- [x] 插件化架构,除核心功能外,其他功能作为插件提供,按需使用,减小打包体积 - [x] 支持逻辑结构图、思维导图、组织结构图、目录组织图四种结构 - [x] 内置多种主题,允许高度自定义样式,支持注册新主题 - [x] 支持快捷键 @@ -37,10 +37,14 @@ npm i simple-mind-map # 使用 +提供一个宽高不为0的容器元素: + ```html
``` +然后创建一个实例: + ```js import MindMap from "simple-mind-map"; @@ -55,6 +59,12 @@ const mindMap = new MindMap({ }); ``` +即可得到一个思维导图。 + +想要实现更多功能?可以查看[开发文档](https://wanglin2.github.io/mind-map/#/doc/zh/)。 + +仓库内附带一个基于`Vue2.x`的全功能demo,可以解决你大部分功能实现上的困惑。 + # License MIT diff --git a/index.html b/index.html index 0b8f00c0..1fd1de4c 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -一个简单的web思维导图实现
\ No newline at end of file +一个简单的web思维导图实现
\ No newline at end of file diff --git a/web/scripts/transformMdToVue.js b/web/scripts/transformMdToVue.js index 44bbaa4d..cb36f3ee 100644 --- a/web/scripts/transformMdToVue.js +++ b/web/scripts/transformMdToVue.js @@ -2,6 +2,8 @@ const path = require('path') const fs = require('fs') const hljs = require('highlight.js') const md = require('markdown-it')({ + html: true, + xhtmlOut: true, highlight: function(str, lang) { if (lang && hljs.getLanguage(lang)) { try { diff --git a/web/src/assets/img/alipay.jpg b/web/src/assets/img/alipay.jpg new file mode 100644 index 00000000..d3924e78 Binary files /dev/null and b/web/src/assets/img/alipay.jpg differ diff --git a/web/src/assets/img/wechat.jpg b/web/src/assets/img/wechat.jpg new file mode 100644 index 00000000..4431fa5c Binary files /dev/null and b/web/src/assets/img/wechat.jpg differ diff --git a/web/src/pages/Doc/en/introduction/index.md b/web/src/pages/Doc/en/introduction/index.md index ac415031..da5b86b5 100644 --- a/web/src/pages/Doc/en/introduction/index.md +++ b/web/src/pages/Doc/en/introduction/index.md @@ -2,6 +2,8 @@ `simple-mind-map` is a simple and powerful web mind map library, not dependent on any specific framework. Can help you quickly develop mind mapping products. +> If you just want to use mind mapping, you can also use the demo of this project as a regular online mind mapping tool. Click on the 【Online Demo】 in the upper right corner to start using it. + ## Features - [x] Plugin architecture. In addition to core functions, other functions are provided as plugins, which can be used as needed to reduce the overall volume @@ -79,4 +81,14 @@ Respect the copyright, and do not use the theme and icons directly for commercia ## License -[MIT](https://opensource.org/licenses/MIT) \ No newline at end of file +[MIT](https://opensource.org/licenses/MIT) + +## Invite the author to a cup of coffee + +Open source is not easy. If this project is helpful to you, you can invite the author to have a cup of coffee~ + +> Please note the 【mind map】 for transfer. Your avatar and name will appear below. + + + + \ No newline at end of file diff --git a/web/src/pages/Doc/en/introduction/index.vue b/web/src/pages/Doc/en/introduction/index.vue index 1c94eb68..174739ec 100644 --- a/web/src/pages/Doc/en/introduction/index.vue +++ b/web/src/pages/Doc/en/introduction/index.vue @@ -2,23 +2,26 @@

Introduction

simple-mind-map is a simple and powerful web mind map library, not dependent on any specific framework. Can help you quickly develop mind mapping products.

+
+

If you just want to use mind mapping, you can also use the demo of this project as a regular online mind mapping tool. Click on the 【Online Demo】 in the upper right corner to start using it.

+

Features

Repository Catalog Introduction

1.simple-mind-map

@@ -28,16 +31,16 @@ frameworks such as Vue and React, or without a framework.

This is an online mind map built using the simple-mind-map library and based on Vue2.x and ElementUI. Features include:

@@ -59,7 +62,13 @@ full screen, support mini map

Respect the copyright, and do not use the theme and icons directly for commercial projects.

License

MIT

- +

Invite the author to a cup of coffee

+

Open source is not easy. If this project is helpful to you, you can invite the author to have a cup of coffee~

+
+

Please note the 【mind map】 for transfer. Your avatar and name will appear below.

+
+ +
diff --git a/web/src/pages/Doc/en/start/index.md b/web/src/pages/Doc/en/start/index.md index 2d80acfb..63e1e872 100644 --- a/web/src/pages/Doc/en/start/index.md +++ b/web/src/pages/Doc/en/start/index.md @@ -1,7 +1,80 @@ # Start +## Installation + +> Things to note before version 0.2.0: + +```bash +npm i simple-mind-map +``` + +`0.2.0` Notes for previous versions: + +> Note: This project is directly published in source code form and has not been +> packaged. If compilation fails, a Vue CLI-created project can add the +> following configuration to the vue.config.js file to allow babel-loader to +> compile this dependency: +> +> ```js +> module.exports = { +> transpileDependencies: ["simple-mind-map"], +> }; +> ``` +> +> Other projects should modify the packaging configuration as needed. + +## Usage + +> The `web` directory of this repository provides a complete project based on `Vue2`. If you encounter any doubts about using it, you can refer to the implementation of this project. + +> To learn about its use in other frameworks, you can refer to the following unofficial implementations: +> +> 1.[https://github.com/huangyuanyin/hyy-vue3-mindMap](https://github.com/huangyuanyin/hyy-vue3-mindMap): A mind map based on Vue3.2+ElementPlus. + +Firstly, provide a container element with a width and height not equal to 0: + +```html +
+``` + +Then introduce the `simple-mind-map` library and create an instance: + +```js +import MindMap from "simple-mind-map"; + +const mindMap = new MindMap({ + el: document.getElementById('mindMapContainer'), + data: { + "data": { + "text": "Root Node" + }, + "children": [] + } +}); +``` + +This will result in a mind map. + +If you want to implement a complete mind map, you usually need to develop some UI interfaces to achieve more functions through the interfaces provided by the `simple-mind-map` library. + +`simple-mind-map` supports rich configurations, events, commands, and some additional plugin extensions. Read the subsequent documentation to learn more. + +The non-packaged 'ES' module is introduced by default, and only contains core functions, not unregistered plugin content, which can effectively reduce the size. However, you need to configure the `babel` compilation `simple mind-map` in your project to prevent some newer `js` syntax some browsers not supporting it. + +If you need a file in the format of `umd` module, such as `CDN` in the browser, Then you can find the `simpleMindMap.umd.min.js` file in the `/simple-mind-map/dist/` directory, copy it to your project, and then import it into the page: + +```html + +``` + +A global variable `window.simpleMindMap` will be created. + +The disadvantage of this method is that it will contain all the content, including the plugins you have not registered, so the overall volume will be relatively large. + ## Development +If you only use library, you don't need to read this section. + ### Local Development ```bash @@ -56,63 +129,6 @@ npm run build The `index.html` file will be automatically moved to the root directory. -## Installation - -> Things to note before version 0.2.0: - -```bash -npm i simple-mind-map -``` - -`0.2.0` Notes for previous versions: - -> Note: This project is directly published in source code form and has not been -> packaged. If compilation fails, a Vue CLI-created project can add the -> following configuration to the vue.config.js file to allow babel-loader to -> compile this dependency: -> -> ```js -> module.exports = { -> transpileDependencies: ["simple-mind-map"], -> }; -> ``` -> -> Other projects should modify the packaging configuration as needed. - -## Usage - -> The `web` directory of this repository provides a complete project based on `Vue2`. If you encounter any doubts about using it, you can refer to the implementation of this project. - -```html -
-``` - -```js -import MindMap from "simple-mind-map"; - -const mindMap = new MindMap({ - el: document.getElementById('mindMapContainer'), - data: { - "data": { - "text": "Root Node" - }, - "children": [] - } -}); -``` - -The non-packaged 'ES' module is introduced by default, and only contains core functions, not unregistered plugin content, which can effectively reduce the size. However, you need to configure the `babel` compilation `simple mind-map` in your project to prevent some newer `js` syntax some browsers not supporting it. - -If you need a file in the format of `umd` module, such as `CDN` in the browser, Then you can find the `simpleMindMap.umd.min.js` file in the `/simple-mind-map/dist/` directory, copy it to your project, and then import it into the page: - -```html - -``` - -A global variable `window.simpleMindMap` will be created. - -The disadvantage of this method is that it will contain all the content, including the plugins you have not registered, so the overall volume will be relatively large. - ## Problems ### Error when using in Vite, indicating xml-js dependency error diff --git a/web/src/pages/Doc/en/start/index.vue b/web/src/pages/Doc/en/start/index.vue index 41a21187..18132352 100644 --- a/web/src/pages/Doc/en/start/index.vue +++ b/web/src/pages/Doc/en/start/index.vue @@ -1,7 +1,59 @@ diff --git a/web/src/pages/Doc/zh/start/index.md b/web/src/pages/Doc/zh/start/index.md index 30ef4e0e..5b314a19 100644 --- a/web/src/pages/Doc/zh/start/index.md +++ b/web/src/pages/Doc/zh/start/index.md @@ -1,7 +1,75 @@ # 开始 +## 安装 + +```bash +npm i simple-mind-map +``` + +`0.2.0`版本之前的注意事项: + +> 注意:本项目为源码直接发布,并未进行打包,如果出现编译失败的情况,Vue CLI创建的项目可以在vue.config.js文件中增加如下配置来让babel-loader编译本依赖: +> +> ```js +> module.exports = { +> transpileDependencies: ['simple-mind-map'] +> } +> ``` +> +> 其他项目请自行修改打包配置。 + +## 使用 + +> 本仓库的`web`目录提供了一个基于`Vue2`的完整项目,如果你遇到了一些使用上的疑惑,可以参考该项目的实现。 + +> 想要了解在其他框架中的使用,你可以参考以下这些非官方的实现: +> +> 1.[https://github.com/huangyuanyin/hyy-vue3-mindMap](https://github.com/huangyuanyin/hyy-vue3-mindMap):一个基于 Vue3.2 +ElementPlus的思维导图。 + +首先提供一个宽高不为0的容器元素: + +```html +
+``` + +然后引入`simple-mind-map`库,创建一个实例: + +```js +import MindMap from "simple-mind-map"; + +const mindMap = new MindMap({ + el: document.getElementById('mindMapContainer'), + data: { + "data": { + "text": "根节点" + }, + "children": [] + } +}); +``` + +这样即可得一个思维导图。 + +如果你想要实现一个完整思维导图,那么通常你需要开发一些ui界面,通过`simple-mind-map`库提供的接口来实现更多功能。 + +`simple-mind-map`支持丰富的配置、事件、命令,以及一些额外的插件扩展,阅读后续的文档来了解更多吧。 + +默认引入的是未打包的`ES`模块,且只包含核心功能,不包含未注册的插件内容,能有效减小体积,不过你需要在你的项目中配置`babel`编译`simple-mind-map`,防止一些较新的`js`语法部分浏览器不支持。 + +如果你需要`umd`模块格式的文件,比如以`CDN`的方式在浏览器上使用,那么你可以从`/simple-mind-map/dist/`目录中找到`simpleMindMap.umd.min.js`文件,复制到你的项目中,然后在页面中引入: + +```html + +``` + +会创建一个全局变量`window.simpleMindMap`。 + +这种方式的缺点是会包含所有的内容,包括你没有注册的插件,所以整体体积会比较大。 + ## 开发 +如果你只是使用库的话可以不用阅读此小节。 + ### 本地开发 ```bash @@ -52,58 +120,6 @@ npm run build 会自动把`index.html`移动到根目录。 -## 安装 - -```bash -npm i simple-mind-map -``` - -`0.2.0`版本之前的注意事项: - -> 注意:本项目为源码直接发布,并未进行打包,如果出现编译失败的情况,Vue CLI创建的项目可以在vue.config.js文件中增加如下配置来让babel-loader编译本依赖: -> -> ```js -> module.exports = { -> transpileDependencies: ['simple-mind-map'] -> } -> ``` -> -> 其他项目请自行修改打包配置。 - -## 使用 - -> 本仓库的`web`目录提供了一个基于`Vue2`的完整项目,如果你遇到了一些使用上的疑惑,可以参考该项目的实现。 - -```html -
-``` - -```js -import MindMap from "simple-mind-map"; - -const mindMap = new MindMap({ - el: document.getElementById('mindMapContainer'), - data: { - "data": { - "text": "根节点" - }, - "children": [] - } -}); -``` - -默认引入的是未打包的`ES`模块,且只包含核心功能,不包含未注册的插件内容,能有效减小体积,不过你需要在你的项目中配置`babel`编译`simple-mind-map`,防止一些较新的`js`语法部分浏览器不支持。 - -如果你需要`umd`模块格式的文件,比如以`CDN`的方式在浏览器上使用,那么你可以从`/simple-mind-map/dist/`目录中找到`simpleMindMap.umd.min.js`文件,复制到你的项目中,然后在页面中引入: - -```html - -``` - -会创建一个全局变量`window.simpleMindMap`。 - -这种方式的缺点是会包含所有的内容,包括你没有注册的插件,所以整体体积会比较大。 - ## 问题 ### 1.在Vite中使用报错,提示xml-js依赖出错 diff --git a/web/src/pages/Doc/zh/start/index.vue b/web/src/pages/Doc/zh/start/index.vue index fa8eb70c..5cff9176 100644 --- a/web/src/pages/Doc/zh/start/index.vue +++ b/web/src/pages/Doc/zh/start/index.vue @@ -1,7 +1,53 @@