Skip to content

Commit

Permalink
[mini-browser] add additional 'HtmlHandler' files
Browse files Browse the repository at this point in the history
Fixes eclipse-theia#6969

This change allows previewing multiple different file types
from the `HtmlHandler` endpoint.

The supported file types include:
- `.html` (previously supported)
- `.xhtml` (newly supported)
- `.htm` (newly supported)

The resetBackground method has also been updated to support the
new file types.

Signed-off-by: Vincent Fugnitto <[email protected]>
  • Loading branch information
vince-fugnitto authored and Sean Hellum committed Mar 12, 2020
1 parent 4dab668 commit a048856
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('.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 a048856

Please sign in to comment.