提交 3a54cd7c 编写于 作者: M Matt Bierner

Disable markdown commands when in markdown cells in notebooks

Fixes #101514
上级 3c77120d
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
"editor/title": [ "editor/title": [
{ {
"command": "markdown.showPreviewToSide", "command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown", "when": "editorLangId == markdown && !notebookEditorFocused",
"alt": "markdown.showPreview", "alt": "markdown.showPreview",
"group": "navigation" "group": "navigation"
}, },
...@@ -120,17 +120,17 @@ ...@@ -120,17 +120,17 @@
"commandPalette": [ "commandPalette": [
{ {
"command": "markdown.showPreview", "command": "markdown.showPreview",
"when": "editorLangId == markdown", "when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation" "group": "navigation"
}, },
{ {
"command": "markdown.showPreviewToSide", "command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown", "when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation" "group": "navigation"
}, },
{ {
"command": "markdown.showLockedPreviewToSide", "command": "markdown.showLockedPreviewToSide",
"when": "editorLangId == markdown", "when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation" "group": "navigation"
}, },
{ {
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
}, },
{ {
"command": "markdown.showPreviewSecuritySelector", "command": "markdown.showPreviewSecuritySelector",
"when": "editorLangId == markdown" "when": "editorLangId == markdown && !notebookEditorFocused"
}, },
{ {
"command": "markdown.showPreviewSecuritySelector", "command": "markdown.showPreviewSecuritySelector",
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
}, },
{ {
"command": "markdown.preview.refresh", "command": "markdown.preview.refresh",
"when": "editorLangId == markdown" "when": "editorLangId == markdown && !notebookEditorFocused"
}, },
{ {
"command": "markdown.preview.refresh", "command": "markdown.preview.refresh",
...@@ -165,13 +165,13 @@ ...@@ -165,13 +165,13 @@
"command": "markdown.showPreview", "command": "markdown.showPreview",
"key": "shift+ctrl+v", "key": "shift+ctrl+v",
"mac": "shift+cmd+v", "mac": "shift+cmd+v",
"when": "editorLangId == markdown" "when": "editorLangId == markdown && !notebookEditorFocused"
}, },
{ {
"command": "markdown.showPreviewToSide", "command": "markdown.showPreviewToSide",
"key": "ctrl+k v", "key": "ctrl+k v",
"mac": "cmd+k v", "mac": "cmd+k v",
"when": "editorLangId == markdown" "when": "editorLangId == markdown && !notebookEditorFocused"
} }
], ],
"configuration": { "configuration": {
......
...@@ -612,7 +612,12 @@ export class DynamicMarkdownPreview extends Disposable implements ManagedMarkdow ...@@ -612,7 +612,12 @@ export class DynamicMarkdownPreview extends Disposable implements ManagedMarkdow
})); }));
this._register(vscode.window.onDidChangeActiveTextEditor(editor => { this._register(vscode.window.onDidChangeActiveTextEditor(editor => {
if (editor && isMarkdownFile(editor.document) && !this._locked && !this._preview.isPreviewOf(editor.document.uri)) { // Only allow previewing normal text editors which have a viewColumn: See #101514
if (typeof editor?.viewColumn === 'undefined') {
return;
}
if (isMarkdownFile(editor.document) && !this._locked && !this._preview.isPreviewOf(editor.document.uri)) {
const line = getVisibleLine(editor); const line = getVisibleLine(editor);
this.update(editor.document.uri, line ? new StartingScrollLine(line) : undefined); this.update(editor.document.uri, line ? new StartingScrollLine(line) : undefined);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册