From eb01646747cfcd64d7184e3c9be8d314ae3d2335 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Tue, 17 Jan 2023 14:11:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E5=8F=96=E6=B0=B4=E5=8D=B0=E7=B1=BB?= =?UTF-8?q?=E4=BD=9C=E4=B8=BA=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/index.js | 6 ------ simple-mind-map/src/Watermark.js | 6 +++++- web/src/pages/Doc/en/constructor/index.md | 4 +++- web/src/pages/Doc/en/constructor/index.vue | 3 ++- web/src/pages/Doc/en/introduction/index.md | 2 +- web/src/pages/Doc/en/introduction/index.vue | 2 +- web/src/pages/Doc/en/miniMap/index.md | 13 +++++++++++-- web/src/pages/Doc/en/miniMap/index.vue | 10 ++++++++-- web/src/pages/Doc/en/watermark/index.md | 16 +++++++++++++--- web/src/pages/Doc/en/watermark/index.vue | 12 +++++++++--- web/src/pages/Doc/routerList.js | 2 +- web/src/pages/Doc/zh/constructor/index.md | 4 +++- web/src/pages/Doc/zh/constructor/index.vue | 3 ++- web/src/pages/Doc/zh/introduction/index.md | 2 +- web/src/pages/Doc/zh/introduction/index.vue | 2 +- web/src/pages/Doc/zh/miniMap/index.md | 13 +++++++++++-- web/src/pages/Doc/zh/miniMap/index.vue | 10 ++++++++-- web/src/pages/Doc/zh/watermark/index.md | 15 +++++++++++++-- web/src/pages/Doc/zh/watermark/index.vue | 11 +++++++++-- web/src/pages/Edit/components/Edit.vue | 5 ++++- 20 files changed, 106 insertions(+), 35 deletions(-) diff --git a/simple-mind-map/index.js b/simple-mind-map/index.js index 9f45265e..83420a66 100644 --- a/simple-mind-map/index.js +++ b/simple-mind-map/index.js @@ -10,7 +10,6 @@ import BatchExecution from './src/BatchExecution' import Export from './src/Export' import Select from './src/Select' import Drag from './src/Drag' -import Watermark from './src/Watermark' import { layoutValueList } from './src/utils/constant' import { SVG } from '@svgdotjs/svg.js' import { simpleDeepClone } from './src/utils' @@ -138,11 +137,6 @@ class MindMap { mindMap: this }) - // 水印类 - this.watermark = new Watermark({ - mindMap: this - }) - // 批量执行类 this.batchExecution = new BatchExecution() diff --git a/simple-mind-map/src/Watermark.js b/simple-mind-map/src/Watermark.js index 2d740fb2..0a1985a4 100644 --- a/simple-mind-map/src/Watermark.js +++ b/simple-mind-map/src/Watermark.js @@ -3,7 +3,7 @@ import { degToRad, camelCaseToHyphen } from './utils' import merge from 'deepmerge' // 水印类 -export default class Watermark { +class Watermark { constructor(opt = {}) { this.mindMap = opt.mindMap this.lineSpacing = 0 // 水印行间距 @@ -109,3 +109,7 @@ export default class Watermark { this.draw() } } + +Watermark.instanceName = 'watermark' + +export default Watermark \ No newline at end of file diff --git a/web/src/pages/Doc/en/constructor/index.md b/web/src/pages/Doc/en/constructor/index.md index 3c159c70..71d31470 100644 --- a/web/src/pages/Doc/en/constructor/index.md +++ b/web/src/pages/Doc/en/constructor/index.md @@ -85,7 +85,9 @@ For all configurations of theme, please refer to [Default Topic](https://github. > v0.3.0+ -If you need to use some non-core functions, such as mini map, watermark, etc, you can register plugin through this method. +If you need to use some non-core functions, such as mini map, watermark, etc, you can register plugin through this method. Can be called in chain. + +Note: The plugin needs to be registered before instantiating `MindMap`. ## Static props diff --git a/web/src/pages/Doc/en/constructor/index.vue b/web/src/pages/Doc/en/constructor/index.vue index adfeacee..1a0fa82a 100644 --- a/web/src/pages/Doc/en/constructor/index.vue +++ b/web/src/pages/Doc/en/constructor/index.vue @@ -211,7 +211,8 @@ mindMap.setTheme('Theme name')

v0.3.0+

-

If you need to use some non-core functions, such as mini map, watermark, etc, you can register plugin through this method.

+

If you need to use some non-core functions, such as mini map, watermark, etc, you can register plugin through this method. Can be called in chain.

+

Note: The plugin needs to be registered before instantiating MindMap.

Static props

pluginList

diff --git a/web/src/pages/Doc/en/introduction/index.md b/web/src/pages/Doc/en/introduction/index.md index 859b96f8..f65f745d 100644 --- a/web/src/pages/Doc/en/introduction/index.md +++ b/web/src/pages/Doc/en/introduction/index.md @@ -16,7 +16,7 @@ - [x] Supports free dragging and dragging to adjust nodes - [x] Supports various node shapes - [x] Supports export to json, png, svg, pdf, and import from json, xmind -- [x] Supports mini map +- [x] Supports mini map、support watermark ## Table of Contents diff --git a/web/src/pages/Doc/en/introduction/index.vue b/web/src/pages/Doc/en/introduction/index.vue index 5c3fd50d..3b677ebc 100644 --- a/web/src/pages/Doc/en/introduction/index.vue +++ b/web/src/pages/Doc/en/introduction/index.vue @@ -16,7 +16,7 @@ summaries
  • -
  • +
  • Table of Contents

    1.simple-mind-map

    diff --git a/web/src/pages/Doc/en/miniMap/index.md b/web/src/pages/Doc/en/miniMap/index.md index 0492c671..0e82ce40 100644 --- a/web/src/pages/Doc/en/miniMap/index.md +++ b/web/src/pages/Doc/en/miniMap/index.md @@ -1,4 +1,4 @@ -# MiniMap instance +# MiniMap plugin > v0.2.11+ @@ -8,7 +8,16 @@ When zoomed, moved, or there are too many elements, the canvas may only display part of the mind map content. The viewport frame can be used to view the current viewport location, and can be quickly positioned by dragging on the small map. -The `mindMap.miniMap` instance can be obtained through this. +## Register + +```js +import MindMap from 'simple-mind-map' +import MiniMap from 'simple-mind-map/src/MiniMap.js' + +MindMap.usePlugin(MiniMap) +``` + +After registration and instantiation of `MindMap`, the instance can be obtained through `mindMap.miniMap`. ## Methods diff --git a/web/src/pages/Doc/en/miniMap/index.vue b/web/src/pages/Doc/en/miniMap/index.vue index 1f231a4f..d8be49ff 100644 --- a/web/src/pages/Doc/en/miniMap/index.vue +++ b/web/src/pages/Doc/en/miniMap/index.vue @@ -1,6 +1,6 @@