From 0b9ef714c823d662815f441aec4a94eaa21940f8 Mon Sep 17 00:00:00 2001 From: Chris LaFreniere <40371649+chlafreniere@users.noreply.github.com> Date: Thu, 4 Nov 2021 10:13:23 -0700 Subject: [PATCH] Fix not being able to type in code cell after switching from text (#17590) (#17592) * Fix not being able to type in code cell after switching from text * comment Co-authored-by: Charles Gagnon --- .../contrib/notebook/browser/cellViews/textCell.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts b/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts index 24fb69ea4e..4c304fdf67 100644 --- a/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts +++ b/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts @@ -509,7 +509,9 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges { // Move cursor to the richTextCursorPosition // We iterate through the output element childnodes to get to the element of cursor location // If the elements exist, we set the selection, else the cursor defaults to beginning. - if (!this.markdownMode && this.cellModel.richTextCursorPosition) { + // Only do this if the cell is active so we don't steal the window selection from another cell + // since this function is called whenever any cell in the Notebook changes, not just ourself + if (this.isActive() && !this.markdownMode && this.cellModel.richTextCursorPosition) { let selection = window.getSelection(); let htmlNodes = this.cellModel.richTextCursorPosition.startElementNodes; let depthToNode = htmlNodes.length;