sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

Feature request: set the cursor position on selecting a file

Open danilowoz opened this issue 3 years ago • 2 comments

Propose API:

setActiveFile(path, line?, column?)

or

setActiveFile(path, { line, column }?)

danilowoz avatar Aug 24 '22 08:08 danilowoz

Hi @danilowoz

I want this feature. Now, I'm struggling to set the cursor position.

Until this feature is released, I would like to know if there is a way to set the cursor.

hand-dot avatar Aug 24 '22 16:08 hand-dot

Hey @hand-dot! You can set a new cursor position programmatically using the CodeMirror instance, here's an example: https://sandpack.codesandbox.io/docs/advanced-usage/components#advanced-usage

Hope it helps

danilowoz avatar Aug 24 '22 21:08 danilowoz