I am using CodeMirror (see here β) codemirror . In particular, I am using the HTML Preview Editor module.
I tested it in the fiddle: -------> http://jsfiddle.net/Vu33n/6/
I got an editor to work, but I'm trying to make the user select an HTML tag from the drop-down menu - this code will be inserted into the editor, where the CURSOR POSITION is.
I can get the code to paste into the editor, but it erases everything in the editor before pasting it. I cannot get him to paste the code where the cursor is and leave everything else alone.
The syntax of CodeMirror that I use is:
editor.setValue($(this).val());
If you're interested, the CodeMirror user guide is here . This is where I found 'setValue'
Sanya source share