diff --git a/package.json b/package.json index ecfa5cbb..4f811db0 100644 --- a/package.json +++ b/package.json @@ -197,10 +197,10 @@ "when": "!terminalFocus" }, { - "command": "markdown.extension.togglePreviewToSide", + "command": "markdown.extension.closePreviewToSide", "key": "ctrl+k v", "mac": "cmd+k v", - "when": "!terminalFocus" + "when": "markdownPreviewFocus" }, { "command": "markdown.extension.editing.paste", diff --git a/src/preview.ts b/src/preview.ts index 16b05bb0..eaed8602 100644 --- a/src/preview.ts +++ b/src/preview.ts @@ -25,13 +25,8 @@ export function activate(context: ExtensionContext) { commands.executeCommand('markdown.showPreview'); } }), - commands.registerCommand('markdown.extension.togglePreviewToSide', () => { - let editor = window.activeTextEditor; - if (!editor) { - commands.executeCommand('workbench.action.closeActiveEditor'); - } else if (editor.document.languageId === 'markdown') { - commands.executeCommand('markdown.showPreviewToSide'); - } + commands.registerCommand('markdown.extension.closePreviewToSide', () => { + commands.executeCommand('workbench.action.closeActiveEditor'); }) ); }