From 9db47aa8c6a7c96cf4927b0669296b6aa1d6e740 Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Tue, 5 Nov 2019 18:38:07 -0800 Subject: [PATCH] fix markdown cell convert (#8390) --- news/2 Fixes/8386.md | 1 + src/datascience-ui/interactive-common/mainStateController.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 news/2 Fixes/8386.md diff --git a/news/2 Fixes/8386.md b/news/2 Fixes/8386.md new file mode 100644 index 000000000000..33a0b02b729f --- /dev/null +++ b/news/2 Fixes/8386.md @@ -0,0 +1 @@ +Correctly transition markdown cells into code cells. \ No newline at end of file diff --git a/src/datascience-ui/interactive-common/mainStateController.ts b/src/datascience-ui/interactive-common/mainStateController.ts index 30ee661c1f20..2f2edac75563 100644 --- a/src/datascience-ui/interactive-common/mainStateController.ts +++ b/src/datascience-ui/interactive-common/mainStateController.ts @@ -567,8 +567,8 @@ export class MainStateController implements IMessageHandler { if (index >= 0 && this.pendingState.cellVMs[index].cell.data.cell_type !== newType) { const cellVMs = [...this.pendingState.cellVMs]; const current = this.pendingState.cellVMs[index]; - const newSource = current.focused ? this.getMonacoEditorContents(cellId) : current.cell.data.source; - const newCell = { ...current, inputBlockText: newSource, cell: { ...current.cell, state: CellState.executing, data: { ...current.cell.data, cell_type: newType, source: newSource } } }; + const newSource = current.focused ? this.getMonacoEditorContents(cellId) : concatMultilineStringInput(current.cell.data.source); + const newCell = { ...current, inputBlockText: newSource, cell: { ...current.cell, state: CellState.finished, data: { ...current.cell.data, cell_type: newType, source: newSource } } }; // tslint:disable-next-line: no-any cellVMs[index] = (newCell as any); // This is because IMessageCell doesn't fit in here. But message cells can't change type this.setState({ cellVMs });