refactor: 去掉画布键盘事件 防止其他菜单出现粘贴报错的情况

This commit is contained in:
wangjiahao 2021-10-12 14:25:45 +08:00
parent e9acd38621
commit a50747c8e3

View File

@ -53,31 +53,31 @@ const unlockMap = {
let isCtrlDown = false
// 全局监听按键操作并执行相应命令
export function listenGlobalKeyDown() {
window.onkeydown = (e) => {
const { curComponent } = store.state
if (e.keyCode === ctrlKey) {
isCtrlDown = true
} else if (e.keyCode === deleteKey && curComponent) {
store.commit('deleteComponent')
store.commit('recordSnapshot')
} else if (isCtrlDown) {
if (!curComponent || !curComponent.isLock) {
e.preventDefault()
unlockMap[e.keyCode] && unlockMap[e.keyCode]()
} else if (curComponent && curComponent.isLock) {
e.preventDefault()
lockMap[e.keyCode] && lockMap[e.keyCode]()
}
}
}
window.onkeyup = (e) => {
if (e.keyCode === ctrlKey) {
isCtrlDown = false
}
}
}
// export function listenGlobalKeyDown() {
// window.onkeydown = (e) => {
// const { curComponent } = store.state
// if (e.keyCode === ctrlKey) {
// isCtrlDown = true
// } else if (e.keyCode === deleteKey && curComponent) {
// store.commit('deleteComponent')
// store.commit('recordSnapshot')
// } else if (isCtrlDown) {
// if (!curComponent || !curComponent.isLock) {
// e.preventDefault()
// unlockMap[e.keyCode] && unlockMap[e.keyCode]()
// } else if (curComponent && curComponent.isLock) {
// e.preventDefault()
// lockMap[e.keyCode] && lockMap[e.keyCode]()
// }
// }
// }
//
// window.onkeyup = (e) => {
// if (e.keyCode === ctrlKey) {
// isCtrlDown = false
// }
// }
// }
function copy() {
store.commit('copy')