MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / enterInsertMode

Method enterInsertMode

packages/app-core/src/lib/cm-table.ts:987–1001  ·  view source on GitHub ↗

Switch the focused cell into INSERT mode at a source offset: editable, * native caret, block cursor removed. Don't re-focus — that re-fires the * focus handler, snapping back to NORMAL.

(cell: HTMLElement, caretOffset: number)

Source from the content-addressed store, hash-verified

985 * native caret, block cursor removed. Don't re-focus — that re-fires the
986 * focus handler, snapping back to NORMAL. */
987 private enterInsertMode(cell: HTMLElement, caretOffset: number): void {
988 this.cellMode = 'insert'
989 this.pendingOp = null
990 this.pendingScope = null
991 this.visualMode = false
992 this.visualScope = null
993 this.clearCellCursor(cell)
994 cell.classList.remove('is-vim-normal')
995 cell.setAttribute('contenteditable', 'true')
996 if (cell.dataset.rendered !== 'false') {
997 cell.textContent = cell.dataset.raw ?? ''
998 cell.dataset.rendered = 'false'
999 }
1000 placeCaretAt(cell, caretOffset)
1001 }
1002
1003 /** Delete `[from, to)` from the focused cell's source in place (no dispatch —
1004 * committed on blur, like typing). Re-renders the NORMAL block cursor. */

Callers 3

onCellKeydownMethod · 0.95
applyOperatorMethod · 0.95
handleVisualKeyMethod · 0.95

Calls 2

clearCellCursorMethod · 0.95
placeCaretAtFunction · 0.85

Tested by

no test coverage detected