mirror of
https://github.com/142vip/408CSFamily.git
synced 2026-04-03 02:28:54 +08:00
feat: 集成xmind,支持思维导图在线预览
This commit is contained in:
12
docs/.vuepress/components/HelloWorld.vue
Normal file
12
docs/.vuepress/components/HelloWorld.vue
Normal file
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<h1>HelloWorld</h1>
|
||||
dq24qwer
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
208
docs/.vuepress/components/XMindManager.vue
Normal file
208
docs/.vuepress/components/XMindManager.vue
Normal file
@@ -0,0 +1,208 @@
|
||||
<!--
|
||||
参考链接:
|
||||
- https://www.npmjs.com/package/xmind-embed-viewer
|
||||
- https://xmindltd.github.io/xmind-embed-viewer/
|
||||
-->
|
||||
<template>
|
||||
<div class="x-mind-container">
|
||||
<!-- xmind思维导图管理器 -->
|
||||
<div id="x-mind-manager-container">
|
||||
</div>
|
||||
<div class="btn-container">
|
||||
<button id="openLocalBtn" @click="handleOpenLocalBtnClick">打开本地</button>
|
||||
<button id="zoomScaleBtn" @click="handleZoomScaleRevertBtnClick">还原缩放</button>
|
||||
|
||||
<div class="select">
|
||||
<select v-model="xmindIndex">
|
||||
<option v-for="(xmind, index) in xmindFileList" :key="index" :value="index">
|
||||
{{ xmind }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {XMindEmbedViewer} from "xmind-embed-viewer"
|
||||
import mapData from "../public/mark-map/index.json"
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
/**
|
||||
* 监听下来列表变更
|
||||
*/
|
||||
watch: {
|
||||
xmindIndex: async function (newIndex, oldVal) {
|
||||
const {xMindPath} = mapData[newIndex]
|
||||
|
||||
// 打开指定
|
||||
const xmindResponse = await fetch(xMindPath)
|
||||
const data = await xmindResponse.arrayBuffer()
|
||||
this.viewer.setZoomScale(100)
|
||||
this.viewer.load(data)
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
viewer: {},
|
||||
xmindIndex: 0,
|
||||
xmindFileList: [],
|
||||
xmindFile: mapData.length > 0 ? mapData[0].xMindPath : '../mark-map/操作系统发展历程.xmind'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.xmindFileList = mapData.map(({name}) => name)
|
||||
},
|
||||
mounted() {
|
||||
(async () => {
|
||||
const res = await fetch(this.xmindFile)
|
||||
|
||||
this.viewer = new XMindEmbedViewer({
|
||||
el: '#x-mind-manager-container',
|
||||
file: await res.arrayBuffer(),
|
||||
// 国内:cn 全球:global
|
||||
region: 'cn',
|
||||
styles: {
|
||||
width: '100%',
|
||||
minHeight: "600px",
|
||||
height: 'auto',
|
||||
maxHeight: '1200px'
|
||||
}
|
||||
})
|
||||
})()
|
||||
},
|
||||
|
||||
methods: {
|
||||
/**
|
||||
* 打开本地思维导图文件
|
||||
*/
|
||||
async handleOpenLocalBtnClick() {
|
||||
const fileSelector = document.createElement('input')
|
||||
fileSelector.style.display = 'none'
|
||||
document.body.appendChild(fileSelector)
|
||||
await new Promise(resolve => {
|
||||
fileSelector.setAttribute('type', 'file')
|
||||
fileSelector.setAttribute('accept', '.xmind')
|
||||
fileSelector.addEventListener('change', () => {
|
||||
resolve()
|
||||
})
|
||||
fileSelector.click()
|
||||
}).finally(() => {
|
||||
document.body.removeChild(fileSelector)
|
||||
})
|
||||
if (!fileSelector.files || !fileSelector.files.length) {
|
||||
return
|
||||
}
|
||||
const file = fileSelector.files[0]
|
||||
if (!file)
|
||||
return
|
||||
|
||||
const data = await file.arrayBuffer()
|
||||
this.viewer.load(data)
|
||||
},
|
||||
/**
|
||||
* 恢复缩放比例
|
||||
*/
|
||||
async handleZoomScaleRevertBtnClick() {
|
||||
this.viewer.setFitMap()
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
|
||||
.btn-container {
|
||||
margin: 50px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.select {
|
||||
display: inline-block;
|
||||
width: 200px;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
color: #555;
|
||||
border: 1px solid #aaa;
|
||||
text-shadow: none;
|
||||
border-radius: 4px;
|
||||
transition: box-shadow 0.25s ease;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.select:hover {
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.select:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border: 10px solid transparent;
|
||||
border-top-color: #ccc;
|
||||
top: 14px;
|
||||
right: 10px;
|
||||
cursor: pointer;
|
||||
z-index: -2;
|
||||
}
|
||||
|
||||
.select select {
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
border: none;
|
||||
background: transparent none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
|
||||
.select select:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#x-mind-manager-container {
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
}
|
||||
|
||||
button {
|
||||
background: #eb94d0;
|
||||
/* 创建渐变 */
|
||||
background-image: -webkit-linear-gradient(top, #eb94d0, #2079b0);
|
||||
background-image: -moz-linear-gradient(top, #eb94d0, #2079b0);
|
||||
background-image: -ms-linear-gradient(top, #eb94d0, #2079b0);
|
||||
background-image: -o-linear-gradient(top, #eb94d0, #2079b0);
|
||||
background-image: linear-gradient(to bottom, #eb94d0, #2079b0);
|
||||
/* 给按钮添加圆角 */
|
||||
-webkit-border-radius: 20px;
|
||||
-moz-border-radius: 20px;
|
||||
border-radius: 10px;
|
||||
-moz-box-shadow: 6px 5px 24px #666666;
|
||||
font-family: Arial, serif;
|
||||
margin: 5px;
|
||||
color: #fafafa;
|
||||
font-size: 14px;
|
||||
padding: 5px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* 悬停样式 */
|
||||
button:hover {
|
||||
cursor: pointer;
|
||||
background: #2079b0;
|
||||
background-image: -webkit-linear-gradient(top, #2079b0, #eb94d0);
|
||||
background-image: -ms-linear-gradient(top, #2079b0, #eb94d0);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
import {searchProPlugin} from "vuepress-plugin-search-pro";
|
||||
import {mdEnhancePlugin} from "vuepress-plugin-md-enhance";
|
||||
import {path} from "@vuepress/utils";
|
||||
import {registerComponentsPlugin} from "@vuepress/plugin-register-components";
|
||||
|
||||
console.log(path.resolve(__dirname, './components/HelloWorld.vue'))
|
||||
/**
|
||||
* 插件配置
|
||||
*/
|
||||
export default {
|
||||
plugins: [
|
||||
// 组件注册,参考:https://v2.vuepress.vuejs.org/zh/reference/plugin/register-components.html
|
||||
registerComponentsPlugin({
|
||||
componentsDir: path.resolve(__dirname, '../components'),
|
||||
// components: {
|
||||
// HelloWorld: path.resolve(__dirname, '../components/HelloWorld.vue')
|
||||
// }
|
||||
}),
|
||||
searchProPlugin({
|
||||
// 索引全部内容
|
||||
indexContent: true,
|
||||
|
||||
@@ -104,6 +104,8 @@ export default {
|
||||
container: true,
|
||||
// mermaid
|
||||
mermaid: true,
|
||||
// 自定义对齐
|
||||
align: true,
|
||||
},
|
||||
components: {
|
||||
// 插件选项
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/style.css">
|
||||
<link rel="stylesheet" href="https://unpkg.com/markmap-toolbar@0.15.4/dist/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<svg id="mindmap"></svg>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3@7.8.5/dist/d3.min.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
<script src="https://unpkg.com/d3@7.8.5/dist/d3.min.js"></script><script src="https://unpkg.com/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://unpkg.com/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
setTimeout(r);
|
||||
})(() => {
|
||||
const {
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/style.css">
|
||||
<link rel="stylesheet" href="https://unpkg.com/markmap-toolbar@0.15.4/dist/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<svg id="mindmap"></svg>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3@7.8.5/dist/d3.min.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
<script src="https://unpkg.com/d3@7.8.5/dist/d3.min.js"></script><script src="https://unpkg.com/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://unpkg.com/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
setTimeout(r);
|
||||
})(() => {
|
||||
const {
|
||||
|
||||
BIN
docs/.vuepress/public/mark-map/cn.xmind
Normal file
BIN
docs/.vuepress/public/mark-map/cn.xmind
Normal file
Binary file not shown.
BIN
docs/.vuepress/public/mark-map/cpp.xmind
Normal file
BIN
docs/.vuepress/public/mark-map/cpp.xmind
Normal file
Binary file not shown.
@@ -16,11 +16,11 @@
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/style.css">
|
||||
<link rel="stylesheet" href="https://unpkg.com/markmap-toolbar@0.15.4/dist/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<svg id="mindmap"></svg>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3@7.8.5/dist/d3.min.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
<script src="https://unpkg.com/d3@7.8.5/dist/d3.min.js"></script><script src="https://unpkg.com/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://unpkg.com/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
setTimeout(r);
|
||||
})(() => {
|
||||
const {
|
||||
|
||||
BIN
docs/.vuepress/public/mark-map/ds.xmind
Normal file
BIN
docs/.vuepress/public/mark-map/ds.xmind
Normal file
Binary file not shown.
30
docs/.vuepress/public/mark-map/index.json
Normal file
30
docs/.vuepress/public/mark-map/index.json
Normal file
@@ -0,0 +1,30 @@
|
||||
[
|
||||
{
|
||||
"name": "数据结构",
|
||||
"originXmindFileName": "数据结构.xmind",
|
||||
"targetXmindFileName": "ds.xmind",
|
||||
"xMindPath": "../mark-map/ds.xmind",
|
||||
"mdPath": "../mark-map/ds-map.md"
|
||||
},
|
||||
{
|
||||
"name": "操作系统",
|
||||
"originXmindFileName": "操作系统.xmind",
|
||||
"targetXmindFileName": "os.xmind",
|
||||
"xMindPath": "../mark-map/os.xmind",
|
||||
"mdPath": "../mark-map/os-map.md"
|
||||
},
|
||||
{
|
||||
"name": "计算机组成原理",
|
||||
"originXmindFileName": "计算机组成原理.xmind",
|
||||
"targetXmindFileName": "cpp.xmind",
|
||||
"xMindPath": "../mark-map/cpp.xmind",
|
||||
"mdPath": "../mark-map/ccp-map.md"
|
||||
},
|
||||
{
|
||||
"name": "计算机网络",
|
||||
"originXmindFileName": "计算机网络.xmind",
|
||||
"targetXmindFileName": "cn.xmind",
|
||||
"xMindPath": "../mark-map/cn.xmind",
|
||||
"mdPath": "../mark-map/cn-map.md"
|
||||
}
|
||||
]
|
||||
@@ -16,11 +16,11 @@
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/style.css">
|
||||
<link rel="stylesheet" href="https://unpkg.com/markmap-toolbar@0.15.4/dist/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<svg id="mindmap"></svg>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3@7.8.5/dist/d3.min.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
<script src="https://unpkg.com/d3@7.8.5/dist/d3.min.js"></script><script src="https://unpkg.com/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://unpkg.com/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
setTimeout(r);
|
||||
})(() => {
|
||||
const {
|
||||
|
||||
BIN
docs/.vuepress/public/mark-map/os.xmind
Normal file
BIN
docs/.vuepress/public/mark-map/os.xmind
Normal file
Binary file not shown.
@@ -16,11 +16,11 @@
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/style.css">
|
||||
<link rel="stylesheet" href="https://unpkg.com/markmap-toolbar@0.15.4/dist/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<svg id="mindmap"></svg>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3@7.8.5/dist/d3.min.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
<script src="https://unpkg.com/d3@7.8.5/dist/d3.min.js"></script><script src="https://unpkg.com/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://unpkg.com/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
setTimeout(r);
|
||||
})(() => {
|
||||
const {
|
||||
|
||||
30
docs/manuscripts/mark-map/index.json
Normal file
30
docs/manuscripts/mark-map/index.json
Normal file
@@ -0,0 +1,30 @@
|
||||
[
|
||||
{
|
||||
"name": "数据结构",
|
||||
"originXmindFileName": "数据结构.xmind",
|
||||
"targetXmindFileName": "ds.xmind",
|
||||
"xMindPath": "../mark-map/ds.xmind",
|
||||
"mdPath": "../mark-map/ds-map.md"
|
||||
},
|
||||
{
|
||||
"name": "操作系统",
|
||||
"originXmindFileName": "操作系统.xmind",
|
||||
"targetXmindFileName": "os.xmind",
|
||||
"xMindPath": "../mark-map/os.xmind",
|
||||
"mdPath": "../mark-map/os-map.md"
|
||||
},
|
||||
{
|
||||
"name": "计算机组成原理",
|
||||
"originXmindFileName": "计算机组成原理.xmind",
|
||||
"targetXmindFileName": "cpp.xmind",
|
||||
"xMindPath": "../mark-map/cpp.xmind",
|
||||
"mdPath": "../mark-map/ccp-map.md"
|
||||
},
|
||||
{
|
||||
"name": "计算机网络",
|
||||
"originXmindFileName": "计算机网络.xmind",
|
||||
"targetXmindFileName": "cn.xmind",
|
||||
"xMindPath": "../mark-map/cn.xmind",
|
||||
"mdPath": "../mark-map/cn-map.md"
|
||||
}
|
||||
]
|
||||
@@ -8,4 +8,6 @@
|
||||
- <a href="../../mark-map/cn-map.html" target="_blank">计算机网络</a>
|
||||
|
||||
|
||||
<XMindManager></XMindManager>
|
||||
|
||||
|
||||
|
||||
BIN
docs/manuscripts/mark-map/操作系统.xmind
Normal file
BIN
docs/manuscripts/mark-map/操作系统.xmind
Normal file
Binary file not shown.
BIN
docs/manuscripts/mark-map/操作系统发展历程.xmind
Normal file
BIN
docs/manuscripts/mark-map/操作系统发展历程.xmind
Normal file
Binary file not shown.
BIN
docs/manuscripts/mark-map/数据结构.xmind
Normal file
BIN
docs/manuscripts/mark-map/数据结构.xmind
Normal file
Binary file not shown.
BIN
docs/manuscripts/mark-map/计算机组成原理.xmind
Normal file
BIN
docs/manuscripts/mark-map/计算机组成原理.xmind
Normal file
Binary file not shown.
BIN
docs/manuscripts/mark-map/计算机网络.xmind
Normal file
BIN
docs/manuscripts/mark-map/计算机网络.xmind
Normal file
Binary file not shown.
@@ -143,8 +143,15 @@ yarn run dev
|
||||
|
||||
感谢向仓库提交mr的所有开发者
|
||||
|
||||
::: right
|
||||
|
||||
323232
|
||||
|
||||
:::
|
||||
|
||||
[](https://github.com/142vip/408CSFamily/graphs/contributors)
|
||||
|
||||
|
||||
### 趋势
|
||||
|
||||
<div style="text-align: center" align="center">
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"@vuepress/client": "^2.0.0-beta.67",
|
||||
"@vuepress/plugin-register-components": "2.0.0-beta.67",
|
||||
"@vuepress/utils": "^2.0.0-beta.67",
|
||||
"bumpp": "^9.2.0",
|
||||
"commit-and-tag-version": "^11.2.4",
|
||||
@@ -56,7 +57,8 @@
|
||||
"vuepress-plugin-md-enhance": "^2.0.0-beta.237",
|
||||
"vuepress-plugin-search-pro": "^2.0.0-beta.237",
|
||||
"vuepress-theme-hope": "^2.0.0-beta.237",
|
||||
"webpack": "^5.88.2"
|
||||
"webpack": "^5.88.2",
|
||||
"xmind-embed-viewer": "^1.2.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
|
||||
19
pnpm-lock.yaml
generated
19
pnpm-lock.yaml
generated
@@ -4,6 +4,7 @@ specifiers:
|
||||
'@typescript-eslint/eslint-plugin': ^5.62.0
|
||||
'@typescript-eslint/parser': ^5.62.0
|
||||
'@vuepress/client': ^2.0.0-beta.67
|
||||
'@vuepress/plugin-register-components': 2.0.0-beta.67
|
||||
'@vuepress/utils': ^2.0.0-beta.67
|
||||
bumpp: ^9.2.0
|
||||
commit-and-tag-version: ^11.2.4
|
||||
@@ -26,11 +27,13 @@ specifiers:
|
||||
vuepress-plugin-search-pro: ^2.0.0-beta.237
|
||||
vuepress-theme-hope: ^2.0.0-beta.237
|
||||
webpack: ^5.88.2
|
||||
xmind-embed-viewer: ^1.2.0
|
||||
|
||||
devDependencies:
|
||||
'@typescript-eslint/eslint-plugin': 5.62.0_3iz6pru4e7qejel7wzajszboby
|
||||
'@typescript-eslint/parser': 5.62.0_a53yqesurnxlupy6jnu3bp6z7y
|
||||
'@vuepress/client': 2.0.0-beta.67
|
||||
'@vuepress/plugin-register-components': 2.0.0-beta.67
|
||||
'@vuepress/utils': 2.0.0-beta.67
|
||||
bumpp: 9.2.0
|
||||
commit-and-tag-version: 11.2.4
|
||||
@@ -53,6 +56,7 @@ devDependencies:
|
||||
vuepress-plugin-search-pro: 2.0.0-beta.237_vuepress@2.0.0-beta.67
|
||||
vuepress-theme-hope: 2.0.0-beta.237_vuepress@2.0.0-beta.67
|
||||
webpack: 5.88.2
|
||||
xmind-embed-viewer: 1.2.0
|
||||
|
||||
packages:
|
||||
|
||||
@@ -2971,6 +2975,17 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@vuepress/plugin-register-components/2.0.0-beta.67:
|
||||
resolution: {integrity: sha512-dbdCnlY/MAzyrycwIONDOtZbHvv2r5yenXPO18IOy5bAFnlaEOL2RfPjD6MqRlYS3aZD7om21RV3RxGHJabHew==}
|
||||
dependencies:
|
||||
'@vuepress/core': 2.0.0-beta.67
|
||||
'@vuepress/utils': 2.0.0-beta.67
|
||||
chokidar: 3.5.3
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@vuepress/plugin-theme-data/2.0.0-beta.67:
|
||||
resolution: {integrity: sha512-emTj1fvYXM/+WWObmgR0STRwkcDEM9QLD9ZP/JK5hEdt9KQnl8qO9NIzVfP/acgqbxFJQVvsmMSruXXknN68FQ==}
|
||||
dependencies:
|
||||
@@ -11397,6 +11412,10 @@ packages:
|
||||
os-paths: 4.4.0
|
||||
dev: true
|
||||
|
||||
/xmind-embed-viewer/1.2.0:
|
||||
resolution: {integrity: sha512-dtsxbeePxhSy3g/Kyc4Oe1K3hfdCmkiyRtvONN2KZ2MqeL/QBFTvL4imCiXfAiLpincl42r87OOA3V3Shcza4A==}
|
||||
dev: true
|
||||
|
||||
/xml-js/1.6.11:
|
||||
resolution: {integrity: sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==}
|
||||
hasBin: true
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
const {execShell} = require("./.exec");
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const markMapPath = path.join(__dirname, '../', 'docs/manuscripts/mark-map')
|
||||
const markMapHtmlPath = path.join(__dirname, '../', 'docs/.vuepress/public/mark-map')
|
||||
const markMapSourcePath = path.join(__dirname, '../', 'docs/manuscripts/mark-map')
|
||||
const markMapTargetPath = path.join(__dirname, '../', 'docs/.vuepress/public/mark-map')
|
||||
|
||||
|
||||
/**
|
||||
@@ -35,12 +35,12 @@ function scanDirectory(directory, fileType) {
|
||||
/**
|
||||
* 第一步: 清空站点思维导图文件存放目录
|
||||
*/
|
||||
const delHtmlDir = `rm -rf ${path.join(markMapHtmlPath, '*')}`
|
||||
const delHtmlDir = `rm -rf ${path.join(markMapTargetPath, '*')}`
|
||||
|
||||
/**
|
||||
* 第二步: 将md文档转化为思维导图网页
|
||||
*/
|
||||
const mdList = scanDirectory(markMapPath, 'md')
|
||||
const mdList = scanDirectory(markMapSourcePath, 'md')
|
||||
const mdToHtmlCmdStr = mdList.map(md => `markmap --no-open ${md}`).join(' && ')
|
||||
|
||||
|
||||
@@ -48,9 +48,44 @@ function scanDirectory(directory, fileType) {
|
||||
* 第三步: 根据文件类型将思维导图网页文件移动到站点指定目录
|
||||
*
|
||||
*/
|
||||
const mdHtmlByFileType = path.join(markMapPath, '*.html')
|
||||
const moveHtmlCmdStr = `mv -f ${mdHtmlByFileType} ${markMapHtmlPath}`
|
||||
const mdHtmlByFileType = path.join(markMapSourcePath, '*.html')
|
||||
const moveHtmlCmdStr = `mv -f ${mdHtmlByFileType} ${markMapTargetPath}`
|
||||
|
||||
await execShell([delHtmlDir, mdToHtmlCmdStr, moveHtmlCmdStr])
|
||||
/**
|
||||
* 第四步: 将xmind思维导图原件复制到指定目录
|
||||
*
|
||||
*/
|
||||
const xmindByFileType = path.join(markMapSourcePath, '*.xmind')
|
||||
const cpXmindCmdStr = `cp -f ${xmindByFileType} ${markMapTargetPath}`
|
||||
|
||||
|
||||
/**
|
||||
* 第五步: 复制mark-map对应的json文件
|
||||
*/
|
||||
const cpIndexJsonCmdStr = `cp -f ${path.join(markMapSourcePath, 'index.json')} ${markMapTargetPath}`
|
||||
|
||||
|
||||
// 脚本执行
|
||||
await execShell([
|
||||
delHtmlDir,
|
||||
mdToHtmlCmdStr,
|
||||
moveHtmlCmdStr,
|
||||
cpXmindCmdStr,
|
||||
cpIndexJsonCmdStr
|
||||
])
|
||||
|
||||
/**
|
||||
* 第六步: 对mark-map中的xmind文件重命名
|
||||
*
|
||||
*/
|
||||
|
||||
const markMapData = require(path.join(markMapTargetPath, 'index.json'))
|
||||
|
||||
|
||||
for (const {originXmindFileName, targetXmindFileName} of markMapData) {
|
||||
const originPath = path.join(markMapTargetPath, originXmindFileName)
|
||||
const targetPath = path.join(markMapTargetPath, targetXmindFileName)
|
||||
await fs.renameSync(originPath, targetPath)
|
||||
}
|
||||
|
||||
})()
|
||||
Reference in New Issue
Block a user