mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-30 18:12:29 +01:00
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:
@@ -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}`,
|
||||
{
|
||||
|
||||
+6
-6
@@ -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,
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user