From b7eb0e2657c82c5942fa84349955794efff311a1 Mon Sep 17 00:00:00 2001 From: firai Date: Sat, 25 Nov 2023 20:22:16 +0800 Subject: [PATCH] Change `Ctrl + Enter` to render Markdown cells (#128) * Don't re-enter edit mode for markdown cells in `vim:run-cell-and-edit` * Refactor (#5) --- src/labCommands.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/labCommands.ts b/src/labCommands.ts index af30413..e06194b 100644 --- a/src/labCommands.ts +++ b/src/labCommands.ts @@ -59,7 +59,15 @@ export function addNotebookCommands( if (current) { const { context, content } = current; NotebookActions.run(content, context.sessionContext); - current.content.mode = 'edit'; + // Don't re-enter edit mode for markdown cells + if ( + content.activeCell !== null && + content.activeCell.model.type === 'markdown' + ) { + // no-op + } else { + current.content.mode = 'edit'; + } } }, isEnabled