Skip to content

Commit

Permalink
For untitled notebook, show simple dialog instead of native one. (#10279
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rebornix authored Jun 2, 2022
1 parent 735f65c commit fb90ab7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/platform/export/exportDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SaveDialogOptions, Uri } from 'vscode';
import { IApplicationShell, IWorkspaceService } from '../common/application/types';
import * as localize from '../common/utils/localize';
import { ExportFormat, IExportDialog } from './types';
import { IsWebExtension } from '../common/types';

// File extensions for each export method
export const PDFExtensions = { PDF: ['pdf'] };
Expand All @@ -19,7 +20,8 @@ export const PythonExtensions = { Python: ['py'] };
export class ExportDialog implements IExportDialog {
constructor(
@inject(IApplicationShell) private readonly applicationShell: IApplicationShell,
@inject(IWorkspaceService) private workspaceService: IWorkspaceService
@inject(IWorkspaceService) private workspaceService: IWorkspaceService,
@inject(IsWebExtension) private readonly isWebExtension: boolean
) {}

public async showDialog(
Expand Down Expand Up @@ -70,7 +72,12 @@ export class ExportDialog implements IExportDialog {
return this.applicationShell.showSaveDialog(options);
}

private async getDefaultUri(source: Uri | undefined, targetFileName: string): Promise<Uri> {
private async getDefaultUri(source: Uri | undefined, targetFileName: string): Promise<Uri | undefined> {
if (source && source.scheme === 'untitled' && this.isWebExtension) {
// Force using simple file dialog
return undefined;
}

if (
!source ||
source.scheme === 'file' ||
Expand Down

0 comments on commit fb90ab7

Please sign in to comment.