Skip to content

getDocumentPosition

getDocumentPosition(editor): [number, number, number]

Defined in: utils/index.ts:237

Gets the position of the cursor in the document. It returns a tuple with three numbers:

  1. The line number of the cursor
  2. The 1-based column of the cursor
  3. Number of characters selected

PrismEditor

[number, number, number]

const [line, col, selected] = getDocumentPosition(editor)