mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
feat(editor): Enable saving workflow when node details view is open (#5856)
* feat(editor): Enable saving workflow when node details view is open * ⚡ Preventing event propagation * ⚡ Move save event handler to `NodeDetailsView` * ✅ Added e2e tests * 👕 Fixing linting and removing unnecessary event logic --------- Co-authored-by: Oleg Ivaniv <oleg@n8n.io>
This commit is contained in:
committed by
GitHub
parent
83aef17120
commit
0a59002ef8
@@ -92,6 +92,7 @@
|
||||
:isProductionExecutionPreview="isProductionExecutionPreview"
|
||||
@valueChanged="valueChanged"
|
||||
@stopExecution="stopExecution"
|
||||
@saveKeyboardShortcut="onSaveKeyboardShortcut"
|
||||
/>
|
||||
<node-creation
|
||||
v-if="!isReadOnly"
|
||||
@@ -752,9 +753,24 @@ export default mixins(
|
||||
|
||||
return uniqueName;
|
||||
},
|
||||
async onSaveKeyboardShortcut() {
|
||||
const saved = await this.saveCurrentWorkflow();
|
||||
async onSaveKeyboardShortcut(e: KeyboardEvent) {
|
||||
let saved = await this.saveCurrentWorkflow();
|
||||
if (saved) await this.settingsStore.fetchPromptsData();
|
||||
if (this.activeNode) {
|
||||
// If NDV is open, save will not work from editable input fields
|
||||
// so don't show success message if this is true
|
||||
if (e.target instanceof HTMLInputElement) {
|
||||
saved = e.target.readOnly;
|
||||
} else {
|
||||
saved = true;
|
||||
}
|
||||
if (saved) {
|
||||
this.$showMessage({
|
||||
title: this.$locale.baseText('generic.workflowSaved'),
|
||||
type: 'success',
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
showTriggerCreator(source: NodeCreatorOpenSource) {
|
||||
if (this.createNodeActive) return;
|
||||
@@ -994,6 +1010,19 @@ export default mixins(
|
||||
}
|
||||
},
|
||||
async keyDown(e: KeyboardEvent) {
|
||||
if (e.key === 's' && this.isCtrlKeyPressed(e)) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if (this.isReadOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.callDebounced('onSaveKeyboardShortcut', { debounceTime: 1000 }, e);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
const path = e.path || (e.composedPath && e.composedPath());
|
||||
|
||||
@@ -1082,16 +1111,6 @@ export default mixins(
|
||||
title: this.$locale.baseText('nodeView.showMessage.keyDown.title'),
|
||||
type: 'success',
|
||||
});
|
||||
} else if (e.key === 's' && this.isCtrlKeyPressed(e)) {
|
||||
// Save workflow
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if (this.isReadOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.callDebounced('onSaveKeyboardShortcut', { debounceTime: 1000 });
|
||||
} else if (e.key === 'Enter') {
|
||||
// Activate the last selected node
|
||||
const lastSelectedNode = this.lastSelectedNode;
|
||||
|
||||
Reference in New Issue
Block a user