Skip to main content
deleted 19 characters in body; edited title
Source Link
yivi
  • 48.2k
  • 18
  • 133
  • 157

Whether there Why is there no way to get the cursor position in monaco-editor?

thanks your time: II read the API document

I want to get the cursor position (row, column), such as : image

butBut seems there is no API for this function, is there any way to implement it?


the demo code here


before ask question I have searched this one QA: Get absolute (index) position of cursor in Monaco Editor

but when I execute:

console.log(monacoRef.current.editor.getPosition()) 

thereI get the error:

Property 'getPosition' does not exist on type 'typeof editor'. ts(2339) 

Whether there is no way to get the cursor position in monaco-editor?

thanks your time: I read the API document

I want to get the cursor position (row, column), such as : image

but seems there is no API for this function, is there any way to implement it?


the demo code here


before ask question I have searched this one QA: Get absolute (index) position of cursor in Monaco Editor

but when I execute:

console.log(monacoRef.current.editor.getPosition()) 

there get error:

Property 'getPosition' does not exist on type 'typeof editor'. ts(2339) 

Why is there no way to get the cursor position in monaco-editor?

I read the API document

I want to get the cursor position (row, column), such as : image

But seems there is no API for this function, is there any way to implement it?


the demo code here


before ask question I have searched this one QA: Get absolute (index) position of cursor in Monaco Editor

but when I execute:

console.log(monacoRef.current.editor.getPosition()) 

I get the error:

Property 'getPosition' does not exist on type 'typeof editor'. ts(2339) 
Source Link
qg_java_17137
  • 3.6k
  • 16
  • 46
  • 93

Whether there is no way to get the cursor position in monaco-editor?

thanks your time: I read the API document

I want to get the cursor position (row, column), such as : image

but seems there is no API for this function, is there any way to implement it?


the demo code here


before ask question I have searched this one QA: Get absolute (index) position of cursor in Monaco Editor

but when I execute:

console.log(monacoRef.current.editor.getPosition()) 

there get error:

Property 'getPosition' does not exist on type 'typeof editor'. ts(2339)