MCPcopy Create free account
hub / github.com/SplootCode/splootcode / onEditorFocus

Method onEditorFocus

packages/editor/src/context/selection.ts:574–597  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

572
573 @action
574 onEditorFocus() {
575 // Show the selection again.
576 if (this.isHidden) {
577 this.isHidden = false
578 switch (this.state) {
579 case SelectionState.SingleNode:
580 const nodeCursor = this.cursorMap.getSingleNodeForCursorPosition(this.cursor)
581 nodeCursor.listBlock.selectedIndexStart = nodeCursor.index
582 nodeCursor.listBlock.selectedIndexEnd = nodeCursor.index + 1
583 nodeCursor.listBlock.selectionState = SelectionState.SingleNode
584 return
585 case SelectionState.Editing:
586 const editingCursor = this.cursorMap.getSingleNodeForCursorPosition(this.cursor)
587 editingCursor.listBlock.selectedIndexStart = editingCursor.index
588 editingCursor.listBlock.selectedIndexEnd = editingCursor.index + 1
589 editingCursor.listBlock.selectionState = SelectionState.Editing
590 return
591 case SelectionState.MultiNode:
592 const treeWalker = new MultiselectTreeWalker(this.selectionStart, this.selectionEnd)
593 treeWalker.walkToEnd()
594 return
595 }
596 }
597 }
598
599 @action
600 clearSelection() {

Callers 1

EditorClass · 0.80

Calls 2

walkToEndMethod · 0.80

Tested by

no test coverage detected