I’m currently using TinyMCE and would like to add a custom button that works as follows:
- User highlights text in the text-editior
- User clicks the custom button X
- The text (dog walking) is wrapped with a tag (dog walking)
Any ideas on if this can be done? I’ve figured out how to make a custom button inject text, but not wrap text… Here is the current code:
// Add a custom button
ed.addButton('mybutton', {
title : 'My button',
'class' : 'MyCoolBtn',
image : 'MyCoolBtn.png',
onclick : function() {
// Add you own code to execute something on click
ed.focus();
ed.selection.setContent('<strong>Hello world!</strong>');
}
});
thanks!
1 Answer