diff --git a/src/infrastructure/Dialog/Browser/FileSaverDialog.ts b/src/infrastructure/Dialog/Browser/FileSaverDialog.ts index b29e565d3..4d77961c5 100644 --- a/src/infrastructure/Dialog/Browser/FileSaverDialog.ts +++ b/src/infrastructure/Dialog/Browser/FileSaverDialog.ts @@ -39,4 +39,6 @@ const MimeTypes: Record = { // otherwise they ignore extension and save the file as text. [FileType.BatchFile]: 'application/bat', // https://en.wikipedia.org/wiki/Batch_file [FileType.ShellScript]: 'text/x-shellscript', // https://de.wikipedia.org/wiki/Shellskript#MIME-Typ + [FileType.Json]: 'application/json', // https://en.wikipedia.org/wiki/JSON + } as const; diff --git a/src/infrastructure/Dialog/Electron/NodeElectronSaveFileDialog.ts b/src/infrastructure/Dialog/Electron/NodeElectronSaveFileDialog.ts index 6eef3ef04..4364411e1 100644 --- a/src/infrastructure/Dialog/Electron/NodeElectronSaveFileDialog.ts +++ b/src/infrastructure/Dialog/Electron/NodeElectronSaveFileDialog.ts @@ -164,6 +164,12 @@ const FileTypeSpecificFilters: Record = { extensions: ['sh', 'bash', 'zsh'], }, ], + [FileType.Json]: [ + { + name: 'JSON Files', + extensions: ['json'], + }, + ], }; type SaveDialogOutcome = diff --git a/src/presentation/assets/icons/floppy-disk-gear.svg b/src/presentation/assets/icons/floppy-disk-gear.svg new file mode 100644 index 000000000..3f5b8e793 --- /dev/null +++ b/src/presentation/assets/icons/floppy-disk-gear.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/presentation/common/Dialog.ts b/src/presentation/common/Dialog.ts index 2882c5b8e..e79f53a8e 100644 --- a/src/presentation/common/Dialog.ts +++ b/src/presentation/common/Dialog.ts @@ -6,6 +6,7 @@ export interface Dialog { export enum FileType { BatchFile, ShellScript, + Json, } export type SaveFileOutcome = SuccessfulSaveFile | FailedSaveFile; diff --git a/src/presentation/components/Code/CodeButtons/Save/SaveSelectionButton.vue b/src/presentation/components/Code/CodeButtons/Save/SaveSelectionButton.vue new file mode 100644 index 000000000..32bb205e7 --- /dev/null +++ b/src/presentation/components/Code/CodeButtons/Save/SaveSelectionButton.vue @@ -0,0 +1,60 @@ + + + diff --git a/src/presentation/components/Code/CodeButtons/TheCodeButtons.vue b/src/presentation/components/Code/CodeButtons/TheCodeButtons.vue index 9cc1dc913..71493e53a 100644 --- a/src/presentation/components/Code/CodeButtons/TheCodeButtons.vue +++ b/src/presentation/components/Code/CodeButtons/TheCodeButtons.vue @@ -2,6 +2,7 @@
+
@@ -14,12 +15,14 @@ import { injectKey } from '@/presentation/injectionSymbols'; import CodeRunButton from './CodeRunButton.vue'; import CodeCopyButton from './CodeCopyButton.vue'; import CodeSaveButton from './Save/CodeSaveButton.vue'; +import SaveSelectionButton from './Save/SaveSelectionButton.vue'; export default defineComponent({ components: { CodeRunButton, CodeCopyButton, CodeSaveButton, + SaveSelectionButton, }, setup() { const { currentCode } = injectKey((keys) => keys.useCurrentCode); diff --git a/src/presentation/components/Scripts/Menu/Recommendation/TheRecommendationSelector.vue b/src/presentation/components/Scripts/Menu/Recommendation/TheRecommendationSelector.vue index fdac58ca8..c2fcb3209 100644 --- a/src/presentation/components/Scripts/Menu/Recommendation/TheRecommendationSelector.vue +++ b/src/presentation/components/Scripts/Menu/Recommendation/TheRecommendationSelector.vue @@ -81,12 +81,32 @@ /> + + + + + +