replace this function on fck_actions.js
function doStyle(command)
{
var oSelection = objContent.DOM.selection ;
var oTextRange = oSelection.createRange() ;
if (oSelection.type == "Text")
{
decCommand(DECMD_REMOVEFORMAT);
// crey
//doFormatBlock('Normal');
// var oFont = document.createElement("FONT") ;
var oFont = document.createElement("SPAN") ;
oFont.innerHTML = oTextRange.htmlText ;
var oParent = oTextRange.parentElement() ;
var oFirstChild = oFont.firstChild ;
if (oFirstChild.nodeType == 1 && oFirstChild.outerHTML == oFont.innerHTML &&
(oFirstChild.tagName == "SPAN"
|| oFirstChild.tagName == "FONT"
|| oFirstChild.tagName == "P"
|| oFirstChild.tagName == "DIV"))
{
oParent.className = command.value ;
}
else
{
oFont.className = command.value ;
oTextRange.pasteHTML( oFont.outerHTML ) ;
}
}
else if (oSelection.type == "Control" && oTextRange.length == 1)
{
var oControl = oTextRange.item(0) ;
oControl.className = command.value ;
}
else
{
alert ();
decCommand(DECMD_REMOVEFORMAT);
var oFont = document.createElement("SPAN") ;
oFont.innerHTML = oTextRange.htmlText ;
var oParent = oTextRange.parentElement() ;
if ((oParent.tagName == "TD" || oParent.tagName == "SPAN" || oParent.tagName == "FONT" || oParent.tagName == "P" || oParent.tagName == "DIV"))
{
oParent.className = command.value ;
}
}
command.selectedIndex = 0 ;
objContent.focus();
}
function doStyle(command)
{
var oSelection = objContent.DOM.selection ;
var oTextRange = oSelection.createRange() ;
if (oSelection.type == "Text")
{
decCommand(DECMD_REMOVEFORMAT);
// crey
//doFormatBlock('Normal');
// var oFont = document.createElement("FONT") ;
var oFont = document.createElement("SPAN") ;
oFont.innerHTML = oTextRange.htmlText ;
var oParent = oTextRange.parentElement() ;
var oFirstChild = oFont.firstChild ;
if (oFirstChild.nodeType == 1 && oFirstChild.outerHTML == oFont.innerHTML &&
(oFirstChild.tagName == "SPAN"
|| oFirstChild.tagName == "FONT"
|| oFirstChild.tagName == "P"
|| oFirstChild.tagName == "DIV"))
{
oParent.className = command.value ;
}
else
{
oFont.className = command.value ;
oTextRange.pasteHTML( oFont.outerHTML ) ;
}
}
else if (oSelection.type == "Control" && oTextRange.length == 1)
{
var oControl = oTextRange.item(0) ;
oControl.className = command.value ;
}
else
{
alert ();
decCommand(DECMD_REMOVEFORMAT);
var oFont = document.createElement("SPAN") ;
oFont.innerHTML = oTextRange.htmlText ;
var oParent = oTextRange.parentElement() ;
if ((oParent.tagName == "TD" || oParent.tagName == "SPAN" || oParent.tagName == "FONT" || oParent.tagName == "P" || oParent.tagName == "DIV"))
{
oParent.className = command.value ;
}
}
command.selectedIndex = 0 ;
objContent.focus();
}
RE: !!! sory alert() :) remove !!!
function doStyle(command)
{
var oSelection = objContent.DOM.selection ;
var oTextRange = oSelection.createRange() ;
if (oSelection.type == "Text")
{
decCommand(DECMD_REMOVEFORMAT);
// crey
//doFormatBlock('Normal');
// var oFont = document.createElement("FONT") ;
var oFont = document.createElement("SPAN") ;
oFont.innerHTML = oTextRange.htmlText ;
var oParent = oTextRange.parentElement() ;
var oFirstChild = oFont.firstChild ;
if (oFirstChild.nodeType == 1 && oFirstChild.outerHTML == oFont.innerHTML &&
(oFirstChild.tagName == "SPAN"
|| oFirstChild.tagName == "FONT"
|| oFirstChild.tagName == "P"
|| oFirstChild.tagName == "DIV"))
{
oParent.className = command.value ;
}
else
{
oFont.className = command.value ;
oTextRange.pasteHTML( oFont.outerHTML ) ;
}
}
else if (oSelection.type == "Control" && oTextRange.length == 1)
{
var oControl = oTextRange.item(0) ;
oControl.className = command.value ;
}
else
{
decCommand(DECMD_REMOVEFORMAT);
var oFont = document.createElement("SPAN") ;
oFont.innerHTML = oTextRange.htmlText ;
var oParent = oTextRange.parentElement() ;
if ((oParent.tagName == "TD" || oParent.tagName == "SPAN" || oParent.tagName == "FONT" || oParent.tagName == "P" || oParent.tagName == "DIV"))
{
oParent.className = command.value ;
}
}
command.selectedIndex = 0 ;
objContent.focus();
}
RE: !!! corect style !!!
Is there any reason to use SPAN instead of FONT?
Thanks,
FredCK
Frederico Knabben
CKEditor Project Lead and CKSource Owner
--
Follow us on: Twitter | Facebook | Google+ | LinkedIn
RE: !!! corect style !!!