Skip to content

Commit

Permalink
Fix not being able to type in code cell after switching from text (#1…
Browse files Browse the repository at this point in the history
…7590) (#17592)

* Fix not being able to type in code cell after switching from text

* comment

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
  • Loading branch information
chlafreniere and Charles-Gagnon committed Nov 4, 2021
1 parent 36684b8 commit 0b9ef71
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0b9ef71

Please sign in to comment.