From 45cc199d7f7d322efdf7c880c4d28a933bbc46d4 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Thu, 8 Jun 2023 16:49:54 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=A0=B8=E5=BF=83=E5=BA=93=E4=BB=A3=E7=A0=81=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/full.js | 16 ++++---- simple-mind-map/index.js | 16 ++++---- simple-mind-map/package.json | 2 +- .../src/{utils => constants}/constant.js | 0 .../src/{ => core/command}/Command.js | 2 +- .../src/{ => core/command}/KeyCommand.js | 2 +- .../src/{utils => core/command}/keyMap.js | 0 simple-mind-map/src/{ => core/event}/Event.js | 2 +- .../src/{ => core/render}/Render.js | 20 +++++----- .../src/{ => core/render}/TextEdit.js | 2 +- .../src/{ => core/render/node}/Node.js | 12 +++--- .../src/{ => core/render/node}/Shape.js | 2 +- .../src/{ => core/render/node}/Style.js | 2 +- .../render/node}/nodeCommandWraps.js | 0 .../render/node}/nodeCreateContents.js | 6 +-- .../render/node}/nodeExpandBtn.js | 2 +- .../render/node}/nodeGeneralization.js | 2 +- simple-mind-map/src/{ => core/view}/View.js | 2 +- simple-mind-map/src/layouts/Base.js | 4 +- simple-mind-map/src/layouts/Fishbone.js | 2 +- simple-mind-map/src/layouts/Timeline.js | 2 +- .../src/{ => plugins}/AssociativeLine.js | 8 ++-- simple-mind-map/src/{ => plugins}/Drag.js | 4 +- simple-mind-map/src/{ => plugins}/Export.js | 6 +-- .../src/{ => plugins}/KeyboardNavigation.js | 4 +- simple-mind-map/src/{ => plugins}/MiniMap.js | 0 simple-mind-map/src/{ => plugins}/RichText.js | 4 +- simple-mind-map/src/{ => plugins}/Select.js | 2 +- .../src/{ => plugins}/Watermark.js | 2 +- .../associativeLineControls.js | 0 .../associativeLine}/associativeLineText.js | 2 +- .../associativeLine}/associativeLineUtils.js | 0 .../src/{ => utils}/BatchExecution.js | 2 +- web/src/pages/Doc/en/associativeLine/index.md | 3 +- .../pages/Doc/en/associativeLine/index.vue | 3 +- web/src/pages/Doc/en/changelog/index.md | 4 ++ web/src/pages/Doc/en/changelog/index.vue | 2 + web/src/pages/Doc/en/constructor/index.md | 14 +++---- web/src/pages/Doc/en/constructor/index.vue | 14 +++---- web/src/pages/Doc/en/doExport/index.md | 3 +- web/src/pages/Doc/en/doExport/index.vue | 3 +- web/src/pages/Doc/en/drag/index.md | 3 +- web/src/pages/Doc/en/drag/index.vue | 3 +- web/src/pages/Doc/en/introduction/index.md | 2 + web/src/pages/Doc/en/introduction/index.vue | 37 ++++++++++--------- web/src/pages/Doc/en/keyCommand/index.md | 2 +- web/src/pages/Doc/en/keyCommand/index.vue | 2 +- .../pages/Doc/en/keyboardNavigation/index.md | 3 +- .../pages/Doc/en/keyboardNavigation/index.vue | 3 +- web/src/pages/Doc/en/miniMap/index.md | 3 +- web/src/pages/Doc/en/miniMap/index.vue | 3 +- web/src/pages/Doc/en/richText/index.md | 3 +- web/src/pages/Doc/en/richText/index.vue | 3 +- web/src/pages/Doc/en/select/index.md | 3 +- web/src/pages/Doc/en/select/index.vue | 3 +- web/src/pages/Doc/en/watermark/index.md | 3 +- web/src/pages/Doc/en/watermark/index.vue | 3 +- web/src/pages/Doc/zh/associativeLine/index.md | 3 +- .../pages/Doc/zh/associativeLine/index.vue | 3 +- web/src/pages/Doc/zh/changelog/index.md | 4 ++ web/src/pages/Doc/zh/changelog/index.vue | 2 + web/src/pages/Doc/zh/constructor/index.md | 14 +++---- web/src/pages/Doc/zh/constructor/index.vue | 14 +++---- web/src/pages/Doc/zh/course10/index.md | 3 +- web/src/pages/Doc/zh/course10/index.vue | 3 +- web/src/pages/Doc/zh/course8/index.md | 3 +- web/src/pages/Doc/zh/course8/index.vue | 3 +- web/src/pages/Doc/zh/doExport/index.md | 3 +- web/src/pages/Doc/zh/doExport/index.vue | 3 +- web/src/pages/Doc/zh/drag/index.md | 3 +- web/src/pages/Doc/zh/drag/index.vue | 3 +- web/src/pages/Doc/zh/introduction/index.md | 2 + web/src/pages/Doc/zh/introduction/index.vue | 37 ++++++++++--------- web/src/pages/Doc/zh/keyCommand/index.md | 2 +- web/src/pages/Doc/zh/keyCommand/index.vue | 2 +- .../pages/Doc/zh/keyboardNavigation/index.md | 3 +- .../pages/Doc/zh/keyboardNavigation/index.vue | 3 +- web/src/pages/Doc/zh/miniMap/index.md | 3 +- web/src/pages/Doc/zh/miniMap/index.vue | 3 +- web/src/pages/Doc/zh/richText/index.md | 3 +- web/src/pages/Doc/zh/richText/index.vue | 3 +- web/src/pages/Doc/zh/select/index.md | 3 +- web/src/pages/Doc/zh/select/index.vue | 3 +- web/src/pages/Doc/zh/watermark/index.md | 3 +- web/src/pages/Doc/zh/watermark/index.vue | 3 +- web/src/pages/Edit/components/Edit.vue | 16 ++++---- web/src/pages/Edit/components/NodeTag.vue | 2 +- web/src/pages/Edit/components/Structure.vue | 2 +- web/src/pages/Edit/components/Theme.vue | 2 +- 89 files changed, 235 insertions(+), 181 deletions(-) rename simple-mind-map/src/{utils => constants}/constant.js (100%) rename simple-mind-map/src/{ => core/command}/Command.js (98%) rename simple-mind-map/src/{ => core/command}/KeyCommand.js (98%) rename simple-mind-map/src/{utils => core/command}/keyMap.js (100%) rename simple-mind-map/src/{ => core/event}/Event.js (98%) rename simple-mind-map/src/{ => core/render}/Render.js (98%) rename simple-mind-map/src/{ => core/render}/TextEdit.js (98%) rename simple-mind-map/src/{ => core/render/node}/Node.js (98%) rename simple-mind-map/src/{ => core/render/node}/Shape.js (99%) rename simple-mind-map/src/{ => core/render/node}/Style.js (98%) rename simple-mind-map/src/{utils => core/render/node}/nodeCommandWraps.js (100%) rename simple-mind-map/src/{utils => core/render/node}/nodeCreateContents.js (98%) rename simple-mind-map/src/{utils => core/render/node}/nodeExpandBtn.js (98%) rename simple-mind-map/src/{utils => core/render/node}/nodeGeneralization.js (99%) rename simple-mind-map/src/{ => core/view}/View.js (98%) rename simple-mind-map/src/{ => plugins}/AssociativeLine.js (98%) rename simple-mind-map/src/{ => plugins}/Drag.js (99%) rename simple-mind-map/src/{ => plugins}/Export.js (97%) rename simple-mind-map/src/{ => plugins}/KeyboardNavigation.js (98%) rename simple-mind-map/src/{ => plugins}/MiniMap.js (100%) rename simple-mind-map/src/{ => plugins}/RichText.js (99%) rename simple-mind-map/src/{ => plugins}/Select.js (99%) rename simple-mind-map/src/{ => plugins}/Watermark.js (98%) rename simple-mind-map/src/{utils => plugins/associativeLine}/associativeLineControls.js (100%) rename simple-mind-map/src/{utils => plugins/associativeLine}/associativeLineText.js (98%) rename simple-mind-map/src/{utils => plugins/associativeLine}/associativeLineUtils.js (100%) rename simple-mind-map/src/{ => utils}/BatchExecution.js (94%) diff --git a/simple-mind-map/full.js b/simple-mind-map/full.js index 80048f10..9171aecb 100644 --- a/simple-mind-map/full.js +++ b/simple-mind-map/full.js @@ -1,12 +1,12 @@ import MindMap from './index' -import MiniMap from './src/MiniMap.js' -import Watermark from './src/Watermark.js' -import KeyboardNavigation from './src/KeyboardNavigation.js' -import Export from './src/Export.js' -import Drag from './src/Drag.js' -import Select from './src/Select.js' -import AssociativeLine from './src/AssociativeLine' -import RichText from './src/RichText' +import MiniMap from './src/plugins/MiniMap.js' +import Watermark from './src/plugins/Watermark.js' +import KeyboardNavigation from './src/plugins/KeyboardNavigation.js' +import Export from './src/plugins/Export.js' +import Drag from './src/plugins/Drag.js' +import Select from './src/plugins/Select.js' +import AssociativeLine from './src/plugins/AssociativeLine' +import RichText from './src/plugins/RichText' import xmind from './src/parse/xmind.js' import markdown from './src/parse/markdown.js' import icons from './src/svg/icons.js' diff --git a/simple-mind-map/index.js b/simple-mind-map/index.js index 1b283f4c..224a0249 100644 --- a/simple-mind-map/index.js +++ b/simple-mind-map/index.js @@ -1,13 +1,13 @@ -import View from './src/View' -import Event from './src/Event' -import Render from './src/Render' +import View from './src/core/view/View' +import Event from './src/core/event/Event' +import Render from './src/core/render/Render' import merge from 'deepmerge' import theme from './src/themes' -import Style from './src/Style' -import KeyCommand from './src/KeyCommand' -import Command from './src/Command' -import BatchExecution from './src/BatchExecution' -import { layoutValueList, CONSTANTS } from './src/utils/constant' +import Style from './src/core/render/node/Style' +import KeyCommand from './src/core/command/KeyCommand' +import Command from './src/core/command/Command' +import BatchExecution from './src/utils/BatchExecution' +import { layoutValueList, CONSTANTS } from './src/constants/constant' import { SVG } from '@svgdotjs/svg.js' import { simpleDeepClone } from './src/utils' import defaultTheme, { checkIsNodeSizeIndependenceConfig } from './src/themes/default' diff --git a/simple-mind-map/package.json b/simple-mind-map/package.json index a5a08080..9c376248 100644 --- a/simple-mind-map/package.json +++ b/simple-mind-map/package.json @@ -1,6 +1,6 @@ { "name": "simple-mind-map", - "version": "0.5.11", + "version": "0.6.0", "description": "一个简单的web在线思维导图", "authors": [ { diff --git a/simple-mind-map/src/utils/constant.js b/simple-mind-map/src/constants/constant.js similarity index 100% rename from simple-mind-map/src/utils/constant.js rename to simple-mind-map/src/constants/constant.js diff --git a/simple-mind-map/src/Command.js b/simple-mind-map/src/core/command/Command.js similarity index 98% rename from simple-mind-map/src/Command.js rename to simple-mind-map/src/core/command/Command.js index b1c35c57..2a5f3115 100644 --- a/simple-mind-map/src/Command.js +++ b/simple-mind-map/src/core/command/Command.js @@ -1,4 +1,4 @@ -import { copyRenderTree, simpleDeepClone, nextTick } from './utils' +import { copyRenderTree, simpleDeepClone, nextTick } from '../../utils' // 命令类 class Command { diff --git a/simple-mind-map/src/KeyCommand.js b/simple-mind-map/src/core/command/KeyCommand.js similarity index 98% rename from simple-mind-map/src/KeyCommand.js rename to simple-mind-map/src/core/command/KeyCommand.js index 579e219a..cc7a772b 100644 --- a/simple-mind-map/src/KeyCommand.js +++ b/simple-mind-map/src/core/command/KeyCommand.js @@ -1,4 +1,4 @@ -import { keyMap } from './utils/keyMap' +import { keyMap } from './keyMap' // 快捷按键、命令处理类 export default class KeyCommand { // 构造函数 diff --git a/simple-mind-map/src/utils/keyMap.js b/simple-mind-map/src/core/command/keyMap.js similarity index 100% rename from simple-mind-map/src/utils/keyMap.js rename to simple-mind-map/src/core/command/keyMap.js diff --git a/simple-mind-map/src/Event.js b/simple-mind-map/src/core/event/Event.js similarity index 98% rename from simple-mind-map/src/Event.js rename to simple-mind-map/src/core/event/Event.js index daac439f..708209c4 100644 --- a/simple-mind-map/src/Event.js +++ b/simple-mind-map/src/core/event/Event.js @@ -1,5 +1,5 @@ import EventEmitter from 'eventemitter3' -import { CONSTANTS } from './utils/constant' +import { CONSTANTS } from '../../constants/constant' // 事件类 class Event extends EventEmitter { diff --git a/simple-mind-map/src/Render.js b/simple-mind-map/src/core/render/Render.js similarity index 98% rename from simple-mind-map/src/Render.js rename to simple-mind-map/src/core/render/Render.js index 92ea717e..bbf1a68d 100644 --- a/simple-mind-map/src/Render.js +++ b/simple-mind-map/src/core/render/Render.js @@ -1,15 +1,15 @@ import merge from 'deepmerge' -import LogicalStructure from './layouts/LogicalStructure' -import MindMap from './layouts/MindMap' -import CatalogOrganization from './layouts/CatalogOrganization' -import OrganizationStructure from './layouts/OrganizationStructure' -import Timeline from './layouts/Timeline' -import Fishbone from './layouts/Fishbone' +import LogicalStructure from '../../layouts/LogicalStructure' +import MindMap from '../../layouts/MindMap' +import CatalogOrganization from '../../layouts/CatalogOrganization' +import OrganizationStructure from '../../layouts/OrganizationStructure' +import Timeline from '../../layouts/Timeline' +import Fishbone from '../../layouts/Fishbone' import TextEdit from './TextEdit' -import { copyNodeTree, simpleDeepClone, walk } from './utils' -import { shapeList } from './Shape' -import { lineStyleProps } from './themes/default' -import { CONSTANTS } from './utils/constant' +import { copyNodeTree, simpleDeepClone, walk } from '../../utils' +import { shapeList } from './node/Shape' +import { lineStyleProps } from '../../themes/default' +import { CONSTANTS } from '../../constants/constant' // 布局列表 const layouts = { diff --git a/simple-mind-map/src/TextEdit.js b/simple-mind-map/src/core/render/TextEdit.js similarity index 98% rename from simple-mind-map/src/TextEdit.js rename to simple-mind-map/src/core/render/TextEdit.js index 80d7e90b..3ceda346 100644 --- a/simple-mind-map/src/TextEdit.js +++ b/simple-mind-map/src/core/render/TextEdit.js @@ -1,4 +1,4 @@ -import { getStrWithBrFromHtml, checkNodeOuter } from './utils' +import { getStrWithBrFromHtml, checkNodeOuter } from '../../utils' // 节点文字编辑类 export default class TextEdit { diff --git a/simple-mind-map/src/Node.js b/simple-mind-map/src/core/render/node/Node.js similarity index 98% rename from simple-mind-map/src/Node.js rename to simple-mind-map/src/core/render/node/Node.js index 789c00d5..8884ea69 100644 --- a/simple-mind-map/src/Node.js +++ b/simple-mind-map/src/core/render/node/Node.js @@ -1,12 +1,12 @@ import Style from './Style' import Shape from './Shape' -import { asyncRun } from './utils' +import { asyncRun } from '../../../utils' import { G, Rect } from '@svgdotjs/svg.js' -import nodeGeneralizationMethods from './utils/nodeGeneralization' -import nodeExpandBtnMethods from './utils/nodeExpandBtn' -import nodeCommandWrapsMethods from './utils/nodeCommandWraps' -import nodeCreateContentsMethods from './utils/nodeCreateContents' -import { CONSTANTS } from './utils/constant' +import nodeGeneralizationMethods from './nodeGeneralization' +import nodeExpandBtnMethods from './nodeExpandBtn' +import nodeCommandWrapsMethods from './nodeCommandWraps' +import nodeCreateContentsMethods from './nodeCreateContents' +import { CONSTANTS } from '../../../constants/constant' // 节点类 class Node { diff --git a/simple-mind-map/src/Shape.js b/simple-mind-map/src/core/render/node/Shape.js similarity index 99% rename from simple-mind-map/src/Shape.js rename to simple-mind-map/src/core/render/node/Shape.js index b0df207b..d53d8881 100644 --- a/simple-mind-map/src/Shape.js +++ b/simple-mind-map/src/core/render/node/Shape.js @@ -1,5 +1,5 @@ import { Rect, Polygon, Path } from '@svgdotjs/svg.js' -import { CONSTANTS } from './utils/constant' +import { CONSTANTS } from '../../../constants/constant' // 节点形状类 export default class Shape { diff --git a/simple-mind-map/src/Style.js b/simple-mind-map/src/core/render/node/Style.js similarity index 98% rename from simple-mind-map/src/Style.js rename to simple-mind-map/src/core/render/node/Style.js index 6f10526e..1dcf70de 100644 --- a/simple-mind-map/src/Style.js +++ b/simple-mind-map/src/core/render/node/Style.js @@ -1,4 +1,4 @@ -import { tagColorList } from './utils/constant' +import { tagColorList } from '../../../constants/constant' const rootProp = ['paddingX', 'paddingY'] // 样式类 diff --git a/simple-mind-map/src/utils/nodeCommandWraps.js b/simple-mind-map/src/core/render/node/nodeCommandWraps.js similarity index 100% rename from simple-mind-map/src/utils/nodeCommandWraps.js rename to simple-mind-map/src/core/render/node/nodeCommandWraps.js diff --git a/simple-mind-map/src/utils/nodeCreateContents.js b/simple-mind-map/src/core/render/node/nodeCreateContents.js similarity index 98% rename from simple-mind-map/src/utils/nodeCreateContents.js rename to simple-mind-map/src/core/render/node/nodeCreateContents.js index 866a4db3..c5231e71 100644 --- a/simple-mind-map/src/utils/nodeCreateContents.js +++ b/simple-mind-map/src/core/render/node/nodeCreateContents.js @@ -1,7 +1,7 @@ -import { measureText, resizeImgSize, getTextFromHtml } from '../utils' +import { measureText, resizeImgSize, getTextFromHtml } from '../../../utils' import { Image, SVG, A, G, Rect, Text, ForeignObject } from '@svgdotjs/svg.js' -import iconsSvg from '../svg/icons' -import { CONSTANTS } from './constant' +import iconsSvg from '../../../svg/icons' +import { CONSTANTS } from '../../../constants/constant' // 创建图片节点 function createImgNode() { diff --git a/simple-mind-map/src/utils/nodeExpandBtn.js b/simple-mind-map/src/core/render/node/nodeExpandBtn.js similarity index 98% rename from simple-mind-map/src/utils/nodeExpandBtn.js rename to simple-mind-map/src/core/render/node/nodeExpandBtn.js index 650417b5..5b2675cd 100644 --- a/simple-mind-map/src/utils/nodeExpandBtn.js +++ b/simple-mind-map/src/core/render/node/nodeExpandBtn.js @@ -1,4 +1,4 @@ -import btnsSvg from '../svg/btns' +import btnsSvg from '../../../svg/btns' import { SVG, Circle, G } from '@svgdotjs/svg.js' // 创建展开收起按钮的内容节点 diff --git a/simple-mind-map/src/utils/nodeGeneralization.js b/simple-mind-map/src/core/render/node/nodeGeneralization.js similarity index 99% rename from simple-mind-map/src/utils/nodeGeneralization.js rename to simple-mind-map/src/core/render/node/nodeGeneralization.js index 6521de97..2a2a585d 100644 --- a/simple-mind-map/src/utils/nodeGeneralization.js +++ b/simple-mind-map/src/core/render/node/nodeGeneralization.js @@ -1,4 +1,4 @@ -import Node from '../Node' +import Node from './Node' // 检查是否存在概要 function checkHasGeneralization () { diff --git a/simple-mind-map/src/View.js b/simple-mind-map/src/core/view/View.js similarity index 98% rename from simple-mind-map/src/View.js rename to simple-mind-map/src/core/view/View.js index ffe2599f..532424a1 100644 --- a/simple-mind-map/src/View.js +++ b/simple-mind-map/src/core/view/View.js @@ -1,4 +1,4 @@ -import { CONSTANTS } from './utils/constant' +import { CONSTANTS } from '../../constants/constant' // 视图操作类 class View { diff --git a/simple-mind-map/src/layouts/Base.js b/simple-mind-map/src/layouts/Base.js index e51b72d5..701fffbf 100644 --- a/simple-mind-map/src/layouts/Base.js +++ b/simple-mind-map/src/layouts/Base.js @@ -1,5 +1,5 @@ -import Node from '../Node' -import { CONSTANTS, initRootNodePositionMap } from '../utils/constant' +import Node from '../core/render/node/Node' +import { CONSTANTS, initRootNodePositionMap } from '../constants/constant' import Lru from '../utils/Lru' // 布局基类 diff --git a/simple-mind-map/src/layouts/Fishbone.js b/simple-mind-map/src/layouts/Fishbone.js index 58e70932..e8581852 100644 --- a/simple-mind-map/src/layouts/Fishbone.js +++ b/simple-mind-map/src/layouts/Fishbone.js @@ -1,6 +1,6 @@ import Base from './Base' import { walk, asyncRun, degToRad } from '../utils' -import { CONSTANTS } from '../utils/constant' +import { CONSTANTS } from '../constants/constant' import utils from './fishboneUtils' // 鱼骨图 diff --git a/simple-mind-map/src/layouts/Timeline.js b/simple-mind-map/src/layouts/Timeline.js index 0e426cf6..60a41db2 100644 --- a/simple-mind-map/src/layouts/Timeline.js +++ b/simple-mind-map/src/layouts/Timeline.js @@ -1,6 +1,6 @@ import Base from './Base' import { walk, asyncRun } from '../utils' -import { CONSTANTS } from '../utils/constant' +import { CONSTANTS } from '../constants/constant' // 时间轴 class Timeline extends Base { diff --git a/simple-mind-map/src/AssociativeLine.js b/simple-mind-map/src/plugins/AssociativeLine.js similarity index 98% rename from simple-mind-map/src/AssociativeLine.js rename to simple-mind-map/src/plugins/AssociativeLine.js index c365a8de..7d2626bc 100644 --- a/simple-mind-map/src/AssociativeLine.js +++ b/simple-mind-map/src/plugins/AssociativeLine.js @@ -1,4 +1,4 @@ -import { walk, bfsWalk, throttle } from './utils/' +import { walk, bfsWalk, throttle } from '../utils' import { v4 as uuid } from 'uuid' import { getAssociativeLineTargetIndex, @@ -7,9 +7,9 @@ import { getNodePoint, computeNodePoints, getNodeLinePath -} from './utils/associativeLineUtils' -import associativeLineControlsMethods from './utils/associativeLineControls' -import associativeLineTextMethods from './utils/associativeLineText' +} from './associativeLine/associativeLineUtils' +import associativeLineControlsMethods from './associativeLine/associativeLineControls' +import associativeLineTextMethods from './associativeLine/associativeLineText' // 关联线类 class AssociativeLine { diff --git a/simple-mind-map/src/Drag.js b/simple-mind-map/src/plugins/Drag.js similarity index 99% rename from simple-mind-map/src/Drag.js rename to simple-mind-map/src/plugins/Drag.js index ffadf0c5..d85ea667 100644 --- a/simple-mind-map/src/Drag.js +++ b/simple-mind-map/src/plugins/Drag.js @@ -1,5 +1,5 @@ -import { bfsWalk, throttle } from './utils' -import Base from './layouts/Base' +import { bfsWalk, throttle } from '../utils' +import Base from '../layouts/Base' // 节点拖动类 diff --git a/simple-mind-map/src/Export.js b/simple-mind-map/src/plugins/Export.js similarity index 97% rename from simple-mind-map/src/Export.js rename to simple-mind-map/src/plugins/Export.js index cbf3a639..ef74fe56 100644 --- a/simple-mind-map/src/Export.js +++ b/simple-mind-map/src/plugins/Export.js @@ -1,8 +1,8 @@ -import { imgToDataUrl, downloadFile, readBlob } from './utils' +import { imgToDataUrl, downloadFile, readBlob } from '../utils' import JsPDF from 'jspdf' import { SVG } from '@svgdotjs/svg.js' -import drawBackgroundImageToCanvas from './utils/simulateCSSBackgroundInCanvas' -import { transformToMarkdown } from './parse/toMarkdown' +import drawBackgroundImageToCanvas from '../utils/simulateCSSBackgroundInCanvas' +import { transformToMarkdown } from '../parse/toMarkdown' const URL = window.URL || window.webkitURL || window // 导出类 diff --git a/simple-mind-map/src/KeyboardNavigation.js b/simple-mind-map/src/plugins/KeyboardNavigation.js similarity index 98% rename from simple-mind-map/src/KeyboardNavigation.js rename to simple-mind-map/src/plugins/KeyboardNavigation.js index c5adf041..cdbf95f2 100644 --- a/simple-mind-map/src/KeyboardNavigation.js +++ b/simple-mind-map/src/plugins/KeyboardNavigation.js @@ -1,5 +1,5 @@ -import { bfsWalk } from './utils' -import { CONSTANTS } from './utils/constant' +import { bfsWalk } from '../utils' +import { CONSTANTS } from '../constants/constant' // 键盘导航类 class KeyboardNavigation { diff --git a/simple-mind-map/src/MiniMap.js b/simple-mind-map/src/plugins/MiniMap.js similarity index 100% rename from simple-mind-map/src/MiniMap.js rename to simple-mind-map/src/plugins/MiniMap.js diff --git a/simple-mind-map/src/RichText.js b/simple-mind-map/src/plugins/RichText.js similarity index 99% rename from simple-mind-map/src/RichText.js rename to simple-mind-map/src/plugins/RichText.js index 227f701e..a275baf6 100644 --- a/simple-mind-map/src/RichText.js +++ b/simple-mind-map/src/plugins/RichText.js @@ -1,8 +1,8 @@ import Quill from 'quill' import 'quill/dist/quill.snow.css' import html2canvas from 'html2canvas' -import { walk, getTextFromHtml } from './utils' -import { CONSTANTS } from './utils/constant' +import { walk, getTextFromHtml } from '../utils' +import { CONSTANTS } from '../constants/constant' let extended = false diff --git a/simple-mind-map/src/Select.js b/simple-mind-map/src/plugins/Select.js similarity index 99% rename from simple-mind-map/src/Select.js rename to simple-mind-map/src/plugins/Select.js index a8c847c9..5181fd0c 100644 --- a/simple-mind-map/src/Select.js +++ b/simple-mind-map/src/plugins/Select.js @@ -1,4 +1,4 @@ -import { bfsWalk, throttle } from './utils' +import { bfsWalk, throttle } from '../utils' // 选择节点类 diff --git a/simple-mind-map/src/Watermark.js b/simple-mind-map/src/plugins/Watermark.js similarity index 98% rename from simple-mind-map/src/Watermark.js rename to simple-mind-map/src/plugins/Watermark.js index 83bec10d..7d2ddaca 100644 --- a/simple-mind-map/src/Watermark.js +++ b/simple-mind-map/src/plugins/Watermark.js @@ -1,5 +1,5 @@ import { Text, G } from '@svgdotjs/svg.js' -import { degToRad, camelCaseToHyphen } from './utils' +import { degToRad, camelCaseToHyphen } from '../utils' import merge from 'deepmerge' // 水印类 diff --git a/simple-mind-map/src/utils/associativeLineControls.js b/simple-mind-map/src/plugins/associativeLine/associativeLineControls.js similarity index 100% rename from simple-mind-map/src/utils/associativeLineControls.js rename to simple-mind-map/src/plugins/associativeLine/associativeLineControls.js diff --git a/simple-mind-map/src/utils/associativeLineText.js b/simple-mind-map/src/plugins/associativeLine/associativeLineText.js similarity index 98% rename from simple-mind-map/src/utils/associativeLineText.js rename to simple-mind-map/src/plugins/associativeLine/associativeLineText.js index f761ab13..9d0722bb 100644 --- a/simple-mind-map/src/utils/associativeLineText.js +++ b/simple-mind-map/src/plugins/associativeLine/associativeLineText.js @@ -1,5 +1,5 @@ import { Text } from '@svgdotjs/svg.js' -import { getStrWithBrFromHtml } from './index' +import { getStrWithBrFromHtml } from '../../utils/index' // 创建文字节点 function createText(data) { diff --git a/simple-mind-map/src/utils/associativeLineUtils.js b/simple-mind-map/src/plugins/associativeLine/associativeLineUtils.js similarity index 100% rename from simple-mind-map/src/utils/associativeLineUtils.js rename to simple-mind-map/src/plugins/associativeLine/associativeLineUtils.js diff --git a/simple-mind-map/src/BatchExecution.js b/simple-mind-map/src/utils/BatchExecution.js similarity index 94% rename from simple-mind-map/src/BatchExecution.js rename to simple-mind-map/src/utils/BatchExecution.js index 4a92fbdc..fcdfb735 100644 --- a/simple-mind-map/src/BatchExecution.js +++ b/simple-mind-map/src/utils/BatchExecution.js @@ -1,4 +1,4 @@ -import { nextTick } from './utils' +import { nextTick } from '.' // 批量执行 class BatchExecution { diff --git a/web/src/pages/Doc/en/associativeLine/index.md b/web/src/pages/Doc/en/associativeLine/index.md index 9a726858..06685ee1 100644 --- a/web/src/pages/Doc/en/associativeLine/index.md +++ b/web/src/pages/Doc/en/associativeLine/index.md @@ -12,7 +12,8 @@ This plugin is used to support the addition of associative lines. ```js import MindMap from 'simple-mind-map' -import AssociativeLine from 'simple-mind-map/src/AssociativeLine.js' +import AssociativeLine from 'simple-mind-map/src/plugins/AssociativeLine.js' +// import AssociativeLine from 'simple-mind-map/src/AssociativeLine.js' Use this path for versions below v0.6.0 MindMap.usePlugin(AssociativeLine) ``` diff --git a/web/src/pages/Doc/en/associativeLine/index.vue b/web/src/pages/Doc/en/associativeLine/index.vue index 4981edcc..bc39c6cf 100644 --- a/web/src/pages/Doc/en/associativeLine/index.vue +++ b/web/src/pages/Doc/en/associativeLine/index.vue @@ -13,7 +13,8 @@

This plugin is used to support the addition of associative lines.

Register

import MindMap from 'simple-mind-map'
-import AssociativeLine from 'simple-mind-map/src/AssociativeLine.js'
+import AssociativeLine from 'simple-mind-map/src/plugins/AssociativeLine.js'
+// import AssociativeLine from 'simple-mind-map/src/AssociativeLine.js' Use this path for versions below v0.6.0
 
 MindMap.usePlugin(AssociativeLine)
 
diff --git a/web/src/pages/Doc/en/changelog/index.md b/web/src/pages/Doc/en/changelog/index.md index 42236e0b..90c60425 100644 --- a/web/src/pages/Doc/en/changelog/index.md +++ b/web/src/pages/Doc/en/changelog/index.md @@ -1,5 +1,9 @@ # Changelog +## 0.6.0 + +optimization: Optimize the directory structure of simple-mind-map source code + ## 0.5.11 New: Supports associative text editing. diff --git a/web/src/pages/Doc/en/changelog/index.vue b/web/src/pages/Doc/en/changelog/index.vue index 6ae87866..4ce12897 100644 --- a/web/src/pages/Doc/en/changelog/index.vue +++ b/web/src/pages/Doc/en/changelog/index.vue @@ -1,6 +1,8 @@