From 01d332009c42e4d73948ef17d9fb3db5f9a97661 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: Wed, 22 Jan 2025 18:53:52 +0800 Subject: [PATCH] =?UTF-8?q?Demo=EF=BC=9A=E5=A2=9E=E5=8A=A0=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=85=81=E8=AE=B8=E6=8B=96=E6=8B=BD=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=AF=BC=E5=85=A5=E7=9A=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/lang/en_us.js | 3 ++- web/src/lang/zh_cn.js | 3 ++- web/src/lang/zh_tw.js | 3 ++- web/src/pages/Edit/components/Edit.vue | 6 ++++-- web/src/pages/Edit/components/Setting.vue | 15 +++++++++++++-- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/web/src/lang/en_us.js b/web/src/lang/en_us.js index 641e8f14..277a908d 100644 --- a/web/src/lang/en_us.js +++ b/web/src/lang/en_us.js @@ -82,7 +82,8 @@ export default { cancel: 'Cancel', changeRichTextTip: 'This operation will clear all historical modification records and modify the mind map data. Do you want to continue?', changeRichTextTip2: 'Do you want to switch to rich text mode?', - changeRichTextTip3: 'Do you want to switch to non rich text mode?' + changeRichTextTip3: 'Do you want to switch to non rich text mode?', + enableDragImport: 'Is it allowed to directly drag and drop files to the page for import' }, color: { moreColor: 'More color' diff --git a/web/src/lang/zh_cn.js b/web/src/lang/zh_cn.js index 1744cb20..a7cf7615 100644 --- a/web/src/lang/zh_cn.js +++ b/web/src/lang/zh_cn.js @@ -80,7 +80,8 @@ export default { cancel: '取消', changeRichTextTip: '该操作会清空所有历史修改记录,并且修改思维导图数据,是否继续?', changeRichTextTip2: '是否切换为富文本模式?', - changeRichTextTip3: '是否切换为非富文本模式?' + changeRichTextTip3: '是否切换为非富文本模式?', + enableDragImport: '是否允许直接拖拽文件到页面进行导入' }, color: { moreColor: '更多颜色' diff --git a/web/src/lang/zh_tw.js b/web/src/lang/zh_tw.js index 1e1280fb..a966e96d 100644 --- a/web/src/lang/zh_tw.js +++ b/web/src/lang/zh_tw.js @@ -81,7 +81,8 @@ export default { cancel: '取消', changeRichTextTip: '該操作會清空所有曆史修改記錄,並且修改思維導圖數據,是否繼續?', changeRichTextTip2: '是否切換爲富文本模式?', - changeRichTextTip3: '是否切換爲非富文本模式?' + changeRichTextTip3: '是否切換爲非富文本模式?', + enableDragImport: '是否允許直接拖拽文件到頁面進行導入' }, color: { moreColor: '更多顏色' diff --git a/web/src/pages/Edit/components/Edit.vue b/web/src/pages/Edit/components/Edit.vue index b2e90be0..08098da6 100644 --- a/web/src/pages/Edit/components/Edit.vue +++ b/web/src/pages/Edit/components/Edit.vue @@ -197,6 +197,7 @@ export default { isZenMode: state => state.localConfig.isZenMode, openNodeRichText: state => state.localConfig.openNodeRichText, isShowScrollbar: state => state.localConfig.isShowScrollbar, + enableDragImport: state => state.localConfig.enableDragImport, useLeftKeySelectionRightKeyDrag: state => state.localConfig.useLeftKeySelectionRightKeyDrag, isUseHandDrawnLikeStyle: state => @@ -430,7 +431,7 @@ export default { }) }) } - // createNodePrefixContent: (node) => { + // createNodePrefixContent: node => { // const el = document.createElement('div') // el.style.width = '50px' // el.style.height = '50px' @@ -889,13 +890,14 @@ export default { // 拖拽文件到页面导入 onDragenter() { - if (this.isDragOutlineTreeNode) return + if (!this.enableDragImport || this.isDragOutlineTreeNode) return this.showDragMask = true }, onDragleave() { this.showDragMask = false }, onDrop(e) { + if (!this.enableDragImport) return this.showDragMask = false const dt = e.dataTransfer const file = dt.files && dt.files[0] diff --git a/web/src/pages/Edit/components/Setting.vue b/web/src/pages/Edit/components/Setting.vue index 7f8e659e..1cdf88ca 100644 --- a/web/src/pages/Edit/components/Setting.vue +++ b/web/src/pages/Edit/components/Setting.vue @@ -221,6 +221,16 @@ > + +
+
+ {{ $t('setting.enableDragImport') }} +
+
@@ -392,7 +402,8 @@ export default { enableNodeRichText: true, localConfigs: { isShowScrollbar: false, - isUseHandDrawnLikeStyle: false + isUseHandDrawnLikeStyle: false, + enableDragImport: false } } }, @@ -437,7 +448,7 @@ export default { this.enableNodeRichText = this.localConfig.openNodeRichText this.mousewheelAction = this.localConfig.mousewheelAction this.mousewheelZoomActionReverse = this.localConfig.mousewheelZoomActionReverse - ;['isShowScrollbar', 'isUseHandDrawnLikeStyle'].forEach(key => { + Object.keys(this.localConfigs).forEach(key => { this.localConfigs[key] = this.localConfig[key] }) },