I tried writing the code in site/plugins/system/yvbbcode/default.js - but nothing happens so I guess it doesn't work with joomla 1.5. - but thanks anywayrisp wrote:
I think this code does what you want. It works for Joomla 1.6. Not sure for Joomla 1.5 as I only tested on Mootool 1.3
Code: Select all
function yvBBCodeReplaceText(ControlID, tag) { sel = ControlID.getSelectedText(); pos = ControlID.getSelectionEnd(); ControlID.insertAroundCursor({before: '['+tag+']', after: '[/'+tag+']'}); if(sel != '') { ControlID.setCaretPosition(pos + tag.length*2+5); } }
J.