Skip to content

Commit e74c14f

Browse files
authored
fix(editor): Fix shortcut issue on save buttons (#9309)
1 parent cf441e0 commit e74c14f

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

packages/editor-ui/src/components/MainHeader/WorkflowDetails.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,8 @@ function goToUpgrade() {
623623
type="primary"
624624
:saved="!uiStore.stateIsDirty && !isNewWorkflow"
625625
:disabled="isWorkflowSaving || readOnly"
626+
with-shortcut
627+
:shortcut-tooltip="$locale.baseText('saveWorkflowButton.hint')"
626628
data-test-id="workflow-save-button"
627629
@click="onSaveButtonClick"
628630
/>

packages/editor-ui/src/components/SaveButton.vue

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
<template>
22
<span :class="$style.container" data-test-id="save-button">
33
<span v-if="saved" :class="$style.saved">{{ $locale.baseText('saveButton.saved') }}</span>
4-
<KeyboardShortcutTooltip
5-
v-else
6-
:label="$locale.baseText('saveButton.hint')"
7-
:shortcut="{ keys: ['s'], metaKey: true }"
8-
placement="bottom"
9-
>
4+
<template v-else>
5+
<KeyboardShortcutTooltip
6+
v-if="withShortcut"
7+
:label="shortcutTooltipLabel"
8+
:shortcut="{ keys: ['s'], metaKey: true }"
9+
placement="bottom"
10+
>
11+
<n8n-button
12+
:label="saveButtonLabel"
13+
:loading="isSaving"
14+
:disabled="disabled"
15+
:class="$style.button"
16+
:type="type"
17+
/>
18+
</KeyboardShortcutTooltip>
1019
<n8n-button
20+
v-else
1121
:label="saveButtonLabel"
1222
:loading="isSaving"
1323
:disabled="disabled"
1424
:class="$style.button"
1525
:type="type"
1626
/>
17-
</KeyboardShortcutTooltip>
27+
</template>
1828
</span>
1929
</template>
2030

@@ -50,13 +60,23 @@ export default defineComponent({
5060
type: String,
5161
default: 'primary',
5262
},
63+
withShortcut: {
64+
type: Boolean,
65+
default: false,
66+
},
67+
shortcutTooltip: {
68+
type: String,
69+
},
5370
},
5471
computed: {
5572
saveButtonLabel() {
5673
return this.isSaving
5774
? this.$locale.baseText('saveButton.saving')
5875
: this.$locale.baseText('saveButton.save');
5976
},
77+
shortcutTooltipLabel() {
78+
return this.shortcutTooltip ?? this.$locale.baseText('saveButton.save');
79+
},
6080
},
6181
});
6282
</script>

packages/editor-ui/src/plugins/i18n/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@
14551455
"runData.aiContentBlock.tokens.completion": "Completion:",
14561456
"saveButton.save": "@:_reusableBaseText.save",
14571457
"saveButton.saved": "Saved",
1458-
"saveButton.hint": "Save workflow",
1458+
"saveWorkflowButton.hint": "Save workflow",
14591459
"saveButton.saving": "Saving",
14601460
"settings": "Settings",
14611461
"settings.communityNodes": "Community nodes",

0 commit comments

Comments
 (0)