Re: Source Code: Setting the Font Size List

  •  08-03-2004, 4:46 PM

    Re: Source Code: Setting the Font Size List

    For anyone thats interested, I've come across a code snippet (found online) that I have modified that seems to work better than the function that Adam offered.

     
    In the _Format function in WinIE.js, add the following case statement...
     
    case "FontStyleSize":
       checkRange(editing.EditorID); // get the focus and text range
       editor.document.execCommand('RemoveFormat');
       editor.document.execCommand('FontName',0,'RandomGarbageToCheckAgainst');
       var fontArray = editor.all.tags("FONT");
       for (i = 0; i < fontArray.length; i++)
       {
        if (fontArray[i].face == 'RandomGarbageToCheckAgainst')
        {
         fontArray[i].face = "";
         fontArray[i].style.fontSize = szValue;
         fontArray[i].outerHTML = fontArray[i].outerHTML.replace(/face=['"]+/, "");
        }
       }
       break;
     
    And when creating the custom dropdownlist....
     
    temp.Attributes.Add("OnChange", "_Format('body','FontStyleSize',this.options[this.selectedIndex].value);this.selectedIndex=0;");
     
    Where 'temp' is the custom dropdownlist and 'body' is the id of the CuteEditor
     
    Hopefully this will be helpful for others.
View Complete Thread