From 729533b3c1f7a570158b684e4851a6cd8e4d0eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Sat, 12 Oct 2024 11:12:03 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9AmousedownEventPreventDefault?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E6=94=AF=E6=8C=81=E6=8E=A7=E5=88=B6=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E7=9A=84mousedown=E4=BA=8B=E4=BB=B6=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E9=98=BB=E6=AD=A2=E9=BB=98=E8=AE=A4=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +++- simple-mind-map/src/core/render/node/MindMapNode.js | 7 +++++-- simple-mind-map/src/plugins/Drag.js | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 46d6b2d2..8dbc668c 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ const mindMap = new MindMap({ # 微信交流群 -微信添加`wanglinguanfang`拉你入群。根据过往的经验,大部分问题都可以通过文档解决,所以提问前请确保你已经阅读完了所有文档,文档里没有的可在群里提问,不必私聊作者。 +微信添加`wanglinguanfang`拉你入群。根据过往的经验,大部分问题都可以通过查看issue列表或文档解决,所以提问前请确保你已经阅读完了所有文档,文档里没有的可在群里提问,不必私聊作者。 # star @@ -120,6 +120,8 @@ const mindMap = new MindMap({ 开源不易,如果本项目有帮助到你的话,可以考虑请作者喝杯咖啡,你的支持是开发者持续维护的最大动力~ > 推荐使用支付宝,微信获取不到头像。转账请备注【思维导图】。 +> +> 也可以通过购买付费插件来支持我们:[付费插件](https://wanglin2.github.io/mind-map-docs/plugins/about.html)。
diff --git a/simple-mind-map/src/core/render/node/MindMapNode.js b/simple-mind-map/src/core/render/node/MindMapNode.js
index 93f08e41..910bb5ee 100644
--- a/simple-mind-map/src/core/render/node/MindMapNode.js
+++ b/simple-mind-map/src/core/render/node/MindMapNode.js
@@ -630,12 +630,15 @@ class MindMapNode {
this.active(e)
})
this.group.on('mousedown', e => {
- e.preventDefault()
const {
readonly,
enableCtrlKeyNodeSelection,
- useLeftKeySelectionRightKeyDrag
+ useLeftKeySelectionRightKeyDrag,
+ mousedownEventPreventDefault
} = this.mindMap.opt
+ if (mousedownEventPreventDefault) {
+ e.preventDefault()
+ }
// 只读模式不需要阻止冒泡
if (!readonly) {
if (this.isRoot) {
diff --git a/simple-mind-map/src/plugins/Drag.js b/simple-mind-map/src/plugins/Drag.js
index a1928f2a..41cfe657 100644
--- a/simple-mind-map/src/plugins/Drag.js
+++ b/simple-mind-map/src/plugins/Drag.js
@@ -93,7 +93,6 @@ class Drag extends Base {
) {
return
}
- e.preventDefault()
this.isMousedown = true
// 记录鼠标按下时的节点
this.mousedownNode = node