not trigger shortcuts when ctrl or command key is pressed (#668)

* not trigger shortcuts when ctrl or command key is pressed

* exclude alt and shift keys from event trigger
This commit is contained in:
WeidiDeng authored and GitHub committed 2023-11-27 09:31:45 +08:00
1 parent b2bffa8079
commit 773618a177
1 file changed
+1 -1
+1 -1
View File
@@ -43,7 +43,7 @@ export default class Hotkey {
if (this.art.isFocus) {
const tag = document.activeElement.tagName.toUpperCase();
const editable = document.activeElement.getAttribute('contenteditable');
if (tag !== 'INPUT' && tag !== 'TEXTAREA' && editable !== '' && editable !== 'true') {
if (tag !== 'INPUT' && tag !== 'TEXTAREA' && editable !== '' && editable !== 'true' && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) {
const events = this.keys[event.keyCode];
if (events) {
event.preventDefault();