Merge pull request #6493 from dataease/pr@dev@refactor_panel-shortkey
refactor(仪表板): 优化仪表板快捷键相应区域,避免弹框中的快捷操作影响仪表板
This commit is contained in:
commit
d38c872060
@ -3,7 +3,7 @@
|
||||
<img
|
||||
v-if="!showLink"
|
||||
:style="imageAdapter"
|
||||
:src="element.propValue"
|
||||
:src="imgUrl"
|
||||
>
|
||||
<a
|
||||
v-if="showLink"
|
||||
@ -13,13 +13,15 @@
|
||||
>
|
||||
<img
|
||||
:style="imageAdapter"
|
||||
:src="element.propValue"
|
||||
:src="imgUrl"
|
||||
>
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { imgUrlTrans } from '@/components/canvas/utils/utils'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
element: {
|
||||
@ -33,6 +35,9 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
imgUrl() {
|
||||
return imgUrlTrans(this.element.propValue)
|
||||
},
|
||||
showLink() {
|
||||
return this.editMode === 'preview' && this.element && this.element.hyperlinks && this.element.hyperlinks.enable
|
||||
},
|
||||
|
||||
@ -50,10 +50,32 @@ const unlockMap = {
|
||||
|
||||
let isCtrlOrCommandDown = false
|
||||
|
||||
|
||||
// 检查当前页面是否有弹框
|
||||
const checkDialog = () => {
|
||||
let haveDialog = false
|
||||
document.querySelectorAll('.el-dialog__wrapper').forEach(element => {
|
||||
if (window.getComputedStyle(element).getPropertyValue('display') !== 'none') {
|
||||
haveDialog = true
|
||||
}
|
||||
})
|
||||
document.querySelectorAll('.el-popover').forEach(element => {
|
||||
if (window.getComputedStyle(element).getPropertyValue('display') !== 'none') {
|
||||
haveDialog = true
|
||||
}
|
||||
})
|
||||
// 富文本单框
|
||||
if (document.querySelector('.tox-dialog-wrap')) {
|
||||
haveDialog = true
|
||||
}
|
||||
|
||||
return haveDialog
|
||||
}
|
||||
|
||||
// Monitor key operations globally and execute corresponding commands
|
||||
export function listenGlobalKeyDown() {
|
||||
window.onkeydown = (e) => {
|
||||
if (!store.state.isInEditor) return
|
||||
if (!store.state.isInEditor || checkDialog()) return
|
||||
const { keyCode } = e
|
||||
if (keyCode === ctrlKey || keyCode === commandKey) {
|
||||
isCtrlOrCommandDown = true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user