Skip to content

Commit

Permalink
[mini-browser] support '.xhtml' file for preview
Browse files Browse the repository at this point in the history
Fixes #6969

With this change, `.xhtml` files can now be successfully previewed
similarly to `.html` files. The method `resetBackground` has also been
updated with a minor change to also support resetting the background for
`.xhtml` files.

Signed-off-by: Vincent Fugnitto <[email protected]>
  • Loading branch information
vince-fugnitto committed Feb 3, 2020
1 parent b74b53a commit 8d09d16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ export class MiniBrowserOpenHandler extends NavigatableWidgetOpenHandler<MiniBro

protected resetBackground(uri: URI): MaybePromise<boolean> {
const { scheme } = uri;
return scheme === 'http' || scheme === 'https' || (scheme === 'file' && uri.toString().endsWith('.html'));
const uriStr = uri.toString();
return scheme === 'http'
|| scheme === 'https'
|| (scheme === 'file'
&& (uriStr.endsWith('html') || uriStr.endsWith('.xhtml') || uriStr.endsWith('.htm'))
);
}

protected async defaultOptions(): Promise<MiniBrowserOpenerOptions & { widgetOptions: ApplicationShell.WidgetOptions }> {
Expand Down
4 changes: 2 additions & 2 deletions packages/mini-browser/src/node/mini-browser-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ const CODE_EDITOR_PRIORITY = 100;
@injectable()
export class HtmlHandler implements MiniBrowserEndpointHandler {

supportedExtensions(): string {
return 'html';
supportedExtensions(): string[] {
return ['html', 'xhtml', 'htm'];
}

priority(): number {
Expand Down

0 comments on commit 8d09d16

Please sign in to comment.