From 0bdf9f3add759c10238fbb2100cb64e19e982491 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Wed, 2 Aug 2023 18:48:08 +0800 Subject: [PATCH 01/67] =?UTF-8?q?Fix:=E4=BF=AE=E5=A4=8D=E5=BD=93=E6=80=9D?= =?UTF-8?q?=E7=BB=B4=E5=AF=BC=E5=9B=BE=E5=85=A8=E9=83=A8=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=8F=AF=E8=A7=86=E5=8C=BA=E5=9F=9F=E5=90=8E=E5=B0=8F=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E4=B8=AD=E7=9A=84=E6=8C=87=E7=A4=BA=E5=99=A8=E4=B9=9F?= =?UTF-8?q?=E4=BC=9A=E7=A7=BB=E9=99=A4=E5=B0=8F=E5=9C=B0=E5=9B=BE=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/MiniMap.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/simple-mind-map/src/plugins/MiniMap.js b/simple-mind-map/src/plugins/MiniMap.js index a4033584..07f8a462 100644 --- a/simple-mind-map/src/plugins/MiniMap.js +++ b/simple-mind-map/src/plugins/MiniMap.js @@ -55,19 +55,28 @@ class MiniMap { bottom: 0 } viewBoxStyle.left = - Math.max(0, (-_rectX / _rectWidth) * actWidth) + miniMapBoxLeft + 'px' + Math.max(0, (-_rectX / _rectWidth) * actWidth) + miniMapBoxLeft viewBoxStyle.right = Math.max(0, ((_rectX2 - origWidth) / _rectWidth) * actWidth) + - miniMapBoxLeft + - 'px' + miniMapBoxLeft viewBoxStyle.top = - Math.max(0, (-_rectY / _rectHeight) * actHeight) + miniMapBoxTop + 'px' + Math.max(0, (-_rectY / _rectHeight) * actHeight) + miniMapBoxTop viewBoxStyle.bottom = Math.max(0, ((_rectY2 - origHeight) / _rectHeight) * actHeight) + - miniMapBoxTop + - 'px' - + miniMapBoxTop + + if (viewBoxStyle.top > miniMapBoxTop + actHeight) { + viewBoxStyle.top = miniMapBoxTop + actHeight + } + if (viewBoxStyle.left > miniMapBoxLeft + actWidth) { + viewBoxStyle.left = miniMapBoxLeft + actWidth + } + + Object.keys(viewBoxStyle).forEach((key) => { + viewBoxStyle[key] = viewBoxStyle[key] + 'px' + }) + this.removeNodeContent(svg) return { svgHTML: svg.svg(), // 小地图html From 803c83ac4fffbc5f80675281e8152267ca0064b8 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Wed, 2 Aug 2023 19:05:15 +0800 Subject: [PATCH 02/67] =?UTF-8?q?Feat=EF=BC=9A=E8=8A=82=E7=82=B9=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=BB=93=E6=9D=9F=E4=BA=8B=E4=BB=B6node=5Fdragend?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9B=9E=E8=B0=83=E5=8F=82=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E8=8E=B7=E5=8F=96=E5=88=B0=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E5=88=B0=E8=8A=82=E7=82=B9=E7=9A=84uid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/Drag.js | 9 ++++++++- web/src/pages/Doc/en/constructor/index.md | 2 +- web/src/pages/Doc/en/constructor/index.vue | 2 +- web/src/pages/Doc/zh/constructor/index.md | 2 +- web/src/pages/Doc/zh/constructor/index.vue | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/simple-mind-map/src/plugins/Drag.js b/simple-mind-map/src/plugins/Drag.js index 78a4b8aa..1e54dd84 100644 --- a/simple-mind-map/src/plugins/Drag.js +++ b/simple-mind-map/src/plugins/Drag.js @@ -105,6 +105,9 @@ class Drag extends Base { this.node.isDrag = false this.node.show() this.removeCloneNode() + let overlapNodeUid = this.overlapNode ? this.overlapNode.nodeData.data.uid : '' + let prevNodeUid = this.prevNode ? this.prevNode.nodeData.data.uid : '' + let nextNodeUid = this.nextNode ? this.nextNode.nodeData.data.uid : '' // 存在重叠子节点,则移动作为其子节点 if (this.overlapNode) { this.mindMap.renderer.setNodeActive(this.overlapNode, false) @@ -134,7 +137,11 @@ class Drag extends Base { this.mindMap.render() } this.reset() - this.mindMap.emit('node_dragend') + this.mindMap.emit('node_dragend', { + overlapNodeUid, + prevNodeUid, + nextNodeUid + }) } // 创建克隆节点 diff --git a/web/src/pages/Doc/en/constructor/index.md b/web/src/pages/Doc/en/constructor/index.md index b5a3eaca..0292ac46 100644 --- a/web/src/pages/Doc/en/constructor/index.md +++ b/web/src/pages/Doc/en/constructor/index.md @@ -242,7 +242,7 @@ Listen to an event. Event list: | rich_text_selection_change(v0.4.0+) | Available when the `RichText` plugin is registered. Triggered when the text selection area changes when the node is edited | hasRange(Whether there is a selection)、rectInfo(Size and location information of the selected area)、formatInfo(Text formatting information of the selected area) | | transforming-dom-to-images(v0.4.0+) | Available when the `RichText` plugin is registered. When there is a `DOM` node in `svg`, the `DOM` node will be converted to an image when exporting to an image. This event will be triggered during the conversion process. You can use this event to prompt the user about the node to which you are currently converting | index(Index of the node currently converted to)、len(Total number of nodes to be converted) | | node_dragging(v0.4.5+) | Triggered when a node is dragged | node(The currently dragged node) | -| node_dragend(v0.4.5+) | Triggered when the node is dragged and ends | | +| node_dragend(v0.4.5+) | Triggered when the node is dragged and ends | { overlapNodeUid, prevNodeUid, nextNodeUid }(v0.6.12+,The node uid to which the node is moved this time, for example, if it is moved to node A, then the overlayNodeUid is the uid of node A. If it is moved to the front of node B, then the nextNodeUid is the uid of node B. You can obtain the node instance through the mindMap. extender.findNodeByUid(uid) method) | | associative_line_click(v0.4.5+) | Triggered when an associated line is clicked | path(Connector node)、clickPath(Invisible click line node)、node(Start node)、toNode(Target node) | | svg_mouseenter(v0.5.1+) | Triggered when the mouse moves into the SVG canvas | e(event object) | | svg_mouseleave(v0.5.1+) | Triggered when the mouse moves out of the SVG canvas | e(event object) | diff --git a/web/src/pages/Doc/en/constructor/index.vue b/web/src/pages/Doc/en/constructor/index.vue index c8f70d61..ec3adc28 100644 --- a/web/src/pages/Doc/en/constructor/index.vue +++ b/web/src/pages/Doc/en/constructor/index.vue @@ -697,7 +697,7 @@ poor performance and should be used sparingly.

node_dragend(v0.4.5+) Triggered when the node is dragged and ends - +{ overlapNodeUid, prevNodeUid, nextNodeUid }(v0.6.12+,The node uid to which the node is moved this time, for example, if it is moved to node A, then the overlayNodeUid is the uid of node A. If it is moved to the front of node B, then the nextNodeUid is the uid of node B. You can obtain the node instance through the mindMap. extender.findNodeByUid(uid) method) associative_line_click(v0.4.5+) diff --git a/web/src/pages/Doc/zh/constructor/index.md b/web/src/pages/Doc/zh/constructor/index.md index e4738fd2..75c92799 100644 --- a/web/src/pages/Doc/zh/constructor/index.md +++ b/web/src/pages/Doc/zh/constructor/index.md @@ -237,7 +237,7 @@ mindMap.setTheme('主题名称') | rich_text_selection_change(v0.4.0+) | 当注册了`RichText`插件时可用。当节点编辑时,文本选区发生改变时触发 | hasRange(是否存在选区)、rectInfo(选区的尺寸和位置信息)、formatInfo(选区的文本格式化信息) | | transforming-dom-to-images(v0.4.0+) | 当注册了`RichText`插件时可用。当`svg`中存在`DOM`节点时,导出为图片时会将`DOM`节点转换为图片,转换过程中会触发该事件,可用通过该事件给用户提示,告知目前转换到的节点 | index(当前转换到的节点索引)、len(一共需要转换的节点数量) | | node_dragging(v0.4.5+) | 当某个节点被拖拽时触发 | node(当前被拖拽的节点) | -| node_dragend(v0.4.5+) | 节点被拖拽结束时触发 | | +| node_dragend(v0.4.5+) | 节点被拖拽结束时触发 | { overlapNodeUid, prevNodeUid, nextNodeUid }(v0.6.12+,本次节点移动到的节点uid,比如本次移动到了节点A上,那么overlapNodeUid就是节点A的uid,如果移动到了B节点的前面,那么nextNodeUid就是节点B的uid,你可以通过mindMap.renderer.findNodeByUid(uid)方法来获取节点实例) | | associative_line_click(v0.4.5+) | 点击某条关联线时触发 | path(连接线节点)、clickPath(不可见的点击线节点)、node(起始节点)、toNode(目标节点) | | svg_mouseenter(v0.5.1+) | 鼠标移入svg画布时触发 | e(事件对象) | | svg_mouseleave(v0.5.1+) | 鼠标移出svg画布时触发 | e(事件对象) | diff --git a/web/src/pages/Doc/zh/constructor/index.vue b/web/src/pages/Doc/zh/constructor/index.vue index a8a8e3ec..1a87bf51 100644 --- a/web/src/pages/Doc/zh/constructor/index.vue +++ b/web/src/pages/Doc/zh/constructor/index.vue @@ -690,7 +690,7 @@ mindMap.setTheme('主题名称') node_dragend(v0.4.5+) 节点被拖拽结束时触发 - +{ overlapNodeUid, prevNodeUid, nextNodeUid }(v0.6.12+,本次节点移动到的节点uid,比如本次移动到了节点A上,那么overlapNodeUid就是节点A的uid,如果移动到了B节点的前面,那么nextNodeUid就是节点B的uid,你可以通过mindMap.renderer.findNodeByUid(uid)方法来获取节点实例) associative_line_click(v0.4.5+) From 49063d257bd24424c3345195e0b22321f318b9f6 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Wed, 2 Aug 2023 19:36:03 +0800 Subject: [PATCH 03/67] =?UTF-8?q?Feat=EF=BC=9A=E6=94=AF=E6=8C=81=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E9=85=8D=E7=BD=AE=E6=8C=87=E5=AE=9A=E5=86=85=E9=83=A8?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=85=83=E7=B4=A0=E6=B7=BB=E5=8A=A0=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/constants/defaultOptions.js | 4 +- simple-mind-map/src/core/render/TextEdit.js | 6 +- .../core/render/node/nodeCreateContents.js | 5 +- simple-mind-map/src/plugins/NodeImgAdjust.js | 12 ++- simple-mind-map/src/plugins/RichText.js | 6 +- .../associativeLine/associativeLineText.js | 3 +- web/src/pages/Doc/en/constructor/index.md | 1 + web/src/pages/Doc/en/constructor/index.vue | 7 ++ web/src/pages/Doc/zh/constructor/index.md | 1 + web/src/pages/Doc/zh/constructor/index.vue | 7 ++ web/src/pages/Edit/components/Edit.vue | 99 +------------------ 11 files changed, 46 insertions(+), 105 deletions(-) diff --git a/simple-mind-map/src/constants/defaultOptions.js b/simple-mind-map/src/constants/defaultOptions.js index a89f448d..babb77d5 100644 --- a/simple-mind-map/src/constants/defaultOptions.js +++ b/simple-mind-map/src/constants/defaultOptions.js @@ -122,5 +122,7 @@ export const defaultOpt = { // 是否开启自定义节点内容 isUseCustomNodeContent: false, // 自定义返回节点内容的方法 - customCreateNodeContent: null + customCreateNodeContent: null, + // 指定内部一些元素(节点文本编辑元素、节点备注显示元素、关联线文本编辑元素、节点图片调整按钮元素)添加到的位置,默认添加到document.body下 + customInnerElsAppendTo: null } diff --git a/simple-mind-map/src/core/render/TextEdit.js b/simple-mind-map/src/core/render/TextEdit.js index e426ecf6..20eee8eb 100644 --- a/simple-mind-map/src/core/render/TextEdit.js +++ b/simple-mind-map/src/core/render/TextEdit.js @@ -167,7 +167,11 @@ export default class TextEdit { this.textEditNode.addEventListener('click', e => { e.stopPropagation() }) - document.body.appendChild(this.textEditNode) + this.textEditNode.addEventListener('mousedown', (e) => { + e.stopPropagation() + }) + const targetNode = this.mindMap.opt.customInnerElsAppendTo || document.body + targetNode.appendChild(this.textEditNode) } let scale = this.mindMap.view.scale let lineHeight = node.style.merge('lineHeight') diff --git a/simple-mind-map/src/core/render/node/nodeCreateContents.js b/simple-mind-map/src/core/render/node/nodeCreateContents.js index 505bab59..2d5268bf 100644 --- a/simple-mind-map/src/core/render/node/nodeCreateContents.js +++ b/simple-mind-map/src/core/render/node/nodeCreateContents.js @@ -268,7 +268,7 @@ function createNoteNode() { if (!this.noteEl) { this.noteEl = document.createElement('div') this.noteEl.style.cssText = ` - position: absolute; + position: fixed; padding: 10px; border-radius: 5px; box-shadow: 0 2px 5px rgb(0 0 0 / 10%); @@ -276,7 +276,8 @@ function createNoteNode() { background-color: #fff; z-index: ${ this.mindMap.opt.nodeNoteTooltipZIndex } ` - document.body.appendChild(this.noteEl) + const targetNode = this.mindMap.opt.customInnerElsAppendTo || document.body + targetNode.appendChild(this.noteEl) } this.noteEl.innerText = this.nodeData.data.note } diff --git a/simple-mind-map/src/plugins/NodeImgAdjust.js b/simple-mind-map/src/plugins/NodeImgAdjust.js index 37fce4b7..a144c2af 100644 --- a/simple-mind-map/src/plugins/NodeImgAdjust.js +++ b/simple-mind-map/src/plugins/NodeImgAdjust.js @@ -82,7 +82,8 @@ class NodeImgAdjust { this.createResizeBtnEl() } this.setHandleElRect() - document.body.appendChild(this.handleEl) + const targetNode = this.mindMap.opt.customInnerElsAppendTo || document.body + targetNode.appendChild(this.handleEl) this.isShowHandleEl = true } @@ -90,7 +91,8 @@ class NodeImgAdjust { hideHandleEl() { if (!this.isShowHandleEl) return this.isShowHandleEl = false - document.body.removeChild(this.handleEl) + const targetNode = this.mindMap.opt.customInnerElsAppendTo || document.body + targetNode.removeChild(this.handleEl) this.handleEl.style.backgroundImage = `` this.handleEl.style.width = 0 this.handleEl.style.height = 0 @@ -153,6 +155,12 @@ class NodeImgAdjust { btnEl.addEventListener('mousedown', e => { this.onMousedown(e) }) + btnEl.addEventListener('click', e => { + e.stopPropagation() + }) + btnEl.addEventListener('mousedown', (e) => { + e.stopPropagation() + }) } // 鼠标按钮按下事件 diff --git a/simple-mind-map/src/plugins/RichText.js b/simple-mind-map/src/plugins/RichText.js index ef74be49..1a640b2e 100644 --- a/simple-mind-map/src/plugins/RichText.js +++ b/simple-mind-map/src/plugins/RichText.js @@ -172,7 +172,11 @@ class RichText { this.textEditNode.addEventListener('click', e => { e.stopPropagation() }) - document.body.appendChild(this.textEditNode) + this.textEditNode.addEventListener('mousedown', (e) => { + e.stopPropagation() + }) + const targetNode = this.mindMap.opt.customInnerElsAppendTo || document.body + targetNode.appendChild(this.textEditNode) } // 使用节点的填充色,否则如果节点颜色是白色的话编辑时看不见 let bgColor = node.style.merge('fillColor') diff --git a/simple-mind-map/src/plugins/associativeLine/associativeLineText.js b/simple-mind-map/src/plugins/associativeLine/associativeLineText.js index 9d0722bb..26c31fdb 100644 --- a/simple-mind-map/src/plugins/associativeLine/associativeLineText.js +++ b/simple-mind-map/src/plugins/associativeLine/associativeLineText.js @@ -47,7 +47,8 @@ function showEditTextBox(g) { this.textEditNode.addEventListener('click', e => { e.stopPropagation() }) - document.body.appendChild(this.textEditNode) + const targetNode = this.mindMap.opt.customInnerElsAppendTo || document.body + targetNode.appendChild(this.textEditNode) } let { associativeLineTextFontSize, diff --git a/web/src/pages/Doc/en/constructor/index.md b/web/src/pages/Doc/en/constructor/index.md index 0292ac46..1e4264f7 100644 --- a/web/src/pages/Doc/en/constructor/index.md +++ b/web/src/pages/Doc/en/constructor/index.md @@ -71,6 +71,7 @@ const mindMap = new MindMap({ | isUseCustomNodeContent(v0.6.3+) | Boolean | false | Whether to customize node content | | | customCreateNodeContent(v0.6.3+) | Function/null | null | If `isUseCustomNodeContent` is set to `true`, then this option needs to be used to pass in a method that receives the node instance `node` as a parameter (if you want to obtain data for that node, you can use `node.nodeData.data`). You need to return the custom node content element, which is the DOM node. If a node does not require customization, you can return `null` | | | mouseScaleCenterUseMousePosition(v0.6.4-fix.1+) | Boolean | true | Is the mouse zoom centered around the current position of the mouse, otherwise centered around the canvas | | +| customInnerElsAppendTo(v0.6.12+) | null/HTMLElement | null | Specify the location where some internal elements (node text editing element, node note display element, associated line text editing element, node image adjustment button element) are added, and default to document.body | | ### Watermark config diff --git a/web/src/pages/Doc/en/constructor/index.vue b/web/src/pages/Doc/en/constructor/index.vue index ec3adc28..b3940329 100644 --- a/web/src/pages/Doc/en/constructor/index.vue +++ b/web/src/pages/Doc/en/constructor/index.vue @@ -357,6 +357,13 @@ Is the mouse zoom centered around the current position of the mouse, otherwise centered around the canvas + +customInnerElsAppendTo(v0.6.12+) +null/HTMLElement +null +Specify the location where some internal elements (node text editing element, node note display element, associated line text editing element, node image adjustment button element) are added, and default to document.body + +

Watermark config

diff --git a/web/src/pages/Doc/zh/constructor/index.md b/web/src/pages/Doc/zh/constructor/index.md index 75c92799..45bba08b 100644 --- a/web/src/pages/Doc/zh/constructor/index.md +++ b/web/src/pages/Doc/zh/constructor/index.md @@ -71,6 +71,7 @@ const mindMap = new MindMap({ | isUseCustomNodeContent(v0.6.3+) | Boolean | false | 是否自定义节点内容 | | | customCreateNodeContent(v0.6.3+) | Function/null | null | 如果`isUseCustomNodeContent`设为`true`,那么需要使用该选项传入一个方法,接收节点实例`node`为参数(如果要获取该节点的数据,可以通过`node.nodeData.data`),需要返回自定义节点内容元素,也就是DOM节点,如果某个节点不需要自定义,那么返回`null`即可 | | | mouseScaleCenterUseMousePosition(v0.6.4-fix.1+) | Boolean | true | 鼠标缩放是否以鼠标当前位置为中心点,否则以画布中心点 | | +| customInnerElsAppendTo(v0.6.12+) | null/HTMLElement | null | 指定内部一些元素(节点文本编辑元素、节点备注显示元素、关联线文本编辑元素、节点图片调整按钮元素)添加到的位置,默认添加到document.body下 | | ### 水印配置 diff --git a/web/src/pages/Doc/zh/constructor/index.vue b/web/src/pages/Doc/zh/constructor/index.vue index 1a87bf51..2d8b941c 100644 --- a/web/src/pages/Doc/zh/constructor/index.vue +++ b/web/src/pages/Doc/zh/constructor/index.vue @@ -357,6 +357,13 @@ 鼠标缩放是否以鼠标当前位置为中心点,否则以画布中心点 + +customInnerElsAppendTo(v0.6.12+) +null/HTMLElement +null +指定内部一些元素(节点文本编辑元素、节点备注显示元素、关联线文本编辑元素、节点图片调整按钮元素)添加到的位置,默认添加到document.body下 + +

水印配置

diff --git a/web/src/pages/Edit/components/Edit.vue b/web/src/pages/Edit/components/Edit.vue index 1c6fd47c..09be185c 100644 --- a/web/src/pages/Edit/components/Edit.vue +++ b/web/src/pages/Edit/components/Edit.vue @@ -117,8 +117,7 @@ export default { return { mindMap: null, mindMapData: null, - prevImg: '', - openTest: false + prevImg: '' } }, computed: { @@ -157,97 +156,8 @@ export default { window.addEventListener('resize', () => { this.mindMap.resize() }) - if (this.openTest) { - setTimeout(() => { - this.test() - }, 5000) - } }, methods: { - /** - * @Author: 王林25 - * @Date: 2021-11-22 19:39:28 - * @Desc: 数据更改测试 - */ - test() { - let nodeData = { - data: { text: '根节点', expand: true, isActive: false }, - children: [] - } - setTimeout(() => { - nodeData.data.text = '理想青年实验室' - this.mindMap.setData(JSON.parse(JSON.stringify(nodeData))) - - setTimeout(() => { - nodeData.children.push({ - data: { text: '网站', expand: true, isActive: false }, - children: [] - }) - this.mindMap.setData(JSON.parse(JSON.stringify(nodeData))) - - setTimeout(() => { - nodeData.children.push({ - data: { text: '博客', expand: true, isActive: false }, - children: [] - }) - this.mindMap.setData(JSON.parse(JSON.stringify(nodeData))) - - setTimeout(() => { - let viewData = { - transform: { - scaleX: 1, - scaleY: 1, - shear: 0, - rotate: 0, - translateX: 179, - translateY: 0, - originX: 0, - originY: 0, - a: 1, - b: 0, - c: 0, - d: 1, - e: 179, - f: 0 - }, - state: { scale: 1, x: 179, y: 0, sx: 0, sy: 0 } - } - this.mindMap.view.setTransformData(viewData) - - setTimeout(() => { - let viewData = { - transform: { - scaleX: 1.6000000000000005, - scaleY: 1.6000000000000005, - shear: 0, - rotate: 0, - translateX: -373.3000000000004, - translateY: -281.10000000000025, - originX: 0, - originY: 0, - a: 1.6000000000000005, - b: 0, - c: 0, - d: 1.6000000000000005, - e: -373.3000000000004, - f: -281.10000000000025 - }, - state: { - scale: 1.6000000000000005, - x: 179, - y: 0, - sx: 0, - sy: 0 - } - } - this.mindMap.view.setTransformData(viewData) - }, 1000) - }, 1000) - }, 1000) - }, 1000) - }, 1000) - }, - /** * @Author: 王林 * @Date: 2021-07-03 22:11:37 @@ -264,9 +174,6 @@ export default { * @Desc: 存储数据当数据有变时 */ bindSaveEvent() { - if (this.openTest) { - return - } this.$bus.$on('data_change', data => { storeData(data) }) @@ -283,9 +190,6 @@ export default { * @Desc: 手动保存 */ manualSave() { - if (this.openTest) { - return - } let data = this.mindMap.getData(true) storeConfig(data) }, @@ -317,6 +221,7 @@ export default { ...(config || {}), iconList: icon, useLeftKeySelectionRightKeyDrag: this.useLeftKeySelectionRightKeyDrag, + customInnerElsAppendTo: null, // isUseCustomNodeContent: true, // 示例1:组件里用到了router、store、i18n等实例化vue组件时需要用到的东西 // customCreateNodeContent: (node) => { From f1748e7e4246d70397b01633a1c18b0b7d2955e5 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Wed, 2 Aug 2023 19:49:12 +0800 Subject: [PATCH 04/67] =?UTF-8?q?Fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E5=8F=8C=E6=8C=87=E7=BC=A9=E6=94=BE=E8=BF=87?= =?UTF-8?q?=E4=BA=8E=E7=81=B5=E6=95=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/TouchEvent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simple-mind-map/src/plugins/TouchEvent.js b/simple-mind-map/src/plugins/TouchEvent.js index 2d4f78d1..ea8681b4 100644 --- a/simple-mind-map/src/plugins/TouchEvent.js +++ b/simple-mind-map/src/plugins/TouchEvent.js @@ -59,10 +59,10 @@ class TouchEvent { let cy = (touch1ClientY + touch2ClientY) / 2 if (distance > this.doubleTouchmoveDistance) { // 放大 - this.mindMap.view.enlarge(cx, cy) + this.mindMap.view.enlarge(cx, cy, true) } else { // 缩小 - this.mindMap.view.narrow(cx, cy) + this.mindMap.view.narrow(cx, cy, true) } this.doubleTouchmoveDistance = distance } From c845a0b7fa6141e853addcff493580a4b47830bc Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Wed, 2 Aug 2023 20:00:08 +0800 Subject: [PATCH 05/67] =?UTF-8?q?Fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=8F=AA?= =?UTF-8?q?=E8=AF=BB=E6=A8=A1=E5=BC=8F=E4=B8=8B=E6=8C=89=E4=BD=8F=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=97=A0=E6=B3=95=E6=8B=96=E5=8A=A8=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/render/node/Node.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simple-mind-map/src/core/render/node/Node.js b/simple-mind-map/src/core/render/node/Node.js index 4a5a6ac2..9c0c8910 100644 --- a/simple-mind-map/src/core/render/node/Node.js +++ b/simple-mind-map/src/core/render/node/Node.js @@ -385,10 +385,10 @@ class Node { this.active(e) }) this.group.on('mousedown', e => { - if (this.isRoot && e.which === 3) { + if (this.isRoot && e.which === 3 && !this.mindMap.opt.readonly) { e.stopPropagation() } - if (!this.isRoot) { + if (!this.isRoot && !this.mindMap.opt.readonly) { e.stopPropagation() } // 多选和取消多选 @@ -414,7 +414,7 @@ class Node { this.mindMap.emit('node_mousedown', this, e) }) this.group.on('mouseup', e => { - if (!this.isRoot) { + if (!this.isRoot && !this.mindMap.opt.readonly) { e.stopPropagation() } this.mindMap.emit('node_mouseup', this, e) From 1952280003b0e1a1dbb26880b0da08153a595d9d Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Thu, 3 Aug 2023 08:49:29 +0800 Subject: [PATCH 06/67] =?UTF-8?q?Demo=EF=BC=9A=E7=BB=99=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A1=86=E6=B7=BB=E5=8A=A0=E5=94=AF=E4=B8=80=E7=9A=84class?= =?UTF-8?q?=EF=BC=8C=E6=96=B9=E4=BE=BF=E5=BC=80=E5=8F=91=E8=80=85=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/Edit/components/Export.vue | 4 ++-- web/src/pages/Edit/components/Import.vue | 4 ++-- web/src/pages/Edit/components/NodeHyperlink.vue | 4 ++-- web/src/pages/Edit/components/NodeIcon.vue | 4 ++-- web/src/pages/Edit/components/NodeImage.vue | 4 ++-- web/src/pages/Edit/components/NodeNote.vue | 4 ++-- web/src/pages/Edit/components/NodeTag.vue | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/web/src/pages/Edit/components/Export.vue b/web/src/pages/Edit/components/Export.vue index 838be375..6602c66b 100644 --- a/web/src/pages/Edit/components/Export.vue +++ b/web/src/pages/Edit/components/Export.vue @@ -1,6 +1,6 @@ @@ -37,10 +41,20 @@ export default { } }, methods: { - ...mapMutations(['setIsOutlineEdit']), + ...mapMutations(['setIsOutlineEdit', 'setActiveSidebar']), onChangeToOutlineEdit() { + this.setActiveSidebar('') this.setIsOutlineEdit(true) + }, + + onScrollTo(y) { + let container = this.$refs.sidebar.getEl() + let height = container.offsetHeight + let top = container.scrollTop + if (y > top + height) { + container.scrollTo(0, y - height / 2) + } } } } diff --git a/web/src/pages/Edit/components/Sidebar.vue b/web/src/pages/Edit/components/Sidebar.vue index d82b5153..377a93c0 100644 --- a/web/src/pages/Edit/components/Sidebar.vue +++ b/web/src/pages/Edit/components/Sidebar.vue @@ -9,7 +9,7 @@
{{ title }}
-
+
@@ -59,6 +59,10 @@ export default { close() { this.show = false this.setActiveSidebar('') + }, + + getEl() { + return this.$refs.sidebarContent } } } From d17191c890cce51ca07c5cf5151a025a602205da Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Mon, 7 Aug 2023 10:09:05 +0800 Subject: [PATCH 21/67] =?UTF-8?q?Demo=EF=BC=9A=E4=BC=98=E5=8C=96=E5=A4=A7?= =?UTF-8?q?=E7=BA=B2=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/Edit/components/Outline.vue | 79 +++++++++++++------ web/src/pages/Edit/components/OutlineEdit.vue | 45 ++++++----- 2 files changed, 79 insertions(+), 45 deletions(-) diff --git a/web/src/pages/Edit/components/Outline.vue b/web/src/pages/Edit/components/Outline.vue index ca7e119c..47ed6a9a 100644 --- a/web/src/pages/Edit/components/Outline.vue +++ b/web/src/pages/Edit/components/Outline.vue @@ -20,7 +20,7 @@ class="customNode" slot-scope="{ node, data }" :data-id="data.uid" - @click="onClick($event, data)" + @click="onClick(data)" > { - // 激活节点会让当前大纲失去焦点 + // 在大纲里操作节点时不要响应该事件,否则会重新刷新树 if (this.notHandleDataChange) { this.notHandleDataChange = false return } + if (this.isAfterCreateNewNode) { + this.isAfterCreateNewNode = false + return + } this.refresh() }) this.$bus.$on('node_tree_render_end', () => { - // 激活节点会让当前大纲失去焦点 + // 当前存在未完成的节点插入操作 + if (this.insertType) { + this[this.insertType]() + this.insertType = '' + return + } + // 插入了新节点后需要做一些操作 if (this.handleNodeTreeRenderEnd) { this.handleNodeTreeRenderEnd = false - this.notHandleDataChange = false this.refresh() this.$nextTick(() => { this.afterCreateNewNode() @@ -125,26 +136,32 @@ export default { // 如果是新插入节点,那么需要手动高亮该节点、定位该节点及聚焦 let id = this.beInsertNodeUid if (id && this.$refs.tree) { - // 高亮树节点 - this.$refs.tree.setCurrentKey(id) - let node = this.$refs.tree.getNode(id) - this.onCurrentChange(node.data) - // 定位该节点 - this.onClick(null, node.data) - // 聚焦该树节点的编辑框 - const el = document.querySelector( - `.customNode[data-id="${id}"] .nodeEdit` - ) - if (el) { - let selection = window.getSelection() - let range = document.createRange() - range.selectNodeContents(el) - selection.removeAllRanges() - selection.addRange(range) - let offsetTop = el.offsetTop - this.$emit('scrollTo', offsetTop) + try { + this.isAfterCreateNewNode = true + // 高亮树节点 + this.$refs.tree.setCurrentKey(id) + let node = this.$refs.tree.getNode(id) + this.onCurrentChange(node.data) + // 定位该节点 + this.onClick(node.data) + // 聚焦该树节点的编辑框 + const el = document.querySelector( + `.customNode[data-id="${id}"] .nodeEdit` + ) + if (el) { + let selection = window.getSelection() + let range = document.createRange() + range.selectNodeContents(el) + selection.removeAllRanges() + selection.addRange(range) + let offsetTop = el.offsetTop + this.$emit('scrollTo', offsetTop) + } + } catch (error) { + console.log(error) } } + this.beInsertNodeUid = '' }, // 根节点不允许拖拽 @@ -154,9 +171,16 @@ export default { // 失去焦点更新节点文本 onBlur(e, node) { + // 节点数据没有修改 if (node.data.textCache === e.target.innerHTML) { + // 如果存在未执行的插入新节点操作,那么直接执行 + if (this.insertType) { + this[this.insertType]() + this.insertType = '' + } return } + // 否则插入新节点操作需要等待当前修改事件渲染完成后再执行 const richText = node.data.data.richText const text = richText ? e.target.innerHTML : e.target.innerText const targetNode = this.mindMap.renderer.findNodeByUid(node.data.uid) @@ -193,11 +217,13 @@ export default { onNodeInputKeydown(e) { if (e.keyCode === 13 && !e.shiftKey) { e.preventDefault() - this.insertNode() + this.insertType = 'insertNode' + e.target.blur() } if (e.keyCode === 9) { e.preventDefault() - this.insertChildNode() + this.insertType = 'insertChildNode' + e.target.blur() } }, @@ -222,13 +248,14 @@ export default { }, // 激活当前节点且移动当前节点到画布中间 - onClick(e, data) { + onClick(data) { this.notHandleDataChange = true const targetNode = this.mindMap.renderer.findNodeByUid(data.uid) if (targetNode && targetNode.nodeData.data.isActive) return this.mindMap.renderer.textEdit.stopFocusOnNodeActive() this.mindMap.execCommand('GO_TARGET_NODE', data.uid, () => { this.mindMap.renderer.textEdit.openFocusOnNodeActive() + this.notHandleDataChange = false }) }, diff --git a/web/src/pages/Edit/components/OutlineEdit.vue b/web/src/pages/Edit/components/OutlineEdit.vue index 57d3017f..59882ecb 100644 --- a/web/src/pages/Edit/components/OutlineEdit.vue +++ b/web/src/pages/Edit/components/OutlineEdit.vue @@ -7,8 +7,10 @@
-
- +
+
+ +
@@ -33,11 +35,11 @@ export default { }, watch: { isOutlineEdit(val) { - if (val) { - this.$nextTick(() => { - document.body.appendChild(this.$refs.outlineEditContainer) - }) - } + if (val) { + this.$nextTick(() => { + document.body.appendChild(this.$refs.outlineEditContainer) + }) + } } }, methods: { @@ -48,7 +50,7 @@ export default { }, onScrollTo(y) { - let container = this.$refs.outlineEditContainer + let container = this.$refs.outlineEditBox let height = container.offsetHeight let top = container.scrollTop y += 50 @@ -68,14 +70,12 @@ export default { width: 100%; height: 100%; z-index: 9999; - display: flex; - justify-content: center; background-color: #fff; - overflow-y: auto; + overflow: hidden; .closeBtn { position: absolute; - right: 20px; + right: 40px; top: 20px; cursor: pointer; @@ -84,15 +84,22 @@ export default { } } - .outlineEdit { - width: 1000px; - height: max-content; - overflow: hidden; + .outlineEditBox { + width: 100%; + height: 100%; + overflow-y: auto; padding: 50px 0; - /deep/ .customNode { - .nodeEdit { - max-width: 800px; + .outlineEdit { + width: 1000px; + height: 100%; + height: max-content; + margin: 0 auto; + + /deep/ .customNode { + .nodeEdit { + max-width: 800px; + } } } } From 4a81ce9cc22ccef386bde3b81623196e8169382e Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Mon, 7 Aug 2023 10:32:42 +0800 Subject: [PATCH 22/67] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E7=83=AD=E6=9B=B4=E6=96=B0=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/vue.config.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/web/vue.config.js b/web/vue.config.js index 56de072c..bde653bd 100644 --- a/web/vue.config.js +++ b/web/vue.config.js @@ -14,11 +14,13 @@ module.exports = { // 移除 prefetch 插件 config.plugins.delete('prefetch') // 支持运行时设置public path - config - .plugin('dynamicPublicPathPlugin') - .use(WebpackDynamicPublicPathPlugin, [ - { externalPublicPath: 'window.externalPublicPath' } - ]) + if (!isDev) { + config + .plugin('dynamicPublicPathPlugin') + .use(WebpackDynamicPublicPathPlugin, [ + { externalPublicPath: 'window.externalPublicPath' } + ]) + } // 给插入html页面内的js和css添加hash参数 config.plugin('html').tap(args => { args[0].hash = true From 4b59bec01cf4a8c301354f69408c2a2ffabb4f09 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Mon, 7 Aug 2023 17:05:47 +0800 Subject: [PATCH 23/67] =?UTF-8?q?Demo=EF=BC=9A=E4=BC=98=E5=8C=96=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E6=9A=97=E9=BB=91=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/parse/xmind.js | 4 +- simple-mind-map/src/plugins/ExportXMind.js | 6 +- simple-mind-map/src/plugins/NodeImgAdjust.js | 88 +++++++++---------- simple-mind-map/src/plugins/RichText.js | 12 +-- web/src/lang/en_us.js | 5 +- web/src/lang/zh_cn.js | 5 +- web/src/pages/Edit/Index.vue | 35 ++++---- web/src/pages/Edit/components/BaseStyle.vue | 8 +- web/src/pages/Edit/components/Outline.vue | 26 ++++++ web/src/pages/Edit/components/OutlineEdit.vue | 13 ++- .../pages/Edit/components/OutlineSidebar.vue | 12 ++- web/src/pages/Edit/components/Theme.vue | 41 ++++++--- 12 files changed, 163 insertions(+), 92 deletions(-) diff --git a/simple-mind-map/src/parse/xmind.js b/simple-mind-map/src/parse/xmind.js index 90cd5764..cdb752d2 100644 --- a/simple-mind-map/src/parse/xmind.js +++ b/simple-mind-map/src/parse/xmind.js @@ -123,7 +123,7 @@ const transformOldXmind = content => { let elements = data.elements let root = null let getRoot = arr => { - if(!arr) return; + if (!arr) return for (let i = 0; i < arr.length; i++) { if (!root && arr[i].name === 'topic') { root = arr[i] @@ -143,7 +143,7 @@ const transformOldXmind = content => { } let walk = (node, newNode) => { let nodeElements = node.elements - let nodeTitle = getItemByName(nodeElements, 'title'); + let nodeTitle = getItemByName(nodeElements, 'title') newNode.data = { // 节点内容 text: nodeTitle && nodeTitle.elements && nodeTitle.elements[0].text diff --git a/simple-mind-map/src/plugins/ExportXMind.js b/simple-mind-map/src/plugins/ExportXMind.js index fe40d2aa..aeccf60c 100644 --- a/simple-mind-map/src/plugins/ExportXMind.js +++ b/simple-mind-map/src/plugins/ExportXMind.js @@ -12,8 +12,10 @@ class ExportXMind { const zipData = await xmind.transformToXmind(data, name) return zipData } - getXmind(){ - return xmind; + + // 获取解析器 + getXmind() { + return xmind } } diff --git a/simple-mind-map/src/plugins/NodeImgAdjust.js b/simple-mind-map/src/plugins/NodeImgAdjust.js index 0d6f7951..4999f4bc 100644 --- a/simple-mind-map/src/plugins/NodeImgAdjust.js +++ b/simple-mind-map/src/plugins/NodeImgAdjust.js @@ -82,7 +82,7 @@ class NodeImgAdjust { this.createResizeBtnEl() } this.setHandleElRect() - this.handleEl.style.display = 'block';// document.body.appendChild(this.handleEl) + this.handleEl.style.display = 'block' this.isShowHandleEl = true } @@ -90,12 +90,12 @@ class NodeImgAdjust { hideHandleEl() { if (!this.isShowHandleEl) return this.isShowHandleEl = false - this.handleEl.style.display = 'none';//document.body.removeChild(this.handleEl) + this.handleEl.style.display = 'none' this.handleEl.style.backgroundImage = `` this.handleEl.style.width = 0 this.handleEl.style.height = 0 this.handleEl.style.left = 0 - this.handleEl.style.top = 0 + this.handleEl.style.top = 0 } // 设置自定义元素尺寸位置信息 @@ -121,9 +121,10 @@ class NodeImgAdjust { this.handleEl.style.cssText = ` pointer-events: none; position: fixed; - display:none; + display:none; background-size: cover; ` + this.handleEl.className = 'node-img-handle' // 调整按钮元素 const btnEl = document.createElement('div') btnEl.innerHTML = btnsSvg.imgAdjust @@ -140,7 +141,7 @@ class NodeImgAdjust { align-items: center; cursor: nwse-resize; ` - this.handleEl.appendChild(btnEl) + btnEl.className = 'node-image-resize' // 给按钮元素绑定事件 btnEl.addEventListener('mouseenter', () => { // 移入按钮,会触发节点图片的移出事件,所以需要再次显示按钮 @@ -152,51 +153,50 @@ class NodeImgAdjust { this.hideHandleEl() }) btnEl.addEventListener('mousedown', e => { + e.stopPropagation() this.onMousedown(e) }) - btnEl.addEventListener('mouseup', e => { - setTimeout(() => { //点击后直接松开异常处理; 其他事件响应之后处理 - this.hideHandleEl() - this.isAdjusted = false; - },0); - }) - - - document.body.appendChild(this.handleEl); - this.handleEl.className = 'node-img-handle'; - btnEl.className = 'node-image-resize'; - - const btnRemove = document.createElement('div'); - this.handleEl.prepend(btnRemove); - btnRemove.className = 'node-image-remove'; - btnRemove.innerHTML = btnsSvg.remove;//''; - btnRemove.style.cssText = ` - position: absolute; - right: 0;top:0;color:#fff; - pointer-events: auto; - background-color: rgba(0, 0, 0, 0.3); - width: ${this.resizeBtnSize}px; - height: ${this.resizeBtnSize}px; - display: flex; - justify-content: center; - align-items: center; - cursor: pointer;`; - btnRemove.addEventListener('mouseenter', e => { - this.showHandleEl() - }) - btnRemove.addEventListener('mouseleave', e => { - if (this.isMousedown) return - this.hideHandleEl() - }) - btnRemove.addEventListener('click', e => { - this.mindMap.execCommand('SET_NODE_IMAGE',this.node,{url:null}); - }); + btnEl.addEventListener('mouseup', e => { + setTimeout(() => { + //点击后直接松开异常处理; 其他事件响应之后处理 + this.hideHandleEl() + this.isAdjusted = false + }, 0) + }) btnEl.addEventListener('click', e => { e.stopPropagation() }) - btnEl.addEventListener('mousedown', (e) => { - e.stopPropagation() + this.handleEl.appendChild(btnEl) + // 删除按钮 + const btnRemove = document.createElement('div') + this.handleEl.prepend(btnRemove) + btnRemove.className = 'node-image-remove' + btnRemove.innerHTML = btnsSvg.remove + btnRemove.style.cssText = ` + position: absolute; + right: 0;top:0;color:#fff; + pointer-events: auto; + background-color: rgba(0, 0, 0, 0.3); + width: ${this.resizeBtnSize}px; + height: ${this.resizeBtnSize}px; + display: flex; + justify-content: center; + align-items: center; + cursor: pointer; + ` + btnRemove.addEventListener('mouseenter', e => { + this.showHandleEl() }) + btnRemove.addEventListener('mouseleave', e => { + if (this.isMousedown) return + this.hideHandleEl() + }) + btnRemove.addEventListener('click', e => { + this.mindMap.execCommand('SET_NODE_IMAGE', this.node, { url: null }) + }) + // 添加元素到页面 + const targetNode = this.mindMap.opt.customInnerElsAppendTo || document.body + targetNode.appendChild(this.handleEl) } // 鼠标按钮按下事件 diff --git a/simple-mind-map/src/plugins/RichText.js b/simple-mind-map/src/plugins/RichText.js index 7563c38b..1a640b2e 100644 --- a/simple-mind-map/src/plugins/RichText.js +++ b/simple-mind-map/src/plugins/RichText.js @@ -163,12 +163,12 @@ class RichText { let scaleX = rect.width / originWidth let scaleY = rect.height / originHeight // 内边距 - const paddingX = 14;// 6=>14 + const paddingX = 6 const paddingY = 4 if (!this.textEditNode) { this.textEditNode = document.createElement('div') this.textEditNode.classList.add('smm-richtext-node-edit-wrap') - this.textEditNode.style.cssText = `position:fixed;box-sizing: border-box;outline: none; word-break: break-all;padding: ${paddingY}px ${paddingX}px;` + this.textEditNode.style.cssText = `position:fixed;box-sizing: border-box;box-shadow: 0 0 20px rgba(0,0,0,.5);outline: none; word-break: break-all;padding: ${paddingY}px ${paddingX}px;` this.textEditNode.addEventListener('click', e => { e.stopPropagation() }) @@ -194,12 +194,7 @@ class RichText { this.textEditNode.style.maxWidth = this.mindMap.opt.textAutoWrapWidth + paddingX * 2 + 'px' this.textEditNode.style.transform = `scale(${scaleX}, ${scaleY})` - this.textEditNode.style.transformOrigin = 'left top' - this.textEditNode.style.borderRadius = (node.style.merge('borderRadius') || 5) + 'px' - if(node.style.merge('shape') == 'roundedRectangle'){ - this.textEditNode.style.borderRadius = '50px'; - } - + this.textEditNode.style.transformOrigin = 'left top' if (!node.nodeData.data.richText) { // 还不是富文本的情况 let text = node.nodeData.data.text.split(/\n/gim).join('
') @@ -210,7 +205,6 @@ class RichText { this.cacheEditingText || node.nodeData.data.text } this.initQuillEditor() - setTimeout(() => {this.selectAll();}, 0); // 双击选中 document.querySelector('.ql-editor').style.minHeight = originHeight + 'px' this.showTextEdit = true // 如果是刚创建的节点,那么默认全选,否则普通激活不全选 diff --git a/web/src/lang/en_us.js b/web/src/lang/en_us.js index 6aa781d4..561ee635 100644 --- a/web/src/lang/en_us.js +++ b/web/src/lang/en_us.js @@ -47,7 +47,10 @@ export default { mousewheelZoomActionReverse: 'Mouse Wheel Zoom', mousewheelZoomActionReverse1: 'Zoom out forward and zoom in back', mousewheelZoomActionReverse2: 'Zoom in forward and zoom out back', - rootStyle: 'Root Node' + rootStyle: 'Root Node', + associativeLineText: 'Associative line text', + fontFamily: 'Font family', + fontSize: 'Font size' }, color: { moreColor: 'More color' diff --git a/web/src/lang/zh_cn.js b/web/src/lang/zh_cn.js index 2abef680..1808366f 100644 --- a/web/src/lang/zh_cn.js +++ b/web/src/lang/zh_cn.js @@ -47,7 +47,10 @@ export default { mousewheelZoomActionReverse: '鼠标滚轮缩放', mousewheelZoomActionReverse1: '向前缩小向后放大', mousewheelZoomActionReverse2: '向前放大向后缩小', - rootStyle: '根节点' + rootStyle: '根节点', + associativeLineText: '关联线文字', + fontFamily: '字体', + fontSize: '字号' }, color: { moreColor: '更多颜色' diff --git a/web/src/pages/Edit/Index.vue b/web/src/pages/Edit/Index.vue index 685df178..60595d8f 100644 --- a/web/src/pages/Edit/Index.vue +++ b/web/src/pages/Edit/Index.vue @@ -1,5 +1,8 @@