I am setting up tinyMCE in Moodle (e-learning). I added a toolbar button that focuses on the text area and adds two dollar signs to it. I need to position the cursor between these characters so that the user can start typing between them. Probably the best approach is to just press the soft left arrow programmatically, right? But I canβt figure out how to do this. Here is the code:
tinyMCE.init({ mode : "textareas", theme : "advanced", theme_advanced_buttons1 : "mybutton,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", plugins : 'inlinepopups', setup : function(ed) { // Add a custom button ed.addButton('mybutton', { title : 'My button', image : 'img/example.gif', onclick : function() { ed.focus(); ed.selection.setContent('$$'); } }); }
}); Thanks
source share