Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2007-06-22 20:59:58

furrukh
New member
Registered: 2007-06-22
Posts: 2

Xinha Stripping CSS

Hi,

I have the following CSS Code (see third code pasted below) and the Xinha Editor seems to be stripping it in I.E. 6.0 and F.F. 1.5. Can anyone shed some light into it as to why it is doing it and how I can stop it from stripping my CSS?

Also can also anyone assist me in as to how I can set up my image folder path and web path for media uploading? (i.e. System Path: /var/www/localhost/mysite/images/, Web Path: http://www.mysite.com/images/)

Much Obliged


index.html Code

<script type="text/javascript">
_editor_url  = "/xinha/";
_editor_lang = "en";
_editor_skin = "xp-blue"; 
xinha_editors = ["html_content"];
xinha_init    = null;
xinha_config  = null;
xinha_plugins = null;
</script>
<script type="text/javascript" src="/xinha/XinhaCore.js"></script>
<script type="text/javascript" src="/xinha/editor_config.js"></script>

<textarea id="html_content" name="html_content" rows="50" cols="50" style="width: 100%"></textarea>

editor_config.js Code

xinha_init = xinha_init ? xinha_init : function()
{
    xinha_editors = xinha_editors ? xinha_editors:["myTextArea1","myTextArea2"];
    
    xinha_plugins = xinha_plugins ? xinha_plugins:["CharCounter","CharacterMap","ContextMenu","ExtendedFileManager","Forms","HorizontalRule","ImageManager","InsertAnchor","ListType","SuperClean","TableOperations"];
    
    // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :)
    if (!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
    
    // Create a default configuration to be used by all the editors.
    xinha_config = new Xinha.Config();
    xinha_config.width = "100%";
    xinha_config.height = "auto";
    xinha_config.sizeIncludesBars = true;
    xinha_config.statusBar = true;
    xinha_config.mozParaHandler = "best";
    xinha_config.undoSteps = 25;
    xinha_config.baseHref = null;
    xinha_config.stripBaseHref = false;
    xinha_config.stripSelfNamedAnchors = false;
    xinha_config.only7BitPrintablesInURLs = true;
    xinha_config.sevenBitClean = false;
    xinha_config.killWordOnPaste = true;
    xinha_config.flowToolbars = true;
    xinha_config.showLoading = true;
    
    if (typeof CharCounter != 'undefined')
    {
        xinha_config.CharCounter.showChar = true;
        xinha_config.CharCounter.showWord = true;
        xinha_config.CharCounter.showHtml = true;
    }
    
    if (typeof CharacterMap != 'undefined') xinha_config.CharacterMap.mode = "panel";
    if (typeof ListType != 'undefined') xinha_config.ListType.mode = "panel";
    
    if (typeof CSS != 'undefined')
    {
        xinha_config.pageStyle = "@import url(editor_custom.css);";
    }
    
    if (typeof Stylist != 'undefined')
    {
        // We can load an external stylesheet like this - NOTE : YOU MUST GIVE AN ABSOLUTE URL
        //  otherwise it won't work!
        xinha_config.stylistLoadStylesheet(document.location.href.replace(/[^\/]*\.html/, 'editor_stylist.css'));
        
        // Or we can load styles directly
        xinha_config.stylistLoadStyles('p.red_text { color:red }');
        
        // If you want to provide "friendly" names you can do so like
        // (you can do this for stylistLoadStylesheet as well)
        xinha_config.stylistLoadStyles('p.pink_text { color:pink }', {'p.pink_text' : 'Pretty Pink'});
    }
    
    if (typeof DynamicCSS != 'undefined')
    {
        xinha_config.pageStyle = "@import url(editor_dynamic.css);";
    }
    
    if (typeof InsertWords != 'undefined')
    {
        // Register the keyword/replacement list
        var keywrds1 = new Object();
        var keywrds2 = new Object();
        
        keywrds1['-- Dropdown Label --'] = '';
        keywrds1['onekey'] = 'onevalue';
        keywrds1['twokey'] = 'twovalue';
        keywrds1['threekey'] = 'threevalue';
        
        keywrds2['-- Insert Keyword --'] = '';
        keywrds2['Username'] = '%user%';
        keywrds2['Last login date'] = '%last_login%';
        xinha_config.InsertWords = {
            combos : [ { options: keywrds1, context: "body" },
            { options: keywrds2, context: "li" } ]
        }
    }
    
    if (typeof Filter != 'undefined')
    {
        xinha_config.Filters = ["Word", "Paragraph"];
    }
    
    // First create editors for the textareas.
    // You can do this in two ways, either
    //   xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
    // if you want all the editor objects to use the same set of plugins, OR;
    //   xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config);
    //   xinha_editors['myTextarea0'].registerPlugins(['Stylist','FullScreen']);
    //   xinha_editors['myTextarea1'].registerPlugins(['CSS','SuperClean']);
    // if you want to use a different set of plugins for one or more of the editors.
    xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);

    // If you want to change the configuration variables of any of the editors,
    // this is the place to do that, for example you might want to
    // change the width and height of one of the editors, like this...
    //   xinha_editors['myTextarea0'].config.width  = '640px';
    //   xinha_editors['myTextarea0'].config.height = '480px';
    
    // Finally we "start" the editors, this turns the textareas into Xinha editors.
    Xinha.startEditors(xinha_editors);
}

Xinha._addEvent(window,"load",xinha_init);

HTML Code that's CSS is being Stripped/Removed by Xinha

<style type="text/css"> 
    td { background-color: green; }
</style>

<form name="form">
<div>DAVE</div>
<table border="0" cellpadding="3" cellspacing="0">
  <tbody>
    <tr>
      <td>First Name</td>
      <td><input class="inputbox" id="oform[de0d6923a19344c7b30e416bc1e139e5]" name="oform[de0d6923a19344c7b30e416bc1e139e5]" type="text" /></td>
    </tr>
    <tr>
      <td>Last Name</td>
      <td><input class="inputbox" id="oform[f1874211cbd79ba49df3f7449f962232]" name="oform[f1874211cbd79ba49df3f7449f962232]" type="text" /></td>
    </tr>
    <tr>
      <td>E-mail</td>
      <td><input class="inputbox" id="oform[c75edd3fa0b226fadb8ac659a3650d96]" name="oform[c75edd3fa0b226fadb8ac659a3650d96]" type="text" /></td>
    </tr>
    <tr>
      <td>Choose the colours you like?</td>
      <td><input name="oform[356f03b1b7d68ccfba9f54e84e5e3218]" type="radio" value="ec6b19c4b6c91279fbf2890b3e38510e" />
        Red<br />
        <input name="oform[356f03b1b7d68ccfba9f54e84e5e3218]" type="radio" value="81e12344f9fcc942ddeaa9f94e499ea9" />
        Green<br />
        <input name="oform[356f03b1b7d68ccfba9f54e84e5e3218]" type="radio" value="7f21305579d9d58db190f1bba9184601" />
        Blue</td>
    </tr>
    <tr>
      <td>Check your favourite comedian(s)?</td>
      <td><input name="oform[f212556147af563f0f97c5b420a095d9][]" type="checkbox" value="3b3c4a7561b34163644704c5bc74391f" />
        Russell Peters<br />
        <input name="oform[f212556147af563f0f97c5b420a095d9][]" type="checkbox" value="c5b2a1fa26c8b340d8881827ed65d2b4" />
        Mike Myers<br />
        <input name="oform[f212556147af563f0f97c5b420a095d9][]" type="checkbox" value="2652335e3bca114fd47f30222b35f029" />
        Jim Carrey</td>
    </tr>
    <tr>
      <td>Father</td>
      <td><textarea class="inputbox" cols="20" id="oform[6f53ecc729599e198b736c2e01a3a769]" name="oform[6f53ecc729599e198b736c2e01a3a769]" rows="3"></textarea></td>
    </tr>
    <tr>
      <td>Car?</td>
      <td><select id="oform[20f44ec3654cca570c54ab82dc1e3f1c]" name="oform[20f44ec3654cca570c54ab82dc1e3f1c]">
          <option value="764dc0686d995a695476427daa998b35">[Select A Car]</option>
          <option value="3da53bacd6c64265e1b34d79d380134f">Toyota</option>
          <option value="8f5774723962c7a2b15b2be945901399">Honda</option>
          <option value="dc72e99f47b78685c39c303344577704">BMW</option>
          <option value="e320071c5072a8e4622bcb4b94d1f97b">Ford</option>
        </select>
      </td>
    </tr>
    <tr>
      <td>Kaam</td>
      <td><textarea class="inputbox" cols="20" id="oform[a28e621ffe3e35b26776c229737aa3e9]" name="oform[a28e621ffe3e35b26776c229737aa3e9]" rows="3"></textarea></td>
    </tr>
    <tr>
      <td> </td>
      <td><input class="button" name="btn_finish" onClick="page_next();" type="button" value="Finish" /></td>
    </tr>
  </tbody>
</table>
<form>

Offline

#2 2007-06-25 17:48:58

furrukh
New member
Registered: 2007-06-22
Posts: 2

Re: Xinha Stripping CSS

Any ideas guys???

Offline

#3 2007-06-26 12:00:31

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: Xinha Stripping CSS

Style elements are only allowed in the head section (rules of HTML)

Offline

Board footer

Powered by FluxBB