mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
🐛 Fix keyboard shortcut issues (#1934)
* fix keyboard shortcut issues * remove duplicate check * remove duplicate check
This commit is contained in:
parent
b2e2cfa773
commit
a4d0c0fcad
|
@ -31,9 +31,6 @@ const module: Module<IUiState, IRootState> = {
|
|||
isModalActive: (state: IUiState) => {
|
||||
return (name: string) => state.modalStack.length > 0 && name === state.modalStack[0];
|
||||
},
|
||||
anyModalsOpen: (state: IUiState) => {
|
||||
return state.modalStack.length > 0;
|
||||
},
|
||||
sidebarMenuCollapsed: (state: IUiState): boolean => state.sidebarMenuCollapsed,
|
||||
},
|
||||
mutations: {
|
||||
|
|
|
@ -514,15 +514,29 @@ export default mixins(
|
|||
// else which should ignore the default keybindings
|
||||
for (let index = 0; index < path.length; index++) {
|
||||
if (path[index].className && typeof path[index].className === 'string' && (
|
||||
path[index].className.includes('el-message-box') ||
|
||||
path[index].className.includes('el-select') ||
|
||||
path[index].className.includes('ignore-key-press')
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
const anyModalsOpen = this.$store.getters['ui/anyModalsOpen'];
|
||||
if (anyModalsOpen) {
|
||||
|
||||
// el-dialog or el-message-box element is open
|
||||
if (window.document.body.classList.contains('el-popup-parent--hidden')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.key === 'Escape') {
|
||||
this.createNodeActive = false;
|
||||
if (this.activeNode) {
|
||||
this.$externalHooks().run('dataDisplay.nodeEditingFinished');
|
||||
this.$store.commit('setActiveNode', null);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// node modal is open
|
||||
if (this.activeNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -533,15 +547,12 @@ export default mixins(
|
|||
e.preventDefault();
|
||||
|
||||
this.callDebounced('deleteSelectedNodes', 500);
|
||||
} else if (e.key === 'Escape') {
|
||||
this.$externalHooks().run('dataDisplay.nodeEditingFinished');
|
||||
this.createNodeActive = false;
|
||||
this.$store.commit('setActiveNode', null);
|
||||
|
||||
} else if (e.key === 'Tab') {
|
||||
this.createNodeActive = !this.createNodeActive && !this.isReadOnly;
|
||||
} else if (e.key === this.controlKeyCode) {
|
||||
this.ctrlKeyPressed = true;
|
||||
} else if (e.key === 'F2') {
|
||||
} else if (e.key === 'F2' && !this.isReadOnly) {
|
||||
const lastSelectedNode = this.lastSelectedNode;
|
||||
if (lastSelectedNode !== null) {
|
||||
this.callDebounced('renameNodePrompt', 1500, lastSelectedNode.name);
|
||||
|
|
Loading…
Reference in a new issue