Support opening MHTML files in integrated browser (#333307)

* Support opening MHTML files in integrated browser

* Support opening MHTML files with editor resolver
This commit is contained in:
吉井 啓人(YOSHII, Hiroto)
2026-09-04 08:28:15 +00:00
committed by GitHub
parent ee99b8a2b8
commit df0ea766fc
2 changed files with 7 additions and 7 deletions
@@ -108,7 +108,7 @@ class BrowserEditorResolverContribution implements IWorkbenchContribution {
}
);
for (const extension of ['html', 'htm']) {
for (const extension of ['html', 'htm', 'mhtml', 'mht']) {
editorResolverService.registerEditor(
`${Schemas.file}:/**/*.${extension}`,
{
@@ -340,9 +340,9 @@ class OpenIntegratedBrowserAction extends Action2 {
class OpenFileInIntegratedBrowserAction extends Action2 {
constructor() {
const IS_LOCAL_HTML_FILE = ContextKeyExpr.and(
const IS_SUPPORTED_LOCAL_BROWSER_FILE = ContextKeyExpr.and(
ResourceContextKey.Scheme.isEqualTo(Schemas.file),
ContextKeyExpr.regex(ResourceContextKey.Extension.key, /\.html?$/i),
ContextKeyExpr.regex(ResourceContextKey.Extension.key, /\.(?:html?|mht(?:ml)?)$/i),
);
super({
id: BrowserViewCommandId.OpenFile,
@@ -350,25 +350,25 @@ class OpenFileInIntegratedBrowserAction extends Action2 {
category: BrowserActionCategory,
icon: Codicon.globe,
f1: true,
precondition: IS_LOCAL_HTML_FILE,
precondition: IS_SUPPORTED_LOCAL_BROWSER_FILE,
menu: [
{
id: MenuId.ExplorerContext,
group: 'navigation',
order: 29,
when: IS_LOCAL_HTML_FILE,
when: IS_SUPPORTED_LOCAL_BROWSER_FILE,
},
{
id: MenuId.EditorTitleContext,
group: '1_open',
order: 5,
when: IS_LOCAL_HTML_FILE,
when: IS_SUPPORTED_LOCAL_BROWSER_FILE,
},
{
id: MenuId.EditorTitle,
group: 'navigation',
order: 99,
when: IS_LOCAL_HTML_FILE,
when: IS_SUPPORTED_LOCAL_BROWSER_FILE,
},
]
});