From a38f2437270d71c946ecbdfd46a75f93cbdf115f Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 17 Jan 2023 12:18:45 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=BB=84=E4=BB=B6=E7=A6=81=E6=AD=A2=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E5=92=8C=E7=A7=BB=E5=85=A5Tab=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/canvas/utils/shortcutKey.js | 14 +++++++++++--- frontend/src/components/deDrag/index.vue | 6 ++++-- frontend/src/lang/en.js | 1 + frontend/src/lang/tw.js | 1 + frontend/src/lang/zh.js | 1 + 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/canvas/utils/shortcutKey.js b/frontend/src/components/canvas/utils/shortcutKey.js index c28c11a40c..bfed338e7a 100644 --- a/frontend/src/components/canvas/utils/shortcutKey.js +++ b/frontend/src/components/canvas/utils/shortcutKey.js @@ -1,5 +1,7 @@ import store from '@/store' import eventBus from '@/components/canvas/utils/eventBus' +import { $warning } from '@/utils/message' +import i18n from '@/lang' const ctrlKey = 17 const commandKey = 91 // mac command @@ -25,6 +27,8 @@ const enlargeKey = 190 // command + . export const keycodes = [66, 67, 68, 69, 71, 76, 80, 83, 85, 86, 88, 89, 90] +const ignoreComponent = ['de-button', 'de-reset-button'] + // 与组件状态无关的操作 const basemap = { [vKey]: paste, @@ -134,9 +138,13 @@ function decompose() { function copyAndPast() { if (store.state.curComponent) { - store.commit('copy') - store.commit('paste', false) - store.commit('recordSnapshot', 'copyAndPast') + if (ignoreComponent.includes(store.state.curComponent.component)) { + $warning(i18n.t('panel.forbidden_copy')) + } else { + store.commit('copy') + store.commit('paste', false) + store.commit('recordSnapshot', 'copyAndPast') + } } } diff --git a/frontend/src/components/deDrag/index.vue b/frontend/src/components/deDrag/index.vue index b9739ab4f8..1fa9013b71 100644 --- a/frontend/src/components/deDrag/index.vue +++ b/frontend/src/components/deDrag/index.vue @@ -455,7 +455,9 @@ export default { latestMoveY: 0, seriesIdMap: { id: '' - } + }, + // 禁止移入Tab中的组件 + ignoreTabMoveComponent: ['de-button', 'de-reset-button', 'de-tabs'] } }, computed: { @@ -1966,7 +1968,7 @@ export default { const width = this.width const height = this.height // tab 移入检测开启 tab组件不能相互移入另一个tab组件 - if (this.isTabMoveCheck && this.element.type !== 'de-tabs') { + if (this.isTabMoveCheck && !this.ignoreTabMoveComponent.includes(this.element.component)) { const nodes = this.$el.parentNode.childNodes // 获取当前父节点下所有子节点 for (const item of nodes) { if ( diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index e36c6bab0f..5794f8d966 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -1963,6 +1963,7 @@ export default { back_parent: 'Back to previous' }, panel: { + forbidden_copy: 'Forbidden copy', url_check_error: 'Jump error, Illegal URL', view_style: 'View Style', view_color_setting: 'View Color Setting', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 9339083849..d65acffd68 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -1957,6 +1957,7 @@ export default { back_parent: '返回上一級' }, panel: { + forbidden_copy: '當前組件不允許復製', url_check_error: '跳轉錯誤,URL不合法', view_style: '視圖樣式', view_color_setting: '視圖配色', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index c5ecf9bc9a..379c69a9c3 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -1957,6 +1957,7 @@ export default { back_parent: '返回上一级' }, panel: { + forbidden_copy: '当前组件不允许复制', url_check_error: '跳转错误,URL不合法', view_style: '视图样式', view_color_setting: '视图配色',