Add commands to quickly switch between svg preview and text

Fixes #245180
This commit is contained in:
Matt Bierner
2025-03-31 14:36:59 -07:00
parent 2958ac85da
commit f2513b5ea7
7 changed files with 193 additions and 106 deletions

View File

@@ -90,6 +90,18 @@
"command": "imagePreview.copyImage",
"title": "%command.copyImage%",
"category": "Image Preview"
},
{
"command": "imagePreview.reopenAsPreview",
"title": "%command.reopenAsPreview%",
"category": "Image Preview",
"icon": "$(preview)"
},
{
"command": "imagePreview.reopenAsText",
"title": "%command.reopenAsText%",
"category": "Image Preview",
"icon": "$(go-to-file)"
}
],
"menus": {
@@ -107,6 +119,16 @@
{
"command": "imagePreview.copyImage",
"when": "false"
},
{
"command": "imagePreview.reopenAsPreview",
"when": "activeEditor == workbench.editors.files.textFileEditor && resourceExtname == '.svg'",
"group": "navigation"
},
{
"command": "imagePreview.reopenAsText",
"when": "activeCustomEditorId == 'imagePreview.previewEditor' && resourceExtname == '.svg'",
"group": "navigation"
}
],
"webview/context": [
@@ -114,6 +136,18 @@
"command": "imagePreview.copyImage",
"when": "webviewId == 'imagePreview.previewEditor'"
}
],
"editor/title": [
{
"command": "imagePreview.reopenAsPreview",
"when": "editorFocus && resourceExtname == '.svg'",
"group": "navigation"
},
{
"command": "imagePreview.reopenAsText",
"when": "activeCustomEditorId == 'imagePreview.previewEditor' && resourceExtname == '.svg'",
"group": "navigation"
}
]
}
},