feat: adds Save As support to the file editor#1750
feat: adds Save As support to the file editor#1750pedrolamas merged 4 commits intofluidd-core:developfrom
Conversation
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
There was a problem hiding this comment.
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>
| onFilenameChange () { | ||
| if (this.restoreViewStateStorage) { | ||
| this.viewStateHash = 'monaco.' + md5(this.apiFileUrl) | ||
| } |
There was a problem hiding this comment.
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.
Let's ignore this one for now.
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
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