web - use suggestedName
property for save dialogs (#130034)
This commit is contained in:
parent
53c50875c9
commit
95ca115b9f
|
@ -111,7 +111,7 @@
|
|||
"@types/trusted-types": "^1.0.6",
|
||||
"@types/vscode-windows-registry": "^1.0.0",
|
||||
"@types/webpack": "^4.41.25",
|
||||
"@types/wicg-file-system-access": "^2020.9.1",
|
||||
"@types/wicg-file-system-access": "^2020.9.2",
|
||||
"@types/windows-foreground-love": "^0.3.0",
|
||||
"@types/windows-mutex": "^0.4.0",
|
||||
"@types/windows-process-tree": "^0.2.0",
|
||||
|
|
|
@ -12,6 +12,7 @@ import { memoize } from 'vs/base/common/decorators';
|
|||
import { HTMLFileSystemProvider } from 'vs/platform/files/browser/htmlFileSystemProvider';
|
||||
import { localize } from 'vs/nls';
|
||||
import { getMediaOrTextMime } from 'vs/base/common/mime';
|
||||
import { basename } from 'vs/base/common/resources';
|
||||
|
||||
export class FileDialogService extends AbstractFileDialogService implements IFileDialogService {
|
||||
|
||||
|
@ -96,7 +97,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil
|
|||
|
||||
let fileHandle: FileSystemHandle | undefined = undefined;
|
||||
try {
|
||||
fileHandle = await window.showSaveFilePicker({ types: this.getFilePickerTypes(options.filters) });
|
||||
fileHandle = await window.showSaveFilePicker({ types: this.getFilePickerTypes(options.filters), ...{ suggestedName: basename(defaultUri) } });
|
||||
} catch (error) {
|
||||
return; // `showSaveFilePicker` will throw an error when the user cancels
|
||||
}
|
||||
|
@ -127,7 +128,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil
|
|||
|
||||
let fileHandle: FileSystemHandle | undefined = undefined;
|
||||
try {
|
||||
fileHandle = await window.showSaveFilePicker({ types: this.getFilePickerTypes(options.filters) });
|
||||
fileHandle = await window.showSaveFilePicker({ types: this.getFilePickerTypes(options.filters), ...options.defaultUri ? { suggestedName: basename(options.defaultUri) } : undefined });
|
||||
} catch (error) {
|
||||
return; // `showSaveFilePicker` will throw an error when the user cancels
|
||||
}
|
||||
|
|
|
@ -735,10 +735,10 @@
|
|||
"@types/webpack-sources" "*"
|
||||
source-map "^0.6.0"
|
||||
|
||||
"@types/wicg-file-system-access@^2020.9.1":
|
||||
version "2020.9.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/wicg-file-system-access/-/wicg-file-system-access-2020.9.1.tgz#ae1f420b0ca70f545c8621a9b63ed29270ef724a"
|
||||
integrity sha512-hEN/YpLwvDjhRJrKoBiyiKtIh2zNkmJ/GY9VWIXNgjy7TBZNM9upfb/rnWDGpOoLomnEQtlTBjFBFCDra1oxOQ==
|
||||
"@types/wicg-file-system-access@^2020.9.2":
|
||||
version "2020.9.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/wicg-file-system-access/-/wicg-file-system-access-2020.9.2.tgz#6433e5a1d7cfdc58558e15f69276e4f0034088c6"
|
||||
integrity sha512-8ni2EyWi01DBuVqekudo2I+RTfq4Jq93iHmlzq0+eKPkG1uebQA9OUxIDRzOevvw9wF922XYRo4bqP0a6DBF5g==
|
||||
|
||||
"@types/windows-foreground-love@^0.3.0":
|
||||
version "0.3.0"
|
||||
|
|
Loading…
Reference in a new issue