add extension filter when open save dialog (#654)

This commit is contained in:
an-lee
2024-06-05 09:47:23 +08:00
committed by GitHub
parent d805ba7834
commit cd1a16132a
5 changed files with 36 additions and 0 deletions

View File

@@ -159,6 +159,12 @@ export const MediaCaption = () => {
defaultPath: `${media.name}(${segment.startTime.toFixed(
2
)}s-${segment.endTime.toFixed(2)}s).mp3`,
filters: [
{
name: "Audio",
extensions: ["mp3"],
},
],
})
.then((savePath) => {
if (!savePath) return;
@@ -208,6 +214,12 @@ export const MediaCaption = () => {
defaultPath: `${media.name}(${activeRegion.start.toFixed(
2
)}s-${activeRegion.end.toFixed(2)}s).mp3`,
filters: [
{
name: "Audio",
extensions: ["mp3"],
},
],
})
.then((savePath) => {
if (!savePath) return;

View File

@@ -229,6 +229,12 @@ export const MediaCurrentRecording = () => {
.showSaveDialog({
title: t("download"),
defaultPath: currentRecording.filename,
filters: [
{
name: "Audio",
extensions: [currentRecording.filename.split(".").pop()],
},
],
})
.then((savePath) => {
if (!savePath) return;

View File

@@ -100,6 +100,12 @@ export const MediaPlayer = () => {
.showSaveDialog({
title: t("download"),
defaultPath: media.filename,
filters: [
{
name: media.mediaType,
extensions: [media.filename.split(".").pop()],
},
],
})
.then((savePath) => {
if (!savePath) return;

View File

@@ -71,6 +71,12 @@ export const MediaTranscriptionReadButton = () => {
.showSaveDialog({
title: t("download"),
defaultPath: recording.filename,
filters: [
{
name: "Audio",
extensions: [recording.filename.split(".").pop()],
},
],
})
.then((savePath) => {
if (!savePath) return;

View File

@@ -129,6 +129,12 @@ export const AssistantMessageComponent = (props: {
.showSaveDialog({
title: t("download"),
defaultPath: speech.filename,
filters: [
{
name: "Audio",
extensions: [speech.filename.split(".").pop()],
},
],
})
.then((savePath) => {
if (!savePath) return;