diff --git a/src/components/widgets/filesystem/FileEditor.vue b/src/components/widgets/filesystem/FileEditor.vue index c49ce643dd..11df8bcaca 100644 --- a/src/components/widgets/filesystem/FileEditor.vue +++ b/src/components/widgets/filesystem/FileEditor.vue @@ -101,6 +101,15 @@ export default class FileEditor extends Mixins(BrowserMixin) { rulers: (this.isMobileViewport) ? [80, 120] : [] }) + this.editor.addAction({ + id: 'action-save-file', + label: this.$tc('app.general.btn.save'), + keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS], + run: () => { + this.$emit('save') + } + }) + const filename = this.path ? `${this.path}/${this.filename}` : this.filename const apiFileUrl = `${this.activeInstance.apiUrl}/server/files/${filename}` @@ -126,7 +135,7 @@ export default class FileEditor extends Mixins(BrowserMixin) { // Focus the editor. this.$nextTick(() => { - this.editor?.focus() + focus() }) this.$emit('ready') @@ -138,6 +147,10 @@ export default class FileEditor extends Mixins(BrowserMixin) { }) } + focus () { + this.editor?.focus() + } + showCommandPalette () { if (this.editor) { this.editor.focus() diff --git a/src/components/widgets/filesystem/FileEditorDialog.vue b/src/components/widgets/filesystem/FileEditorDialog.vue index 9662a58a58..39d7b38aa8 100644 --- a/src/components/widgets/filesystem/FileEditorDialog.vue +++ b/src/components/widgets/filesystem/FileEditorDialog.vue @@ -104,6 +104,7 @@ :readonly="readonly" :code-lens="codeLens" @ready="editorReady = true" + @save="emitSave(false)" />