<strong>Initial value</strong>
viewtopic.php?p=31688#p31688
function getSelectionHTML(selection)
{
var range = (document.all ? selection.createRange() : selection.getRangeAt(selection.rangeCount - 1).cloneRange());
if (document.all)
{
return range.htmlText;
}
else
{
var clonedSelection = range.cloneContents();
var div = document.createElement('div');
div.appendChild(clonedSelection);
return div.innerHTML;
}
}
var mySelection = editor.getSelection();
var selectedText = getSelectionHTML(mySelection.getNative());
editor.insertHtml('<span style="color:red;">'+selectedText+'</span>');<strong>Initial </strong><span style="color:red;">value</span><strong>.</strong>
