I am using simplemde-markdown-editor library and I want to be able to insert text programmatically at the cursor position.
var simplemde = new SimpleMDE();
After Create instance of simpleMDE
you can do this:
var pos = simplemde.codemirror.getCursor();
simplemde.codemirror.setSelection(pos, pos);
simplemde.codemirror.replaceSelection("YOUR_TEXT");