-
-
Notifications
You must be signed in to change notification settings - Fork 531
feat: adds Save As support to the file editor #1750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: adds Save As support to the file editor #1750
Conversation
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a "Save As" feature to the file editor, allowing users to save the current file with a new name. The implementation includes a new toolbar button with an icon, a keyboard shortcut (Ctrl/Cmd+Shift+S), and integration with the existing file name dialog.
Key changes:
- New "Save As" button in the file editor toolbar with tooltip and icon
- Keyboard shortcut (Ctrl/Cmd+Shift+S) registered in Monaco editor
- View state restoration updated to track filename changes when saving as a new file
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/locales/en.yaml | Adds save_as translation key for the new "Save As" button text |
| src/globals.ts | Imports and registers mdiContentSaveEditOutline icon for the "Save As" button |
| src/components/widgets/filesystem/FileNameDialog.vue | Disables spellcheck on filename input field |
| src/components/widgets/filesystem/FileSystem.vue | Adds handleSaveAsFileChanges handler that opens filename dialog and updates filename before saving |
| src/components/widgets/filesystem/FileEditorDialog.vue | Adds "Save As" button with tooltip, updates emitSave to handle both boolean and object parameters for save options |
| src/components/widgets/filesystem/FileEditor.vue | Adds filename watcher to update view state hash, registers Ctrl/Cmd+Shift+S keyboard shortcut, refactors path/URL computation into computed properties |
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
| onFilenameChange () { | ||
| if (this.restoreViewStateStorage) { | ||
| this.viewStateHash = 'monaco.' + md5(this.apiFileUrl) | ||
| } |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the filename changes (e.g., during "Save As"), the Monaco editor model's URI is not updated. The model was created with monaco.Uri.file(this.pathFilename) in initEditor, but changing the filename prop doesn't update the model's URI. This can cause language detection issues if the file extension changes. Consider updating the model URI or recreating the model when the filename changes: this.editor?.getModel()?.dispose(); const model = monaco.editor.createModel(this.editor.getValue(), undefined, monaco.Uri.file(this.pathFilename)); this.editor?.setModel(model);
| } | |
| } | |
| // Update Monaco model URI when filename changes | |
| if (this.editor && monaco) { | |
| const oldModel = this.editor.getModel() | |
| if (oldModel) oldModel.dispose() | |
| const newModel = monaco.editor.createModel( | |
| this.editor.getValue(), | |
| undefined, | |
| monaco.Uri.file(this.pathFilename) | |
| ) | |
| this.editor.setModel(newModel) | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ignore this one for now.
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Adds a new "Save as" option to the File Editor, allowing to easily name a file while saving.
This also changes the Filename Change dialog behavior to select the filename portion of the filename when the dialog opens.
Smaller and more compact toolbar with tooltips
Save As filename dialog