How to de-select text after setSelectedText action?

After I use this

editor.setSelectedText(modifiedParagraph);

The text remains highlighted. How do I deselect and move the cursor to the end of the line?

Use editor.setSelectedRange (docs) to update the cursor position/selection.

There are many examples in the default action set, look at some of the Markdown bold/emphasis actions for examples.

1 Like