Changeset 649


Ignore:
Timestamp:
01/12/07 12:58:32 (11 years ago)
Author:
ray
Message:

Ticket #11 Change HTMLArea objects/namespace to Xinha

Location:
trunk
Files:
2 added
4 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/dialog.js

    r594 r649  
    2626        try { 
    2727                if (Dialog._modal && !Dialog._modal.closed) { 
    28                         HTMLArea._stopEvent(ev); 
     28                        Xinha._stopEvent(ev); 
    2929                }  
    3030        } catch (e) { 
     
    5252        // capture some window's events 
    5353        function capwin(w) { 
    54                 HTMLArea._addEvent(w, "click", Dialog._parentEvent); 
    55                 HTMLArea._addEvent(w, "mousedown", Dialog._parentEvent); 
    56                 HTMLArea._addEvent(w, "focus", Dialog._parentEvent); 
     54                Xinha._addEvent(w, "click", Dialog._parentEvent); 
     55                Xinha._addEvent(w, "mousedown", Dialog._parentEvent); 
     56                Xinha._addEvent(w, "focus", Dialog._parentEvent); 
    5757        } 
    5858        // release the captured events 
    5959        function relwin(w) { 
    60                 HTMLArea._removeEvent(w, "click", Dialog._parentEvent); 
    61                 HTMLArea._removeEvent(w, "mousedown", Dialog._parentEvent); 
    62                 HTMLArea._removeEvent(w, "focus", Dialog._parentEvent); 
     60                Xinha._removeEvent(w, "click", Dialog._parentEvent); 
     61                Xinha._removeEvent(w, "mousedown", Dialog._parentEvent); 
     62                Xinha._removeEvent(w, "focus", Dialog._parentEvent); 
    6363        } 
    6464        capwin(window); 
  • trunk/examples/ext_example-body.html

    r612 r649  
    3232 
    3333  <!-- Load up the actual editor core --> 
    34   <script type="text/javascript" src="../htmlarea.js"></script> 
     34  <script type="text/javascript" src="../XinhaCore.js"></script> 
    3535 
    3636  <script type="text/javascript"> 
     
    5555 
    5656      // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :) 
    57       if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return; 
     57      if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return; 
    5858 
    5959// What are the names of the textareas you will be turning into editors? 
     
    8888// Create a default configuration to be used by all the editors. 
    8989      settings = top.frames["menu"].settings; 
    90       xinha_config = new HTMLArea.Config(); 
     90      xinha_config = new Xinha.Config(); 
    9191      xinha_config.width = settings.width; 
    9292      xinha_config.height = settings.height; 
     
    164164// First create editors for the textareas. 
    165165// You can do this in two ways, either 
    166 //   xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
     166//   xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
    167167// if you want all the editor objects to use the same set of plugins, OR; 
    168 //   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config); 
     168//   xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config); 
    169169//   xinha_editors['myTextarea0'].registerPlugins(['Stylist','FullScreen']); 
    170170//   xinha_editors['myTextarea1'].registerPlugins(['CSS','SuperClean']); 
    171171// if you want to use a different set of plugins for one or more of the editors. 
    172       xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
     172      xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
    173173 
    174174// If you want to change the configuration variables of any of the editors, 
     
    179179 
    180180// Finally we "start" the editors, this turns the textareas into Xinha editors. 
    181       HTMLArea.startEditors(xinha_editors); 
     181      Xinha.startEditors(xinha_editors); 
    182182    } 
    183183 
     
    194194 
    195195    window.onload = xinha_init; 
    196 //    window.onunload = HTMLArea.collectGarbageForIE; 
     196//    window.onunload = Xinha.collectGarbageForIE; 
    197197  </script> 
    198198</head> 
  • trunk/examples/ext_example-menu.php

    r560 r649  
    141141        // capture some window's events 
    142142        function capwin(w) { 
    143 //              HTMLArea._addEvent(w, "click", Dialog._parentEvent); 
    144 //              HTMLArea._addEvent(w, "mousedown", Dialog._parentEvent); 
    145 //              HTMLArea._addEvent(w, "focus", Dialog._parentEvent); 
     143//              Xinha._addEvent(w, "click", Dialog._parentEvent); 
     144//              Xinha._addEvent(w, "mousedown", Dialog._parentEvent); 
     145//              Xinha._addEvent(w, "focus", Dialog._parentEvent); 
    146146        }; 
    147147        // release the captured events 
    148148        function relwin(w) { 
    149 //              HTMLArea._removeEvent(w, "click", Dialog._parentEvent); 
    150 //              HTMLArea._removeEvent(w, "mousedown", Dialog._parentEvent); 
    151 //              HTMLArea._removeEvent(w, "focus", Dialog._parentEvent); 
     149//              Xinha._removeEvent(w, "click", Dialog._parentEvent); 
     150//              Xinha._removeEvent(w, "mousedown", Dialog._parentEvent); 
     151//              Xinha._removeEvent(w, "focus", Dialog._parentEvent); 
    152152        }; 
    153153        capwin(window); 
  • trunk/examples/simple_example.html

    r534 r649  
    1212 *  eg: _editor_url = "/path/to/xinha/"; 
    1313 * You may try a relative URL if you wish] 
    14  *  eg: _editor_url = "../"; 
     14 *  eg: _editor_url = "../";   
    1515 * in this example we do a little regular expression to find the absolute path. 
    1616 ************************************************************************/ 
     
    2020</script> 
    2121<!-- Load up the actual editor core --> 
    22 <script type="text/javascript" src="../htmlarea.js"></script> 
     22<script type="text/javascript" src="../XinhaCore.js"></script> 
    2323<script type="text/javascript"> 
    2424/************************************************************************ 
     
    5555{ 
    5656  // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :) 
    57   if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return; 
     57  if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return; 
    5858  /************************************************************************* 
    5959   * We create a default configuration to be used by all the editors. 
     
    6464   * for the configuration parameters 
    6565   ************************************************************************/ 
    66   var xinha_config = new HTMLArea.Config(); 
     66  var xinha_config = new Xinha.Config(); 
    6767  /************************************************************************ 
    6868   * We first create editors for the textareas. 
    6969   * You can do this in two ways, either 
    7070   * 
    71    *   xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
     71   *   xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
    7272   * 
    7373   * if you want all the editor objects to use the same set of plugins, OR; 
    7474   * 
    75    *   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config); 
     75   *   xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config); 
    7676   *   xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']); 
    7777   *   xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']); 
     
    8080   * editors. 
    8181   ************************************************************************/ 
    82   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
     82  xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
    8383  /************************************************************************ 
    8484   * If you want to change the configuration variables of any of the 
     
    9898   * Xinha editors. 
    9999   ************************************************************************/ 
    100   HTMLArea.startEditors(xinha_editors); 
     100  Xinha.startEditors(xinha_editors); 
    101101} 
    102102window.onload = xinha_init; 
  • trunk/examples/testbed.html

    r277 r649  
    3636 
    3737  <!-- Load up the actual editor core --> 
    38   <script type="text/javascript" src="../htmlarea.js"></script> 
     38  <script type="text/javascript" src="../XinhaCore.js"></script> 
    3939 
    4040  <script type="text/javascript"> 
     
    5858      ]; 
    5959             // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :) 
    60              if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return; 
     60             if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return; 
    6161 
    6262      /** STEP 2 *************************************************************** 
     
    7777       * If you want to modify the default config you might do something like this. 
    7878       * 
    79        *   xinha_config = new HTMLArea.Config(); 
     79       *   xinha_config = new Xinha.Config(); 
    8080       *   xinha_config.width  = 640; 
    8181       *   xinha_config.height = 420; 
     
    8383       *************************************************************************/ 
    8484 
    85        xinha_config = xinha_config ? xinha_config : new HTMLArea.Config(); 
     85       xinha_config = xinha_config ? xinha_config : new Xinha.Config(); 
    8686/* 
    8787       // We can load an external stylesheet like this - NOTE : YOU MUST GIVE AN ABSOLUTE URL 
     
    101101       * You can do this in two ways, either 
    102102       * 
    103        *   xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
     103       *   xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
    104104       * 
    105105       * if you want all the editor objects to use the same set of plugins, OR; 
    106106       * 
    107        *   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config); 
     107       *   xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config); 
    108108       *   xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']); 
    109109       *   xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']); 
     
    113113       ************************************************************************/ 
    114114 
    115       xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
     115      xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins); 
    116116 
    117117      /** STEP 4 *************************************************************** 
     
    131131       ************************************************************************/ 
    132132 
    133       HTMLArea.startEditors(xinha_editors); 
     133      Xinha.startEditors(xinha_editors); 
    134134      window.onload = null; 
    135135    } 
    136136 
    137137    window.onload   = xinha_init; 
    138     // window.onunload = HTMLArea.collectGarbageForIE; 
     138    // window.onunload = Xinha.collectGarbageForIE; 
    139139  </script> 
    140140</head> 
  • trunk/functionsIE.js

    r635 r649  
    22 * selection.  The selection is removed.  It splits a text node, if needed. 
    33 */ 
    4 HTMLArea.prototype.insertNodeAtSelection = function(toBeInserted) 
     4Xinha.prototype.insertNodeAtSelection = function(toBeInserted) 
    55{ 
    66  return null;  // this function not yet used for IE <FIXME> 
     
    88 
    99// Returns the deepest node that contains both endpoints of the selection. 
    10 HTMLArea.prototype.getParentElement = function(sel) 
     10Xinha.prototype.getParentElement = function(sel) 
    1111{ 
    1212  if ( typeof sel == 'undefined' ) 
     
    5757 * @returns null | element 
    5858 */ 
    59 HTMLArea.prototype._activeElement = function(sel) 
     59Xinha.prototype._activeElement = function(sel) 
    6060{ 
    6161  if ( ( sel === null ) || this._selectionEmpty(sel) ) 
     
    104104}; 
    105105 
    106   HTMLArea.prototype._selectionEmpty = function(sel) 
     106  Xinha.prototype._selectionEmpty = function(sel) 
    107107{ 
    108108  if ( !sel ) 
     
    115115 
    116116// Selects the contents inside the given node 
    117 HTMLArea.prototype.selectNodeContents = function(node, pos) 
     117Xinha.prototype.selectNodeContents = function(node, pos) 
    118118{ 
    119119  this.focusEditor(); 
     
    139139 * the selection, if any. 
    140140 */ 
    141 HTMLArea.prototype.insertHTML = function(html) 
     141Xinha.prototype.insertHTML = function(html) 
    142142{ 
    143143  var sel = this._getSelection(); 
     
    149149 
    150150// Retrieve the selected block 
    151 HTMLArea.prototype.getSelectedHTML = function() 
     151Xinha.prototype.getSelectedHTML = function() 
    152152{ 
    153153  var sel = this._getSelection(); 
     
    167167}; 
    168168 
    169 HTMLArea.prototype.checkBackspace = function() 
     169Xinha.prototype.checkBackspace = function() 
    170170{ 
    171171  var sel = this._getSelection(); 
     
    173173  { 
    174174    var elm = this._activeElement(sel); 
    175     HTMLArea.removeFromParent(elm); 
     175    Xinha.removeFromParent(elm); 
    176176    return true; 
    177177  } 
     
    198198   
    199199// returns the current selection object 
    200 HTMLArea.prototype._getSelection = function() 
     200Xinha.prototype._getSelection = function() 
    201201{ 
    202202  return this._doc.selection; 
     
    204204 
    205205// returns a range for the current selection 
    206 HTMLArea.prototype._createRange = function(sel) 
     206Xinha.prototype._createRange = function(sel) 
    207207{ 
    208208  return sel.createRange(); 
    209209}; 
    210210 
    211 HTMLArea.getOuterHTML = function(element) 
     211Xinha.getOuterHTML = function(element) 
    212212{ 
    213213  return element.outerHTML; 
     
    215215   
    216216//What is this supposed to do??? it's never used  
    217 HTMLArea.prototype._formatBlock = function(block_format) 
    218 { 
    219  
    220 }; 
    221  
    222 HTMLArea._browserSpecificFunctionsLoaded = true; 
     217Xinha.prototype._formatBlock = function(block_format) 
     218{ 
     219 
     220}; 
     221 
     222Xinha._browserSpecificFunctionsLoaded = true; 
  • trunk/functionsMozilla.js

    r635 r649  
    22 * selection.  The selection is removed.  It splits a text node, if needed. 
    33 */ 
    4 HTMLArea.prototype.insertNodeAtSelection = function(toBeInserted) 
     4Xinha.prototype.insertNodeAtSelection = function(toBeInserted) 
    55{ 
    66  var sel = this._getSelection(); 
     
    5050   
    5151// Returns the deepest node that contains both endpoints of the selection. 
    52 HTMLArea.prototype.getParentElement = function(sel) 
     52Xinha.prototype.getParentElement = function(sel) 
    5353{ 
    5454  if ( typeof sel == 'undefined' ) 
     
    8888 * @returns null | element 
    8989 */ 
    90 HTMLArea.prototype._activeElement = function(sel) 
     90Xinha.prototype._activeElement = function(sel) 
    9191{ 
    9292  if ( ( sel === null ) || this._selectionEmpty(sel) ) 
     
    116116}; 
    117117   
    118 HTMLArea.prototype._selectionEmpty = function(sel) 
     118Xinha.prototype._selectionEmpty = function(sel) 
    119119{ 
    120120  if ( !sel ) 
     
    132132   
    133133// Selects the contents inside the given node 
    134 HTMLArea.prototype.selectNodeContents = function(node, pos) 
     134Xinha.prototype.selectNodeContents = function(node, pos) 
    135135{ 
    136136  this.focusEditor(); 
     
    157157 * the selection, if any. 
    158158 */ 
    159 HTMLArea.prototype.insertHTML = function(html) 
     159Xinha.prototype.insertHTML = function(html) 
    160160{ 
    161161  var sel = this._getSelection(); 
     
    176176 
    177177// Retrieve the selected block 
    178 HTMLArea.prototype.getSelectedHTML = function() 
     178Xinha.prototype.getSelectedHTML = function() 
    179179{ 
    180180  var sel = this._getSelection(); 
    181181  var range = this._createRange(sel); 
    182   return HTMLArea.getHTML(range.cloneContents(), false, this); 
    183 }; 
    184    
    185 HTMLArea.prototype.checkBackspace = function() 
     182  return Xinha.getHTML(range.cloneContents(), false, this); 
     183}; 
     184   
     185Xinha.prototype.checkBackspace = function() 
    186186{ 
    187187  var self = this; 
     
    208208        } 
    209209        SC.parentNode.insertBefore(p, SC); 
    210         HTMLArea.removeFromParent(SC); 
     210        Xinha.removeFromParent(SC); 
    211211        var r = range.cloneRange(); 
    212212        r.setStartBefore(newr); 
     
    221221 
    222222// returns the current selection object 
    223 HTMLArea.prototype._getSelection = function() 
     223Xinha.prototype._getSelection = function() 
    224224{ 
    225225  return this._iframe.contentWindow.getSelection(); 
     
    227227   
    228228// returns a range for the current selection 
    229 HTMLArea.prototype._createRange = function(sel) 
     229Xinha.prototype._createRange = function(sel) 
    230230{ 
    231231  this.activateEditor(); 
     
    247247}; 
    248248 
    249 HTMLArea.getOuterHTML = function(element) 
     249Xinha.getOuterHTML = function(element) 
    250250{ 
    251251  return (new XMLSerializer()).serializeToString(element); 
     
    254254//What is this supposed to do??? it's never used  
    255255//ray 
    256 HTMLArea.prototype._formatBlock = function(block_format) 
     256Xinha.prototype._formatBlock = function(block_format) 
    257257{ 
    258258  var ancestors = this.getAllAncestors(); 
     
    276276  var rng = this._createRange(sel); 
    277277 
    278   if ( HTMLArea.is_gecko ) 
     278  if ( Xinha.is_gecko ) 
    279279  { 
    280280    if ( sel.isCollapsed ) 
     
    357357// which means this fancy stuff is gecko only sorry :-| 
    358358// Die Bill, Die.  (IE supports it somewhat nativly though) 
    359 HTMLArea.prototype.mozKey = function ( ev, keyEvent ) 
     359Xinha.prototype.mozKey = function ( ev, keyEvent ) 
    360360{ 
    361361  var editor = this; 
     
    369369    } 
    370370    var a = textNode.parentNode.insertBefore(tag, rightText); 
    371     HTMLArea.removeFromParent(textNode); 
     371    Xinha.removeFromParent(textNode); 
    372372    a.appendChild(textNode); 
    373373    rightText.data = ' ' + rightText.data; 
    374374 
    375     if ( HTMLArea.is_ie ) 
     375    if ( Xinha.is_ie ) 
    376376    { 
    377377      var r = editor._createRange(s); 
     
    383383      s.collapse(rightText, 1); 
    384384    } 
    385     HTMLArea._stopEvent(ev); 
     385    Xinha._stopEvent(ev); 
    386386 
    387387    editor._unLink = function() 
     
    390390      a.removeChild(t); 
    391391      a.parentNode.insertBefore(t, a); 
    392       HTMLArea.removeFromParent(a); 
     392      Xinha.removeFromParent(a); 
    393393      editor._unLink = null; 
    394394      editor._unlinkOnUndo = false; 
     
    419419        var matchData = s.anchorNode.data.substring(0,s.anchorOffset).replace(/^.*?(\S*)$/, '$1'); 
    420420 
    421         var mEmail = matchData.match(HTMLArea.RE_email); 
     421        var mEmail = matchData.match(Xinha.RE_email); 
    422422        if ( mEmail ) 
    423423        { 
     
    432432        RE_date = /([0-9]+\.)+/; //could be date or ip or something else ... 
    433433        RE_ip = /(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/; 
    434         var mUrl = matchData.match(HTMLArea.RE_url); 
     434        var mUrl = matchData.match(Xinha.RE_url); 
    435435        if ( mUrl ) 
    436436        { 
     
    457457        { 
    458458          this._unLink(); 
    459           HTMLArea._stopEvent(ev); 
     459          Xinha._stopEvent(ev); 
    460460        } 
    461461        break; 
     
    476476          if ( !a._updateAnchTimeout ) 
    477477          { 
    478             if ( s.anchorNode.data.match(HTMLArea.RE_email) && a.href.match('mailto:' + s.anchorNode.data.trim()) ) 
     478            if ( s.anchorNode.data.match(Xinha.RE_email) && a.href.match('mailto:' + s.anchorNode.data.trim()) ) 
    479479            { 
    480480              var textNode = s.anchorNode; 
     
    491491            } 
    492492 
    493             var m = s.anchorNode.data.match(HTMLArea.RE_url); 
     493            var m = s.anchorNode.data.match(Xinha.RE_url); 
    494494            if ( m && a.href.match(s.anchorNode.data.trim()) ) 
    495495            { 
     
    498498              { 
    499499                // @fixme: Alert, sometimes m is undefined becase the url is not an url anymore (was www.url.com and become for example www.url) 
    500                 m = txtNode.data.match(HTMLArea.RE_url); 
     500                m = txtNode.data.match(Xinha.RE_url); 
    501501                a.href = (m[1] ? m[1] : 'http://') + m[2]; 
    502502                // @fixme: why the hell do another timeout is started ? 
     
    518518  { 
    519519    case 13: // KEY enter 
    520       if ( HTMLArea.is_gecko && !ev.shiftKey && this.config.mozParaHandler == 'dirty' ) 
     520      if ( Xinha.is_gecko && !ev.shiftKey && this.config.mozParaHandler == 'dirty' ) 
    521521      { 
    522522        this.dom_checkInsertP(); 
    523         HTMLArea._stopEvent(ev); 
     523        Xinha._stopEvent(ev); 
    524524      } 
    525525    break; 
    526526    case 8: // KEY backspace 
    527527    case 46: // KEY delete 
    528       if ( ( HTMLArea.is_gecko && !ev.shiftKey ) || HTMLArea.is_ie ) 
     528      if ( ( Xinha.is_gecko && !ev.shiftKey ) || Xinha.is_ie ) 
    529529      { 
    530530        if ( this.checkBackspace() ) 
    531531        { 
    532           HTMLArea._stopEvent(ev); 
     532          Xinha._stopEvent(ev); 
    533533        } 
    534534      } 
     
    537537} 
    538538 
    539 HTMLArea._browserSpecificFunctionsLoaded = true; 
     539Xinha._browserSpecificFunctionsLoaded = true; 
  • trunk/getHTML.js

    r635 r649  
    22// getting innerHTML, using standard DOM calls. 
    33// Wrapper catch a Mozilla-Exception with non well formed html source code 
    4 HTMLArea.getHTML = function(root, outputRoot, editor) 
     4Xinha.getHTML = function(root, outputRoot, editor) 
    55{ 
    66  try 
    77  { 
    8     return HTMLArea.getHTMLWrapper(root,outputRoot,editor); 
     8    return Xinha.getHTMLWrapper(root,outputRoot,editor); 
    99  } 
    1010  catch(ex) 
    1111  { 
    12     alert(HTMLArea._lc('Your Document is not well formed. Check JavaScript console for details.')); 
     12    alert(Xinha._lc('Your Document is not well formed. Check JavaScript console for details.')); 
    1313    return editor._iframe.contentWindow.document.body.innerHTML; 
    1414  } 
    1515}; 
    1616 
    17 HTMLArea.getHTMLWrapper = function(root, outputRoot, editor, indent) 
     17Xinha.getHTMLWrapper = function(root, outputRoot, editor, indent) 
    1818{ 
    1919  var html = ""; 
     
    4242      // Mozilla seems to convert CDATA into a comment when going into wysiwyg mode, 
    4343      //  don't know about IE 
    44       html += (HTMLArea.is_ie ? ('\n' + indent) : '') + '<![CDATA[' + root.data + ']]>' ; 
     44      html += (Xinha.is_ie ? ('\n' + indent) : '') + '<![CDATA[' + root.data + ']]>' ; 
    4545    break; 
    4646 
     
    5252      // PI's don't seem to survive going into the wysiwyg mode, (at least in moz) 
    5353      // so this is purely academic 
    54       html += (HTMLArea.is_ie ? ('\n' + indent) : '') + '<?' + root.target + ' ' + root.data + ' ?>'; 
     54      html += (Xinha.is_ie ? ('\n' + indent) : '') + '<?' + root.target + ' ' + root.data + ' ?>'; 
    5555    break; 
    5656 
     
    6969        outputRoot = !(editor.config.htmlRemoveTags && editor.config.htmlRemoveTags.test(root_tag)); 
    7070      } 
    71       if ( HTMLArea.is_ie && root_tag == "head" ) 
     71      if ( Xinha.is_ie && root_tag == "head" ) 
    7272      { 
    7373        if ( outputRoot ) 
    7474        { 
    75           html += (HTMLArea.is_ie ? ('\n' + indent) : '') + "<head>"; 
     75          html += (Xinha.is_ie ? ('\n' + indent) : '') + "<head>"; 
    7676        } 
    7777        // lowercasize 
    7878        var save_multiline = RegExp.multiline; 
    7979        RegExp.multiline = true; 
    80         var txt = root.innerHTML.replace(HTMLArea.RE_tagName, function(str, p1, p2) { return p1 + p2.toLowerCase(); }); 
     80        var txt = root.innerHTML.replace(Xinha.RE_tagName, function(str, p1, p2) { return p1 + p2.toLowerCase(); }); 
    8181        RegExp.multiline = save_multiline; 
    8282        html += txt + '\n'; 
    8383        if ( outputRoot ) 
    8484        { 
    85           html += (HTMLArea.is_ie ? ('\n' + indent) : '') + "</head>"; 
     85          html += (Xinha.is_ie ? ('\n' + indent) : '') + "</head>"; 
    8686        } 
    8787        break; 
     
    8989      else if ( outputRoot ) 
    9090      { 
    91         closed = (!(root.hasChildNodes() || HTMLArea.needsClosingTag(root))); 
    92         html += (HTMLArea.is_ie && HTMLArea.isBlockElement(root) ? ('\n' + indent) : '') + "<" + root.tagName.toLowerCase(); 
     91        closed = (!(root.hasChildNodes() || Xinha.needsClosingTag(root))); 
     92        html += (Xinha.is_ie && Xinha.isBlockElement(root) ? ('\n' + indent) : '') + "<" + root.tagName.toLowerCase(); 
    9393        var attrs = root.attributes; 
    9494        for ( i = 0; i < attrs.length; ++i ) 
     
    133133              // links using a.nodeValue, a.value, a.stringValue, root.getAttribute("href") 
    134134              // So we have to strip the baseurl manually :-/ 
    135               if ( HTMLArea.is_ie && (name == "href" || name == "src") ) 
     135              if ( Xinha.is_ie && (name == "href" || name == "src") ) 
    136136              { 
    137137                value = editor.stripBaseURL(value); 
     
    170170            continue; 
    171171          } 
    172           html += " " + name + '="' + HTMLArea.htmlEncode(value) + '"'; 
     172          html += " " + name + '="' + Xinha.htmlEncode(value) + '"'; 
    173173        } 
    174174        if ( html !== "" ) 
     
    194194        if ( !editor.config.stripScripts ) 
    195195        { 
    196           if (HTMLArea.is_ie) 
     196          if (Xinha.is_ie) 
    197197          { 
    198198            var innerText = "\n" + root.innerHTML.replace(/^[\n\r]*/,'').replace(/\s+$/,'') + '\n' + indent; 
     
    202202            var innerText = (root.hasChildNodes()) ? root.firstChild.nodeValue : ''; 
    203203          } 
    204           html += innerText + '</'+root_tag+'>' + ((HTMLArea.is_ie) ? '\n' : ''); 
     204          html += innerText + '</'+root_tag+'>' + ((Xinha.is_ie) ? '\n' : ''); 
    205205        } 
    206206      } 
     
    209209        for ( i = root.firstChild; i; i = i.nextSibling ) 
    210210        { 
    211           if ( !containsBlock && i.nodeType == 1 && HTMLArea.isBlockElement(i) ) 
     211          if ( !containsBlock && i.nodeType == 1 && Xinha.isBlockElement(i) ) 
    212212          { 
    213213            containsBlock = true; 
    214214          } 
    215           html += HTMLArea.getHTMLWrapper(i, true, editor, indent + '  '); 
     215          html += Xinha.getHTMLWrapper(i, true, editor, indent + '  '); 
    216216        } 
    217217        if ( outputRoot && !closed ) 
    218218        { 
    219           html += (HTMLArea.is_ie && HTMLArea.isBlockElement(root) && containsBlock ? ('\n' + indent) : '') + "</" + root.tagName.toLowerCase() + ">"; 
     219          html += (Xinha.is_ie && Xinha.isBlockElement(root) && containsBlock ? ('\n' + indent) : '') + "</" + root.tagName.toLowerCase() + ">"; 
    220220        } 
    221221      } 
     
    223223 
    224224    case 3: // Node.TEXT_NODE 
    225       html = /^script|style$/i.test(root.parentNode.tagName) ? root.data : HTMLArea.htmlEncode(root.data); 
     225      html = /^script|style$/i.test(root.parentNode.tagName) ? root.data : Xinha.htmlEncode(root.data); 
    226226    break; 
    227227 
  • trunk/htmlarea.js

    r647 r649  
    1   
    2   /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- 
     1/*  IMPORTANT:  
     2     
     3    THIS FILE IS A COPY OF XinhaCore.js FOR BACKWARD COMPATIBILITY PURPOSES ONLY 
     4    IF YOU MAKE CHANGES TO THE CODE, DO IT THERE! 
     5 
     6*/  
     7   
     8 
     9/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- 
    310    --  Xinha (is not htmlArea) - http://xinha.gogo.co.nz/ 
    411    -- 
     
    3340    --------------------------------------------------------------------------*/ 
    3441 
    35 HTMLArea.version = 
     42Xinha.version = 
    3643{ 
    3744  'Release'   : 'Trunk', 
     
    6976} 
    7077 
    71 var __htmlareas = []; 
     78var __xinhas = []; 
    7279 
    7380// browser identification 
    74 HTMLArea.agt       = navigator.userAgent.toLowerCase(); 
    75 HTMLArea.is_ie     = ((HTMLArea.agt.indexOf("msie") != -1) && (HTMLArea.agt.indexOf("opera") == -1)); 
    76 HTMLArea.is_opera  = (HTMLArea.agt.indexOf("opera") != -1); 
    77 HTMLArea.is_mac    = (HTMLArea.agt.indexOf("mac") != -1); 
    78 HTMLArea.is_mac_ie = (HTMLArea.is_ie && HTMLArea.is_mac); 
    79 HTMLArea.is_win_ie = (HTMLArea.is_ie && !HTMLArea.is_mac); 
    80 HTMLArea.is_gecko  = (navigator.product == "Gecko"); 
    81 HTMLArea.isRunLocally = document.URL.toLowerCase().search(/^file:/) != -1; 
    82 if ( HTMLArea.isRunLocally ) 
     81Xinha.agt       = navigator.userAgent.toLowerCase(); 
     82Xinha.is_ie        = ((Xinha.agt.indexOf("msie") != -1) && (Xinha.agt.indexOf("opera") == -1)); 
     83Xinha.is_opera  = (Xinha.agt.indexOf("opera") != -1); 
     84Xinha.is_mac       = (Xinha.agt.indexOf("mac") != -1); 
     85Xinha.is_mac_ie = (Xinha.is_ie && Xinha.is_mac); 
     86Xinha.is_win_ie = (Xinha.is_ie && !Xinha.is_mac); 
     87Xinha.is_gecko  = (navigator.product == "Gecko"); 
     88Xinha.isRunLocally = document.URL.toLowerCase().search(/^file:/) != -1; 
     89if ( Xinha.isRunLocally ) 
    8390{ 
    8491  alert('Xinha *must* be installed on a web server. Locally opened files (those that use the "file://" protocol) cannot properly function. Xinha will try to initialize but may not be correctly loaded.'); 
    8592} 
    8693 
    87 // Creates a new HTMLArea object.  Tries to replace the textarea with the given 
     94// Creates a new Xinha object.  Tries to replace the textarea with the given 
    8895// ID with it. 
    89 function HTMLArea(textarea, config) 
     96function Xinha(textarea, config) 
    9097{ 
    9198  if ( !textarea ) 
    9299  { 
    93     throw("Tried to create HTMLArea without textarea specified."); 
    94   } 
    95  
    96   if ( HTMLArea.checkSupportedBrowser() ) 
     100    throw("Tried to create Xinha without textarea specified."); 
     101  } 
     102 
     103  if ( Xinha.checkSupportedBrowser() ) 
    97104  { 
    98105    if ( typeof config == "undefined" ) 
    99106    { 
    100       this.config = new HTMLArea.Config(); 
     107      this.config = new Xinha.Config(); 
    101108    } 
    102109    else 
     
    108115    if ( typeof textarea != 'object' ) 
    109116    { 
    110       textarea = HTMLArea.getElementById('textarea', textarea); 
     117      textarea = Xinha.getElementById('textarea', textarea); 
    111118    } 
    112119    this._textArea = textarea; 
     
    139146        loading_message.style.width = this._initial_ta_size.w; 
    140147      } 
    141       loading_message.style.left = HTMLArea.findPosX(textarea) +  'px'; 
    142       loading_message.style.top = (HTMLArea.findPosY(textarea) + parseInt(this._initial_ta_size.h, 10) / 2) +  'px'; 
     148      loading_message.style.left = Xinha.findPosX(textarea) +  'px'; 
     149      loading_message.style.top = (Xinha.findPosY(textarea) + parseInt(this._initial_ta_size.h, 10) / 2) +  'px'; 
    143150      // main static message 
    144151      var loading_main = document.createElement("div"); 
    145152      loading_main.className = "loading_main"; 
    146153      loading_main.id = "loading_main_" + textarea.name; 
    147       loading_main.appendChild(document.createTextNode(HTMLArea._lc("Loading in progress. Please wait !"))); 
     154      loading_main.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait !"))); 
    148155      // sub dynamic message 
    149156      var loading_sub = document.createElement("div"); 
    150157      loading_sub.className = "loading_sub"; 
    151158      loading_sub.id = "loading_sub_" + textarea.name; 
    152       loading_sub.appendChild(document.createTextNode(HTMLArea._lc("Constructing main object"))); 
     159      loading_sub.appendChild(document.createTextNode(Xinha._lc("Constructing main object"))); 
    153160      loading_message.appendChild(loading_main); 
    154161      loading_message.appendChild(loading_sub); 
     
    166173    this._mdoc = document; // cache the document, we need it in plugins 
    167174    this.doctype = ''; 
    168     this.__htmlarea_id_num = __htmlareas.length; 
    169     __htmlareas[this.__htmlarea_id_num] = this; 
     175    this.__htmlarea_id_num = __xinhas.length; 
     176    __xinhas[this.__htmlarea_id_num] = this; 
    170177 
    171178    this._notifyListeners = {}; 
     
    205212      panels[i].div = panels[i].container; // legacy 
    206213      panels[i].container.className = 'panels ' + i; 
    207       HTMLArea.freeLater(panels[i], 'container'); 
    208       HTMLArea.freeLater(panels[i], 'div'); 
     214      Xinha.freeLater(panels[i], 'container'); 
     215      Xinha.freeLater(panels[i], 'div'); 
    209216    } 
    210217    // finally store the variable 
    211218    this._panels = panels; 
    212219 
    213     HTMLArea.freeLater(this, '_textArea'); 
     220    Xinha.freeLater(this, '_textArea'); 
    214221  } 
    215222} 
    216223 
    217 HTMLArea.onload = function() { }; 
    218 HTMLArea.init = function() { HTMLArea.onload(); }; 
     224Xinha.onload = function() { }; 
     225Xinha.init = function() { Xinha.onload(); }; 
    219226 
    220227// cache some regexps 
    221 HTMLArea.RE_tagName  = /(<\/|<)\s*([^ \t\n>]+)/ig; 
    222 HTMLArea.RE_doctype  = /(<!doctype((.|\n)*?)>)\n?/i; 
    223 HTMLArea.RE_head     = /<head>((.|\n)*?)<\/head>/i; 
    224 HTMLArea.RE_body     = /<body[^>]*>((.|\n|\r|\t)*?)<\/body>/i; 
    225 HTMLArea.RE_Specials = /([\/\^$*+?.()|{}[\]])/g; 
    226 HTMLArea.RE_email    = /[_a-zA-Z\d\-\.]{3,}@[_a-zA-Z\d\-]{2,}(\.[_a-zA-Z\d\-]{2,})+/i; 
    227 HTMLArea.RE_url      = /(https?:\/\/)?(([a-z0-9_]+:[a-z0-9_]+@)?[a-z0-9_-]{2,}(\.[a-z0-9_-]{2,}){2,}(:[0-9]+)?(\/\S+)*)/i; 
    228  
    229 HTMLArea.Config = function() 
     228Xinha.RE_tagName  = /(<\/|<)\s*([^ \t\n>]+)/ig; 
     229Xinha.RE_doctype  = /(<!doctype((.|\n)*?)>)\n?/i; 
     230Xinha.RE_head     = /<head>((.|\n)*?)<\/head>/i; 
     231Xinha.RE_body     = /<body[^>]*>((.|\n|\r|\t)*?)<\/body>/i; 
     232Xinha.RE_Specials = /([\/\^$*+?.()|{}[\]])/g; 
     233Xinha.RE_email    = /[_a-zA-Z\d\-\.]{3,}@[_a-zA-Z\d\-]{2,}(\.[_a-zA-Z\d\-]{2,})+/i; 
     234Xinha.RE_url      = /(https?:\/\/)?(([a-z0-9_]+:[a-z0-9_]+@)?[a-z0-9_-]{2,}(\.[a-z0-9_-]{2,}){2,}(:[0-9]+)?(\/\S+)*)/i; 
     235 
     236Xinha.Config = function() 
    230237{ 
    231238  var cfg = this; 
    232   this.version = HTMLArea.version.Revision; 
     239  this.version = Xinha.version.Revision; 
    233240 
    234241  // Width and Height 
     
    268275  this.statusBar = true; 
    269276 
    270   // intercept ^V and use the HTMLArea paste command 
     277  // intercept ^V and use the Xinha paste command 
    271278  // If false, then passes ^V through to browser editor widget 
    272279  this.htmlareaPaste = false; 
     
    289296  this.changeJustifyWithDirection = false; 
    290297 
    291   // if true then HTMLArea will retrieve the full HTML, starting with the 
     298  // if true then Xinha will retrieve the full HTML, starting with the 
    292299  // <HTML> tag. 
    293300  this.fullPage = false; 
     
    343350 
    344351  // CharSet of the iframe, default is the charset of the document 
    345   this.charSet = HTMLArea.is_gecko ? document.characterSet : document.charset; 
     352  this.charSet = Xinha.is_gecko ? document.characterSet : document.charset; 
    346353 
    347354  // URL-s 
     
    391398   * 
    392399   * It is recommended that you customize the toolbar contents in an 
    393    * external file (i.e. the one calling HTMLArea) and leave this one 
     400   * external file (i.e. the one calling Xinha) and leave this one 
    394401   * unchanged.  That's because when we (InteractiveTools.com) release a 
    395402   * new official version, it's less likely that you will have problems 
    396    * upgrading HTMLArea. 
     403   * upgrading Xinha. 
    397404   */ 
    398405  this.toolbar = 
     
    405412    ["separator","insertorderedlist","insertunorderedlist","outdent","indent"], 
    406413    ["separator","inserthorizontalrule","createlink","insertimage","inserttable"], 
    407     ["linebreak","separator","undo","redo","selectall","print"], (HTMLArea.is_gecko ? [] : ["cut","copy","paste","overwrite","saveas"]), 
     414    ["linebreak","separator","undo","redo","selectall","print"], (Xinha.is_gecko ? [] : ["cut","copy","paste","overwrite","saveas"]), 
    408415    ["separator","killword","clearfonts","removeformat","toggleborders","splitblock","lefttoright", "righttoleft"], 
    409416    ["separator","htmlmode","showhelp","about"] 
     
    475482  //              it has the following prototype: 
    476483  //                 function(editor, buttonName) 
    477   //              - editor is the HTMLArea object that triggered the call 
     484  //              - editor is the Xinha object that triggered the call 
    478485  //              - buttonName is the ID of the clicked button 
    479486  //              These 2 parameters makes it possible for you to use the same 
    480   //              handler for more HTMLArea objects or for more different buttons. 
     487  //              handler for more Xinha objects or for more different buttons. 
    481488  //    - ToolTip: tooltip, will be translated below 
    482489  //    - Icon: path to an icon image file for the button 
     
    489496  this.btnList = 
    490497  { 
    491     bold: [ "Bold", HTMLArea._lc({key: 'button_bold', string: ["ed_buttons_main.gif",3,2]}, 'HTMLArea'), false, function(e) { e.execCommand("bold"); } ], 
    492     italic: [ "Italic", HTMLArea._lc({key: 'button_italic', string: ["ed_buttons_main.gif",2,2]}, 'HTMLArea'), false, function(e) { e.execCommand("italic"); } ], 
    493     underline: [ "Underline", HTMLArea._lc({key: 'button_underline', string: ["ed_buttons_main.gif",2,0]}, 'HTMLArea'), false, function(e) { e.execCommand("underline"); } ], 
    494     strikethrough: [ "Strikethrough", HTMLArea._lc({key: 'button_strikethrough', string: ["ed_buttons_main.gif",3,0]}, 'HTMLArea'), false, function(e) { e.execCommand("strikethrough"); } ], 
    495     subscript: [ "Subscript", HTMLArea._lc({key: 'button_subscript', string: ["ed_buttons_main.gif",3,1]}, 'HTMLArea'), false, function(e) { e.execCommand("subscript"); } ], 
    496     superscript: [ "Superscript", HTMLArea._lc({key: 'button_superscript', string: ["ed_buttons_main.gif",2,1]}, 'HTMLArea'), false, function(e) { e.execCommand("superscript"); } ], 
     498    bold: [ "Bold", Xinha._lc({key: 'button_bold', string: ["ed_buttons_main.gif",3,2]}, 'Xinha'), false, function(e) { e.execCommand("bold"); } ], 
     499    italic: [ "Italic", Xinha._lc({key: 'button_italic', string: ["ed_buttons_main.gif",2,2]}, 'Xinha'), false, function(e) { e.execCommand("italic"); } ], 
     500    underline: [ "Underline", Xinha._lc({key: 'button_underline', string: ["ed_buttons_main.gif",2,0]}, 'Xinha'), false, function(e) { e.execCommand("underline"); } ], 
     501    strikethrough: [ "Strikethrough", Xinha._lc({key: 'button_strikethrough', string: ["ed_buttons_main.gif",3,0]}, 'Xinha'), false, function(e) { e.execCommand("strikethrough"); } ], 
     502    subscript: [ "Subscript", Xinha._lc({key: 'button_subscript', string: ["ed_buttons_main.gif",3,1]}, 'Xinha'), false, function(e) { e.execCommand("subscript"); } ], 
     503    superscript: [ "Superscript", Xinha._lc({key: 'button_superscript', string: ["ed_buttons_main.gif",2,1]}, 'Xinha'), false, function(e) { e.execCommand("superscript"); } ], 
    497504 
    498505    justifyleft: [ "Justify Left", ["ed_buttons_main.gif",0,0], false, function(e) { e.execCommand("justifyleft"); } ], 
     
    525532    htmlmode: [ "Toggle HTML Source", ["ed_buttons_main.gif",7,0], true, function(e) { e.execCommand("htmlmode"); } ], 
    526533    toggleborders: [ "Toggle Borders", ["ed_buttons_main.gif",7,2], false, function(e) { e._toggleBorders(); } ], 
    527     print: [ "Print document", ["ed_buttons_main.gif",8,1], false, function(e) { if(HTMLArea.is_gecko) {e._iframe.contentWindow.print(); } else { e.focusEditor(); print(); } } ], 
     534    print: [ "Print document", ["ed_buttons_main.gif",8,1], false, function(e) { if(Xinha.is_gecko) {e._iframe.contentWindow.print(); } else { e.focusEditor(); print(); } } ], 
    528535    saveas: [ "Save as", "ed_saveas.gif", false, function(e) { e.execCommand("saveas",false,"noname.htm"); } ], 
    529536    about: [ "About this editor", ["ed_buttons_main.gif",8,2], true, function(e) { e.execCommand("about"); } ], 
     
    547554   * file and leave this one unchanged.  That's because when we 
    548555   * (InteractiveTools.com) release a new official version, it's less 
    549    * likely that you will have problems upgrading HTMLArea. 
     556   * likely that you will have problems upgrading Xinha. 
    550557   * 
    551    * Example on how to add a custom button when you construct the HTMLArea: 
     558   * Example on how to add a custom button when you construct the Xinha: 
    552559   * 
    553    *   var editor = new HTMLArea("your_text_area_id"); 
     560   *   var editor = new Xinha("your_text_area_id"); 
    554561   *   var cfg = editor.config; // this is the default configuration 
    555562   *   cfg.btnList["my-hilite"] = 
     
    581588      btn[1] = _editor_url + this.imgURL + btn[1]; 
    582589    } 
    583     btn[0] = HTMLArea._lc(btn[0]); //initialize tooltip 
     590    btn[0] = Xinha._lc(btn[0]); //initialize tooltip 
    584591  } 
    585592 
     
    603610 *    }); 
    604611 */ 
    605 HTMLArea.Config.prototype.registerButton = function(id, tooltip, image, textMode, action, context) 
     612Xinha.Config.prototype.registerButton = function(id, tooltip, image, textMode, action, context) 
    606613{ 
    607614  var the_id; 
     
    616623  else 
    617624  { 
    618     alert("ERROR [HTMLArea.Config::registerButton]:\ninvalid arguments"); 
     625    alert("ERROR [Xinha.Config::registerButton]:\ninvalid arguments"); 
    619626    return false; 
    620627  } 
     
    622629//  if(typeof this.customSelects[the_id] != "undefined") 
    623630//  { 
    624     // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists."); 
     631    // alert("WARNING [Xinha.Config::registerDropdown]:\nA dropdown with the same ID already exists."); 
    625632//  } 
    626633//  if(typeof this.btnList[the_id] != "undefined") { 
    627     // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists."); 
     634    // alert("WARNING [Xinha.Config::registerDropdown]:\nA button with the same ID already exists."); 
    628635//  } 
    629636  switch ( typeof id ) 
     
    638645}; 
    639646 
    640 HTMLArea.prototype.registerPanel = function(side, object) 
     647Xinha.prototype.registerPanel = function(side, object) 
    641648{ 
    642649  if ( !side ) 
     
    658665 * FIXME: add example 
    659666 */ 
    660 HTMLArea.Config.prototype.registerDropdown = function(object) 
     667Xinha.Config.prototype.registerDropdown = function(object) 
    661668{ 
    662669  // check for existing id 
    663670//  if ( typeof this.customSelects[object.id] != "undefined" ) 
    664671//  { 
    665     // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists."); 
     672    // alert("WARNING [Xinha.Config::registerDropdown]:\nA dropdown with the same ID already exists."); 
    666673//  } 
    667674//  if ( typeof this.btnList[object.id] != "undefined" ) 
    668675//  { 
    669     // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists."); 
     676    // alert("WARNING [Xinha.Config::registerDropdown]:\nA button with the same ID already exists."); 
    670677//  } 
    671678  this.customSelects[object.id] = object; 
     
    682689 * create a brand new toolbar ;-) 
    683690 */ 
    684 HTMLArea.Config.prototype.hideSomeButtons = function(remove) 
     691Xinha.Config.prototype.hideSomeButtons = function(remove) 
    685692{ 
    686693  var toolbar = this.toolbar; 
     
    715722*/ 
    716723 
    717 HTMLArea.Config.prototype.addToolbarElement = function(id, where, position) 
     724Xinha.Config.prototype.addToolbarElement = function(id, where, position) 
    718725{ 
    719726  var toolbar = this.toolbar; 
     
    869876}; 
    870877 
    871 HTMLArea.Config.prototype.removeToolbarElement = HTMLArea.Config.prototype.hideSomeButtons; 
    872  
    873 /** Helper function: replace all TEXTAREA-s in the document with HTMLArea-s. */ 
    874 HTMLArea.replaceAll = function(config) 
     878Xinha.Config.prototype.removeToolbarElement = Xinha.Config.prototype.hideSomeButtons; 
     879 
     880/** Helper function: replace all TEXTAREA-s in the document with Xinha-s. */ 
     881Xinha.replaceAll = function(config) 
    875882{ 
    876883  var tas = document.getElementsByTagName("textarea"); 
    877884  // @todo: weird syntax, doesnt help to read the code, doesnt obfuscate it and doesnt make it quicker, better rewrite this part 
    878   for ( var i = tas.length; i > 0; (new HTMLArea(tas[--i], config)).generate() ) 
     885  for ( var i = tas.length; i > 0; (new Xinha(tas[--i], config)).generate() ) 
    879886  { 
    880887    // NOP 
     
    882889}; 
    883890 
    884 /** Helper function: replaces the TEXTAREA with the given ID with HTMLArea. */ 
    885 HTMLArea.replace = function(id, config) 
    886 { 
    887   var ta = HTMLArea.getElementById("textarea", id); 
    888   return ta ? (new HTMLArea(ta, config)).generate() : null; 
     891/** Helper function: replaces the TEXTAREA with the given ID with Xinha. */ 
     892Xinha.replace = function(id, config) 
     893{ 
     894  var ta = Xinha.getElementById("textarea", id); 
     895  return ta ? (new Xinha(ta, config)).generate() : null; 
    889896}; 
    890897 
    891898// Creates the toolbar and appends it to the _htmlarea 
    892 HTMLArea.prototype._createToolbar = function () 
     899Xinha.prototype._createToolbar = function () 
    893900{ 
    894901  this.setLoadingMessage('Create Toolbar'); 
     
    901908  toolbar.unselectable = "1"; 
    902909 
    903   HTMLArea.freeLater(this, '_toolBar'); 
    904   HTMLArea.freeLater(this, '_toolbar'); 
     910  Xinha.freeLater(this, '_toolBar'); 
     911  Xinha.freeLater(this, '_toolbar'); 
    905912   
    906913  var tb_row = null; 
     
    915922 
    916923// FIXME : function never used, can probably be removed from source 
    917 HTMLArea.prototype._setConfig = function(config) 
     924Xinha.prototype._setConfig = function(config) 
    918925{ 
    919926        this.config = config; 
    920927}; 
    921928 
    922 HTMLArea.prototype._addToolbar = function() 
     929Xinha.prototype._addToolbar = function() 
    923930{ 
    924931        this._createToolbar1(this, this._toolbar, this._toolbarObjects); 
     
    931938 * @private 
    932939 */ 
    933 HTMLArea._createToolbarBreakingElement = function() 
     940Xinha._createToolbarBreakingElement = function() 
    934941{ 
    935942  var brk = document.createElement('div'); 
     
    943950 
    944951// separate from previous createToolBar to allow dynamic change of toolbar 
    945 HTMLArea.prototype._createToolbar1 = function (editor, toolbar, tb_objects) 
     952Xinha.prototype._createToolbar1 = function (editor, toolbar, tb_objects) 
    946953{ 
    947954  var tb_row; 
     
    951958  if ( editor.config.flowToolbars ) 
    952959  { 
    953     toolbar.appendChild(HTMLArea._createToolbarBreakingElement()); 
     960    toolbar.appendChild(Xinha._createToolbarBreakingElement()); 
    954961  } 
    955962 
     
    968975    if ( editor.config.flowToolbars ) 
    969976    { 
    970       if ( HTMLArea.is_ie ) 
     977      if ( Xinha.is_ie ) 
    971978      { 
    972979        table.style.styleFloat = "left"; 
     
    10061013          if ( newval ) 
    10071014          { 
    1008             HTMLArea._removeClass(el, "buttonDisabled"); 
     1015            Xinha._removeClass(el, "buttonDisabled"); 
    10091016            el.disabled = false; 
    10101017          } 
    10111018          else 
    10121019          { 
    1013             HTMLArea._addClass(el, "buttonDisabled"); 
     1020            Xinha._addClass(el, "buttonDisabled"); 
    10141021            el.disabled = true; 
    10151022          } 
     
    10181025          if ( newval ) 
    10191026          { 
    1020             HTMLArea._addClass(el, "buttonPressed"); 
     1027            Xinha._addClass(el, "buttonPressed"); 
    10211028          } 
    10221029          else 
    10231030          { 
    1024             HTMLArea._removeClass(el, "buttonPressed"); 
     1031            Xinha._removeClass(el, "buttonPressed"); 
    10251032          } 
    10261033        break; 
     
    10911098      }; 
    10921099       
    1093       HTMLArea.freeLater(obj); 
     1100      Xinha.freeLater(obj); 
    10941101       
    10951102      tb_objects[txt] = obj; 
     
    11031110        } 
    11041111        var op = document.createElement("option"); 
    1105         op.innerHTML = HTMLArea._lc(i); 
     1112        op.innerHTML = Xinha._lc(i); 
    11061113        op.value = options[i]; 
    11071114        el.appendChild(op); 
    11081115      } 
    1109       HTMLArea._addEvent(el, "change", function () { editor._comboSelected(el, txt); } ); 
     1116      Xinha._addEvent(el, "change", function () { editor._comboSelected(el, txt); } ); 
    11101117    } 
    11111118    return el; 
     
    11381145        el.appendChild(document.createTextNode("A")); 
    11391146        el.className = "indicator"; 
    1140         el.title = HTMLArea._lc("Current style"); 
     1147        el.title = Xinha._lc("Current style"); 
    11411148        obj = 
    11421149        { 
     
    11501157        }; 
    11511158       
    1152         HTMLArea.freeLater(obj); 
     1159        Xinha.freeLater(obj); 
    11531160       
    11541161        tb_objects[txt] = obj; 
     
    11791186        context : btn[4] || null // enabled in a certain context? 
    11801187      }; 
    1181       HTMLArea.freeLater(el); 
    1182       HTMLArea.freeLater(obj); 
     1188      Xinha.freeLater(el); 
     1189      Xinha.freeLater(obj); 
    11831190 
    11841191      tb_objects[txt] = obj; 
     
    11881195 
    11891196      // handlers to emulate nice flat toolbar buttons 
    1190       HTMLArea._addEvent( 
     1197      Xinha._addEvent( 
    11911198        el, 
    11921199        "mouseout", 
     
    11951202          if ( obj.enabled ) 
    11961203          { 
    1197             //HTMLArea._removeClass(el, "buttonHover"); 
    1198             HTMLArea._removeClass(el, "buttonActive"); 
     1204            //Xinha._removeClass(el, "buttonHover"); 
     1205            Xinha._removeClass(el, "buttonActive"); 
    11991206            if ( obj.active ) 
    12001207            { 
    1201               HTMLArea._addClass(el, "buttonPressed"); 
     1208              Xinha._addClass(el, "buttonPressed"); 
    12021209            } 
    12031210          } 
     
    12051212      ); 
    12061213 
    1207       HTMLArea._addEvent( 
     1214      Xinha._addEvent( 
    12081215        el, 
    12091216        "mousedown", 
     
    12121219          if ( obj.enabled ) 
    12131220          { 
    1214             HTMLArea._addClass(el, "buttonActive"); 
    1215             HTMLArea._removeClass(el, "buttonPressed"); 
    1216             HTMLArea._stopEvent(HTMLArea.is_ie ? window.event : ev); 
     1221            Xinha._addClass(el, "buttonActive"); 
     1222            Xinha._removeClass(el, "buttonPressed"); 
     1223            Xinha._stopEvent(Xinha.is_ie ? window.event : ev); 
    12171224          } 
    12181225        } 
     
    12201227 
    12211228      // when clicked, do the following: 
    1222       HTMLArea._addEvent( 
     1229      Xinha._addEvent( 
    12231230        el, 
    12241231        "click", 
     
    12271234          if ( obj.enabled ) 
    12281235          { 
    1229             HTMLArea._removeClass(el, "buttonActive"); 
    1230             //HTMLArea._removeClass(el, "buttonHover"); 
    1231             if ( HTMLArea.is_gecko ) 
     1236            Xinha._removeClass(el, "buttonActive"); 
     1237            //Xinha._removeClass(el, "buttonHover"); 
     1238            if ( Xinha.is_gecko ) 
    12321239            { 
    12331240              editor.activateEditor(); 
    12341241            } 
    12351242            obj.cmd(editor, obj.name, obj); 
    1236             HTMLArea._stopEvent(HTMLArea.is_ie ? window.event : ev); 
     1243            Xinha._stopEvent(Xinha.is_ie ? window.event : ev); 
    12371244          } 
    12381245        } 
    12391246      ); 
    12401247 
    1241       var i_contain = HTMLArea.makeBtnImg(btn[1]); 
     1248      var i_contain = Xinha.makeBtnImg(btn[1]); 
    12421249      var img = i_contain.firstChild; 
    12431250      el.appendChild(i_contain); 
     
    12981305        if ( l7ed ) 
    12991306        { 
    1300           label = HTMLArea._lc(label); 
     1307          label = Xinha._lc(label); 
    13011308        } 
    13021309        tb_cell = document.createElement("td"); 
     
    13251332  if ( editor.config.flowToolbars ) 
    13261333  { 
    1327     toolbar.appendChild(HTMLArea._createToolbarBreakingElement()); 
     1334    toolbar.appendChild(Xinha._createToolbarBreakingElement()); 
    13281335  } 
    13291336 
     
    13341341//         Why the hell this is not in the config object ? 
    13351342var use_clone_img = false; 
    1336 HTMLArea.makeBtnImg = function(imgDef, doc) 
     1343Xinha.makeBtnImg = function(imgDef, doc) 
    13371344{ 
    13381345  if ( !doc ) 
     
    13411348  } 
    13421349 
    1343   if ( !doc._htmlareaImgCache ) 
    1344   { 
    1345     doc._htmlareaImgCache = {}; 
    1346     HTMLArea.freeLater(doc._htmlareaImgCache); 
     1350  if ( !doc._xinhaImgCache ) 
     1351  { 
     1352    doc._xinhaImgCache = {}; 
     1353    Xinha.freeLater(doc._xinhaImgCache); 
    13471354  } 
    13481355 
    13491356  var i_contain = null; 
    1350   if ( HTMLArea.is_ie && ( ( !doc.compatMode ) || ( doc.compatMode && doc.compatMode == "BackCompat" ) ) ) 
     1357  if ( Xinha.is_ie && ( ( !doc.compatMode ) || ( doc.compatMode && doc.compatMode == "BackCompat" ) ) ) 
    13511358  { 
    13521359    i_contain = doc.createElement('span'); 
     
    13661373  if ( typeof imgDef == 'string' ) 
    13671374  { 
    1368     if ( doc._htmlareaImgCache[imgDef] ) 
    1369     { 
    1370       img = doc._htmlareaImgCache[imgDef].cloneNode(); 
     1375    if ( doc._xinhaImgCache[imgDef] ) 
     1376    { 
     1377      img = doc._xinhaImgCache[imgDef].cloneNode(); 
    13711378    } 
    13721379    else 
     
    13781385      if ( use_clone_img ) 
    13791386      { 
    1380         doc._htmlareaImgCache[imgDef] = img.cloneNode(); 
     1387        doc._xinhaImgCache[imgDef] = img.cloneNode(); 
    13811388      } 
    13821389    } 
     
    13841391  else 
    13851392  { 
    1386     if ( doc._htmlareaImgCache[imgDef[0]] ) 
    1387     { 
    1388       img = doc._htmlareaImgCache[imgDef[0]].cloneNode(); 
     1393    if ( doc._xinhaImgCache[imgDef[0]] ) 
     1394    { 
     1395      img = doc._xinhaImgCache[imgDef[0]].cloneNode(); 
    13891396    } 
    13901397    else 
     
    13951402      if ( use_clone_img ) 
    13961403      { 
    1397         doc._htmlareaImgCache[imgDef[0]] = img.cloneNode(); 
     1404        doc._xinhaImgCache[imgDef[0]] = img.cloneNode(); 
    13981405      } 
    13991406    } 
     
    14081415}; 
    14091416 
    1410 HTMLArea.prototype._createStatusBar = function() 
     1417Xinha.prototype._createStatusBar = function() 
    14111418{ 
    14121419  this.setLoadingMessage('Create StatusBar'); 
     
    14141421  statusbar.className = "statusBar"; 
    14151422  this._statusBar = statusbar; 
    1416   HTMLArea.freeLater(this, '_statusBar'); 
     1423  Xinha.freeLater(this, '_statusBar'); 
    14171424   
    1418   // statusbar.appendChild(document.createTextNode(HTMLArea._lc("Path") + ": ")); 
     1425  // statusbar.appendChild(document.createTextNode(Xinha._lc("Path") + ": ")); 
    14191426  // creates a holder for the path view 
    14201427  var div = document.createElement("span"); 
    14211428  div.className = "statusBarTree"; 
    1422   div.innerHTML = HTMLArea._lc("Path") + ": "; 
     1429  div.innerHTML = Xinha._lc("Path") + ": "; 
    14231430  this._statusBarTree = div; 
    1424   HTMLArea.freeLater(this, '_statusBarTree'); 
     1431  Xinha.freeLater(this, '_statusBarTree'); 
    14251432  this._statusBar.appendChild(div); 
    14261433 
    14271434  div = document.createElement("span"); 
    1428   div.innerHTML = HTMLArea._lc("You are in TEXT MODE.  Use the [<>] button to switch back to WYSIWYG."); 
     1435  div.innerHTML = Xinha._lc("You are in TEXT MODE.  Use the [<>] button to switch back to WYSIWYG."); 
    14291436  div.style.display = "none"; 
    14301437  this._statusBarTextMode = div; 
    1431   HTMLArea.freeLater(this, '_statusBarTextMode'); 
     1438  Xinha.freeLater(this, '_statusBarTextMode'); 
    14321439  this._statusBar.appendChild(div); 
    14331440 
     
    14411448}; 
    14421449 
    1443 // Creates the HTMLArea object and replaces the textarea with it. 
    1444 HTMLArea.prototype.generate = function () 
     1450// Creates the Xinha object and replaces the textarea with it. 
     1451Xinha.prototype.generate = function () 
    14451452{ 
    14461453  var i; 
     
    14501457  if ( typeof Dialog == 'undefined' ) 
    14511458  { 
    1452     HTMLArea._loadback(_editor_url + 'dialog.js', this.generate, this ); 
     1459    Xinha._loadback(_editor_url + 'dialog.js', this.generate, this ); 
    14531460    return false; 
    14541461  } 
    14551462 
    1456   if ( typeof HTMLArea.Dialog == 'undefined' ) 
    1457   { 
    1458     HTMLArea._loadback(_editor_url + 'inline-dialog.js', this.generate, this ); 
     1463  if ( typeof Xinha.Dialog == 'undefined' ) 
     1464  { 
     1465    Xinha._loadback(_editor_url + 'inline-dialog.js', this.generate, this ); 
    14591466    return false; 
    14601467  } 
     
    14621469  if ( typeof PopupWin == 'undefined' ) 
    14631470  { 
    1464     HTMLArea._loadback(_editor_url + 'popupwin.js', this.generate, this ); 
     1471    Xinha._loadback(_editor_url + 'popupwin.js', this.generate, this ); 
    14651472    return false; 
    14661473  } 
     
    15001507        { 
    15011508          // why can't we use the following line instead ? 
    1502 //          HTMLArea.loadPlugin("FullScreen", this.generate ); 
    1503           HTMLArea.loadPlugin("FullScreen", function() { editor.generate(); } ); 
     1509//          Xinha.loadPlugin("FullScreen", this.generate ); 
     1510          Xinha.loadPlugin("FullScreen", function() { editor.generate(); } ); 
    15041511          return false; 
    15051512        } 
     
    15101517 
    15111518  // If this is gecko, set up the paragraph handling now 
    1512   if ( HTMLArea.is_gecko && editor.config.mozParaHandler == 'best' ) 
     1519  if ( Xinha.is_gecko && editor.config.mozParaHandler == 'best' ) 
    15131520  { 
    15141521    if ( typeof EnterParagraphs == 'undefined' ) 
    15151522    { 
    15161523      // why can't we use the following line instead ? 
    1517 //      HTMLArea.loadPlugin("EnterParagraphs", this.generate ); 
    1518       HTMLArea.loadPlugin("EnterParagraphs", function() { editor.generate(); } ); 
     1524//      Xinha.loadPlugin("EnterParagraphs", this.generate ); 
     1525      Xinha.loadPlugin("EnterParagraphs", function() { editor.generate(); } ); 
    15191526      return false; 
    15201527    } 
     
    15221529  } 
    15231530 
    1524   if ( typeof HTMLArea.getHTML == 'undefined' ) 
    1525   { 
    1526       HTMLArea._loadback(_editor_url + "getHTML.js", function() { editor.generate(); } ); 
     1531  if ( typeof Xinha.getHTML == 'undefined' ) 
     1532  { 
     1533      Xinha._loadback(_editor_url + "getHTML.js", function() { editor.generate(); } ); 
    15271534          return false; 
    15281535  } 
    15291536   
    1530   if ( typeof HTMLArea.prototype._insertImage == 'undefined' ) 
    1531   { 
    1532       HTMLArea._loadback(_editor_url + "popups/insert_image.js", function() { editor.generate(); } ); 
     1537  if ( typeof Xinha.prototype._insertImage == 'undefined' ) 
     1538  { 
     1539      Xinha._loadback(_editor_url + "popups/insert_image.js", function() { editor.generate(); } ); 
    15331540          return false; 
    15341541  } 
    15351542 
    1536   if ( typeof HTMLArea.prototype._createLink == 'undefined' &&  typeof Linker == 'undefined' ) 
    1537   { 
    1538       HTMLArea._loadback(_editor_url + "popups/link.js", function() { editor.generate(); } ); 
     1543  if ( typeof Xinha.prototype._createLink == 'undefined' &&  typeof Linker == 'undefined' ) 
     1544  { 
     1545      Xinha._loadback(_editor_url + "popups/link.js", function() { editor.generate(); } ); 
    15391546          return false; 
    15401547  } 
     
    15651572 
    15661573  }; 
    1567   HTMLArea.freeLater(this._framework); 
     1574  Xinha.freeLater(this._framework); 
    15681575   
    15691576  var fw = this._framework; 
     
    16101617  fw.table.appendChild(fw.tbody); 
    16111618 
    1612   var htmlarea = this._framework.table; 
    1613   this._htmlArea = htmlarea; 
    1614   HTMLArea.freeLater(this, '_htmlArea'); 
    1615   htmlarea.className = "htmlarea"; 
     1619  var xinha = this._framework.table; 
     1620  this._htmlArea = xinha; 
     1621  Xinha.freeLater(this, '_htmlArea'); 
     1622  xinha.className = "htmlarea"; 
    16161623 
    16171624    // create the toolbar and put in the area 
     
    16241631  this._iframe = iframe; 
    16251632  this._iframe.className = 'xinha_iframe'; 
    1626   HTMLArea.freeLater(this, '_iframe'); 
     1633  Xinha.freeLater(this, '_iframe'); 
    16271634   
    16281635    // creates & appends the status bar 
     
    16321639  // insert Xinha before the textarea. 
    16331640  var textarea = this._textArea; 
    1634   textarea.parentNode.insertBefore(htmlarea, textarea); 
     1641  textarea.parentNode.insertBefore(xinha, textarea); 
    16351642  textarea.className = 'xinha_textarea'; 
    16361643 
    1637   // extract the textarea and insert it into the htmlarea 
    1638   HTMLArea.removeFromParent(textarea); 
     1644  // extract the textarea and insert it into the xinha framework 
     1645  Xinha.removeFromParent(textarea); 
    16391646  this._framework.ed_cell.appendChild(textarea); 
    16401647 
     
    16431650  if ( textarea.form ) 
    16441651  { 
    1645     // onsubmit get the HTMLArea content and update original textarea. 
    1646     HTMLArea.prependDom0Event( 
     1652    // onsubmit get the Xinha content and update original textarea. 
     1653    Xinha.prependDom0Event( 
    16471654      this._textArea.form, 
    16481655      'submit', 
     
    16561663    var initialTAContent = textarea.value; 
    16571664 
    1658     // onreset revert the HTMLArea content to the textarea content 
    1659     HTMLArea.prependDom0Event( 
     1665    // onreset revert the Xinha content to the textarea content 
     1666    Xinha.prependDom0Event( 
    16601667      this._textArea.form, 
    16611668      'reset', 
     
    16791686          var element = this.elements[i]; 
    16801687          if ( element.type != 'textarea' ) continue; 
    1681           for ( var a = __htmlareas.length; a--; ) 
     1688          for ( var a = __xinhas.length; a--; ) 
    16821689          { 
    1683             var editor = __htmlareas[a]; 
     1690            var editor = __xinhas[a]; 
    16841691            if ( editor && editor._textArea == element) 
    16851692            { 
     
    16951702  // add a handler for the "back/forward" case -- on body.unload we save 
    16961703  // the HTML content into the original textarea. 
    1697   HTMLArea.prependDom0Event( 
     1704  Xinha.prependDom0Event( 
    16981705    window, 
    16991706    'unload', 
     
    17131720  // Add an event to initialize the iframe once loaded. 
    17141721  editor._iframeLoadDone = false; 
    1715   HTMLArea._addEvent( 
     1722  Xinha._addEvent( 
    17161723    this._iframe, 
    17171724    'load', 
     
    17471754 */ 
    17481755 
    1749 HTMLArea.prototype.initSize = function() 
     1756Xinha.prototype.initSize = function() 
    17501757{ 
    17511758  this.setLoadingMessage('Init editor size'); 
     
    17971804 *  @param includingBars optional boolean to indicate if the size should include or exclude tool & status bars 
    17981805 */ 
    1799 HTMLArea.prototype.sizeEditor = function(width, height, includingBars, includingPanels) 
     1806Xinha.prototype.sizeEditor = function(width, height, includingBars, includingPanels) 
    18001807{ 
    18011808 
     
    18231830      // Need to add some for l & r panels 
    18241831      var rPanel = this._panels.right; 
    1825       if ( rPanel.on && rPanel.panels.length && HTMLArea.hasDisplayedChildren(rPanel.div) ) 
     1832      if ( rPanel.on && rPanel.panels.length && Xinha.hasDisplayedChildren(rPanel.div) ) 
    18261833      { 
    18271834        this._htmlArea.style.width = (this._htmlArea.offsetWidth + parseInt(this.config.panel_dimensions.right, 10)) + 'px'; 
     
    18291836 
    18301837      var lPanel = this._panels.left; 
    1831       if ( lPanel.on && lPanel.panels.length && HTMLArea.hasDisplayedChildren(lPanel.div) ) 
     1838      if ( lPanel.on && lPanel.panels.length && Xinha.hasDisplayedChildren(lPanel.div) ) 
    18321839      { 
    18331840        this._htmlArea.style.width = (this._htmlArea.offsetWidth + parseInt(this.config.panel_dimensions.left, 10)) + 'px'; 
     
    18491856      // Need to add some for t & b panels 
    18501857      var tPanel = this._panels.top; 
    1851       if ( tPanel.on && tPanel.panels.length && HTMLArea.hasDisplayedChildren(tPanel.div) ) 
     1858      if ( tPanel.on && tPanel.panels.length && Xinha.hasDisplayedChildren(tPanel.div) ) 
    18521859      { 
    18531860        this._htmlArea.style.height = (this._htmlArea.offsetHeight + parseInt(this.config.panel_dimensions.top, 10)) + 'px'; 
     
    18551862 
    18561863      var bPanel = this._panels.bottom; 
    1857       if ( bPanel.on && bPanel.panels.length && HTMLArea.hasDisplayedChildren(bPanel.div) ) 
     1864      if ( bPanel.on && bPanel.panels.length && Xinha.hasDisplayedChildren(bPanel.div) ) 
    18581865      { 
    18591866        this._htmlArea.style.height = (this._htmlArea.offsetHeight + parseInt(this.config.panel_dimensions.bottom, 10)) + 'px'; 
     
    18761883  function panel_is_alive(pan) 
    18771884  { 
    1878     if ( panels[pan].on && panels[pan].panels.length && HTMLArea.hasDisplayedChildren(panels[pan].container) ) 
     1885    if ( panels[pan].on && panels[pan].panels.length && Xinha.hasDisplayedChildren(panels[pan].container) ) 
    18791886    { 
    18801887      panels[pan].container.style.display = ''; 
     
    19171924  if ( !this._framework.tp_row.childNodes.length ) 
    19181925  { 
    1919     HTMLArea.removeFromParent(this._framework.tp_row); 
     1926    Xinha.removeFromParent(this._framework.tp_row); 
    19201927  } 
    19211928  else 
    19221929  { 
    1923     if ( !HTMLArea.hasParentNode(this._framework.tp_row) ) 
     1930    if ( !Xinha.hasParentNode(this._framework.tp_row) ) 
    19241931    { 
    19251932      this._framework.tbody.insertBefore(this._framework.tp_row, this._framework.ler_row); 
     
    19301937  if ( !this._framework.bp_row.childNodes.length ) 
    19311938  { 
    1932     HTMLArea.removeFromParent(this._framework.bp_row); 
     1939    Xinha.removeFromParent(this._framework.bp_row); 
    19331940  } 
    19341941  else 
    19351942  { 
    1936     if ( !HTMLArea.hasParentNode(this._framework.bp_row) ) 
     1943    if ( !Xinha.hasParentNode(this._framework.bp_row) ) 
    19371944    { 
    19381945      this._framework.tbody.insertBefore(this._framework.bp_row, this._framework.ler_row.nextSibling); 
     
    19431950  if ( !this.config.statusBar ) 
    19441951  { 
    1945     HTMLArea.removeFromParent(this._framework.sb_row); 
     1952    Xinha.removeFromParent(this._framework.sb_row); 
    19461953  } 
    19471954  else 
    19481955  { 
    1949     if ( !HTMLArea.hasParentNode(this._framework.sb_row) ) 
     1956    if ( !Xinha.hasParentNode(this._framework.sb_row) ) 
    19501957    { 
    19511958      this._framework.table.appendChild(this._framework.sb_row); 
     
    20022009}; 
    20032010 
    2004 HTMLArea.prototype.addPanel = function(side) 
     2011Xinha.prototype.addPanel = function(side) 
    20052012{ 
    20062013  var div = document.createElement('div'); 
     
    20112018    if(this._iframe) div.style.height = this._iframe.style.height;      
    20122019  } 
    2013   HTMLArea.addClasses(div, 'panel'); 
     2020  Xinha.addClasses(div, 'panel'); 
    20142021  this._panels[side].panels.push(div); 
    20152022  this._panels[side].div.appendChild(div); 
     
    20212028 
    20222029 
    2023 HTMLArea.prototype.removePanel = function(panel) 
     2030Xinha.prototype.removePanel = function(panel) 
    20242031{ 
    20252032  this._panels[panel.side].div.removeChild(panel); 
     
    20362043}; 
    20372044 
    2038 HTMLArea.prototype.hidePanel = function(panel) 
     2045Xinha.prototype.hidePanel = function(panel) 
    20392046{ 
    20402047  if ( panel && panel.style.display != 'none' ) 
     
    20452052}; 
    20462053 
    2047 HTMLArea.prototype.showPanel = function(panel) 
     2054Xinha.prototype.showPanel = function(panel) 
    20482055{ 
    20492056  if ( panel && panel.style.display == 'none' ) 
     
    20542061}; 
    20552062 
    2056 HTMLArea.prototype.hidePanels = function(sides) 
     2063Xinha.prototype.hidePanels = function(sides) 
    20572064{ 
    20582065  if ( typeof sides == 'undefined' ) 
     
    20732080}; 
    20742081 
    2075 HTMLArea.prototype.showPanels = function(sides) 
     2082Xinha.prototype.showPanels = function(sides) 
    20762083{ 
    20772084  if ( typeof sides == 'undefined' ) 
     
    20922099}; 
    20932100 
    2094 HTMLArea.objectProperties = function(obj) 
     2101Xinha.objectProperties = function(obj) 
    20952102{ 
    20962103  var props = []; 
     
    21092116 *  the editor). 
    21102117 */ 
    2111 HTMLArea.prototype.editorIsActivated = function() 
     2118Xinha.prototype.editorIsActivated = function() 
    21122119{ 
    21132120  try 
    21142121  { 
    2115     return HTMLArea.is_gecko? this._doc.designMode == 'on' : this._doc.body.contentEditable; 
     2122    return Xinha.is_gecko? this._doc.designMode == 'on' : this._doc.body.contentEditable; 
    21162123  } 
    21172124  catch (ex) 
     
    21212128}; 
    21222129 
    2123 HTMLArea._someEditorHasBeenActivated = false; 
    2124 HTMLArea._currentlyActiveEditor      = false; 
    2125 HTMLArea.prototype.activateEditor = function() 
     2130Xinha._someEditorHasBeenActivated = false; 
     2131Xinha._currentlyActiveEditor      = false; 
     2132Xinha.prototype.activateEditor = function() 
    21262133{ 
    21272134  // We only want ONE editor at a time to be active 
    2128   if ( HTMLArea._currentlyActiveEditor ) 
    2129   { 
    2130     if ( HTMLArea._currentlyActiveEditor == this ) 
     2135  if ( Xinha._currentlyActiveEditor ) 
     2136  { 
     2137    if ( Xinha._currentlyActiveEditor == this ) 
    21312138    { 
    21322139      return true; 
    21332140    } 
    2134     HTMLArea._currentlyActiveEditor.deactivateEditor(); 
    2135   } 
    2136  
    2137   if ( HTMLArea.is_gecko && this._doc.designMode != 'on' ) 
     2141    Xinha._currentlyActiveEditor.deactivateEditor(); 
     2142  } 
     2143 
     2144  if ( Xinha.is_gecko && this._doc.designMode != 'on' ) 
    21382145  { 
    21392146    try 
     
    21522159    } catch (ex) {} 
    21532160  } 
    2154   else if ( !HTMLArea.is_gecko && this._doc.body.contentEditable !== true ) 
     2161  else if ( !Xinha.is_gecko && this._doc.body.contentEditable !== true ) 
    21552162  { 
    21562163    this._doc.body.contentEditable = true; 
     
    21592166  // We need to know that at least one editor on the page has been activated 
    21602167  // this is because we will not focus any editor until an editor has been activated 
    2161   HTMLArea._someEditorHasBeenActivated = true; 
    2162   HTMLArea._currentlyActiveEditor      = this; 
     2168  Xinha._someEditorHasBeenActivated = true; 
     2169  Xinha._currentlyActiveEditor      = this; 
    21632170 
    21642171  var editor = this; 
     
    21662173}; 
    21672174 
    2168 HTMLArea.prototype.deactivateEditor = function() 
     2175Xinha.prototype.deactivateEditor = function() 
    21692176{ 
    21702177  // If the editor isn't active then the user shouldn't use the toolbar 
    21712178  this.disableToolbar(); 
    21722179 
    2173   if ( HTMLArea.is_gecko && this._doc.designMode != 'off' ) 
     2180  if ( Xinha.is_gecko && this._doc.designMode != 'off' ) 
    21742181  { 
    21752182    try 
     
    21782185    } catch (ex) {} 
    21792186  } 
    2180   else if ( !HTMLArea.is_gecko && this._doc.body.contentEditable !== false ) 
     2187  else if ( !Xinha.is_gecko && this._doc.body.contentEditable !== false ) 
    21812188  { 
    21822189    this._doc.body.contentEditable = false; 
    21832190  } 
    21842191 
    2185   if ( HTMLArea._currentlyActiveEditor != this ) 
     2192  if ( Xinha._currentlyActiveEditor != this ) 
    21862193  { 
    21872194    // We just deactivated an editor that wasn't marked as the currentlyActiveEditor 
     
    21922199  } 
    21932200 
    2194   HTMLArea._currentlyActiveEditor = false; 
    2195 }; 
    2196  
    2197 HTMLArea.prototype.initIframe = function() 
     2201  Xinha._currentlyActiveEditor = false; 
     2202}; 
     2203 
     2204Xinha.prototype.initIframe = function() 
    21982205{ 
    21992206  this.setLoadingMessage('Init IFrame'); 
     
    22152222    if ( !doc ) 
    22162223    { 
    2217       if ( HTMLArea.is_gecko ) 
     2224      if ( Xinha.is_gecko ) 
    22182225      { 
    22192226        setTimeout(function() { editor.initIframe(); }, 50); 
     
    22312238  } 
    22322239   
    2233   HTMLArea.freeLater(this, '_doc'); 
     2240  Xinha.freeLater(this, '_doc'); 
    22342241   
    22352242  doc.open("text/html","replace"); 
     
    22782285  { 
    22792286    html = editor.inwardHtml(editor._textArea.value); 
    2280     if ( html.match(HTMLArea.RE_doctype) ) 
     2287    if ( html.match(Xinha.RE_doctype) ) 
    22812288    { 
    22822289      editor.setDoctype(RegExp.$1); 
    2283       html = html.replace(HTMLArea.RE_doctype, ""); 
     2290      html = html.replace(Xinha.RE_doctype, ""); 
    22842291    } 
    22852292  } 
     
    22962303 * @public 
    22972304 */ 
    2298 HTMLArea.prototype.whenDocReady = function(F) 
     2305Xinha.prototype.whenDocReady = function(F) 
    22992306{ 
    23002307  var E = this; 
     
    23112318// Switches editor mode; parameter can be "textmode" or "wysiwyg".  If no 
    23122319// parameter was passed this function toggles between modes. 
    2313 HTMLArea.prototype.setMode = function(mode) 
     2320Xinha.prototype.setMode = function(mode) 
    23142321{ 
    23152322  var html; 
     
    23702377}; 
    23712378 
    2372 HTMLArea.prototype.setFullHTML = function(html) 
     2379Xinha.prototype.setFullHTML = function(html) 
    23732380{ 
    23742381  var save_multiline = RegExp.multiline; 
    23752382  RegExp.multiline = true; 
    2376   if ( html.match(HTMLArea.RE_doctype) ) 
     2383  if ( html.match(Xinha.RE_doctype) ) 
    23772384  { 
    23782385    this.setDoctype(RegExp.$1); 
    2379     html = html.replace(HTMLArea.RE_doctype, ""); 
     2386    html = html.replace(Xinha.RE_doctype, ""); 
    23802387  } 
    23812388  RegExp.multiline = save_multiline; 
    2382   if ( !HTMLArea.is_ie ) 
    2383   { 
    2384     if ( html.match(HTMLArea.RE_head) ) 
     2389  if ( !Xinha.is_ie ) 
     2390  { 
     2391    if ( html.match(Xinha.RE_head) ) 
    23852392    { 
    23862393      this._doc.getElementsByTagName("head")[0].innerHTML = RegExp.$1; 
    23872394    } 
    2388     if ( html.match(HTMLArea.RE_body) ) 
     2395    if ( html.match(Xinha.RE_body) ) 
    23892396    { 
    23902397      this._doc.getElementsByTagName("body")[0].innerHTML = RegExp.$1; 
     
    24122419}; 
    24132420 
    2414 HTMLArea.prototype.setEditorEvents = function() 
     2421Xinha.prototype.setEditorEvents = function() 
    24152422{ 
    24162423  var editor=this; 
     
    24202427    { 
    24212428      // if we have multiple editors some bug in Mozilla makes some lose editing ability 
    2422       HTMLArea._addEvents( 
     2429      Xinha._addEvents( 
    24232430        doc, 
    24242431        ["mousedown"], 
     
    24312438 
    24322439      // intercept some events; for updating the toolbar & keyboard handlers 
    2433       HTMLArea._addEvents( 
     2440      Xinha._addEvents( 
    24342441        doc, 
    24352442        ["keydown", "keypress", "mousedown", "mouseup", "drag"], 
    24362443        function (event) 
    24372444        { 
    2438           return editor._editorEvent(HTMLArea.is_ie ? editor._iframe.contentWindow.event : event); 
     2445          return editor._editorEvent(Xinha.is_ie ? editor._iframe.contentWindow.event : event); 
    24392446        } 
    24402447      ); 
     
    24442451      { 
    24452452        var plugin = editor.plugins[i].instance; 
    2446         HTMLArea.refreshPlugin(plugin); 
     2453        Xinha.refreshPlugin(plugin); 
    24472454      } 
    24482455 
     
    24532460      } 
    24542461 
    2455       HTMLArea.addDom0Event(window, 'resize', function(e) { editor.sizeEditor(); }); 
     2462      Xinha.addDom0Event(window, 'resize', function(e) { editor.sizeEditor(); }); 
    24562463      editor.removeLoadingMessage(); 
    24572464    } 
     
    24632470 ***************************************************/ 
    24642471 
    2465 // Create the specified plugin and register it with this HTMLArea 
     2472// Create the specified plugin and register it with this Xinha 
    24662473// return the plugin created to allow refresh when necessary 
    2467 HTMLArea.prototype.registerPlugin = function() 
     2474Xinha.prototype.registerPlugin = function() 
    24682475{ 
    24692476  var plugin = arguments[0]; 
     
    24882495// full-screen editor code, in order to initialize plugins with the same 
    24892496// parameters as in the opener window. 
    2490 HTMLArea.prototype.registerPlugin2 = function(plugin, args) 
     2497Xinha.prototype.registerPlugin2 = function(plugin, args) 
    24912498{ 
    24922499  // @todo : try to avoid the use of eval() 
     
    25212528 
    25222529// static function that loads the required plugin and lang file, based on the 
    2523 // language loaded already for HTMLArea.  You better make sure that the plugin 
     2530// language loaded already for Xinha.  You better make sure that the plugin 
    25242531// _has_ that language, otherwise shit might happen ;-) 
    2525 HTMLArea.getPluginDir = function(pluginName) 
     2532Xinha.getPluginDir = function(pluginName) 
    25262533{ 
    25272534  return _editor_url + "plugins/" + pluginName; 
    25282535}; 
    25292536 
    2530 HTMLArea.loadPlugin = function(pluginName, callback) 
     2537Xinha.loadPlugin = function(pluginName, callback) 
    25312538{ 
    25322539  // @todo : try to avoid the use of eval() 
     
    25452552  var plugin_file = dir + "/" + plugin; 
    25462553 
    2547   HTMLArea._loadback(plugin_file, callback ? function() { callback(pluginName); } : null); 
     2554  Xinha._loadback(plugin_file, callback ? function() { callback(pluginName); } : null); 
    25482555  return false; 
    25492556}; 
    25502557 
    2551 HTMLArea._pluginLoadStatus = {}; 
    2552 HTMLArea._browserSpecificFunctionsLoaded = false; 
    2553 HTMLArea.loadPlugins = function(plugins, callbackIfNotReady) 
     2558Xinha._pluginLoadStatus = {}; 
     2559Xinha._browserSpecificFunctionsLoaded = false; 
     2560Xinha.loadPlugins = function(plugins, callbackIfNotReady) 
    25542561{ 
    25552562  // Rip the ones that are loaded and look for ones that have failed 
    25562563  var retVal = true; 
    2557   var nuPlugins = HTMLArea.cloneObject(plugins); 
    2558  
    2559   if ( !HTMLArea._browserSpecificFunctionsLoaded ) 
    2560   { 
    2561         if (HTMLArea.is_ie) 
     2564  var nuPlugins = Xinha.cloneObject(plugins); 
     2565 
     2566  if ( !Xinha._browserSpecificFunctionsLoaded ) 
     2567  { 
     2568        if (Xinha.is_ie) 
    25622569        { 
    2563                 HTMLArea._loadback(_editor_url + "functionsIE.js",callbackIfNotReady); 
     2570                Xinha._loadback(_editor_url + "functionsIE.js",callbackIfNotReady); 
    25642571        } 
    25652572        else 
    25662573        { 
    2567                 HTMLArea._loadback(_editor_url + "functionsMozilla.js",callbackIfNotReady); 
     2574                Xinha._loadback(_editor_url + "functionsMozilla.js",callbackIfNotReady); 
    25682575        } 
    25692576        return false; 
     
    25722579  { 
    25732580    var p = nuPlugins.pop(); 
    2574     if ( typeof HTMLArea._pluginLoadStatus[p] == 'undefined' ) 
     2581    if ( typeof Xinha._pluginLoadStatus[p] == 'undefined' ) 
    25752582    { 
    25762583      // Load it 
    2577       HTMLArea._pluginLoadStatus[p] = 'loading'; 
    2578       HTMLArea.loadPlugin(p, 
     2584      Xinha._pluginLoadStatus[p] = 'loading'; 
     2585      Xinha.loadPlugin(p, 
    25792586        function(plugin) 
    25802587        { 
     
    25822589          if ( eval('typeof ' + plugin) != 'undefined' ) 
    25832590          { 
    2584             HTMLArea._pluginLoadStatus[plugin] = 'ready'; 
     2591            Xinha._pluginLoadStatus[plugin] = 'ready'; 
    25852592          } 
    25862593          else 
     
    25912598            // unfortunatly that means we can't fail plugins gracefully 
    25922599            // by just skipping them. 
    2593             HTMLArea._pluginLoadStatus[plugin] = 'failed'; 
     2600            Xinha._pluginLoadStatus[plugin] = 'failed'; 
    25942601          } 
    25952602        } 
     
    26002607    { 
    26012608      // @todo: a simple (if) would not be better than this tortuous (switch) structure ? 
    2602       // if ( HTMLArea._pluginLoadStatus[p] !== 'failed' && HTMLArea._pluginLoadStatus[p] !== 'ready' ) 
     2609      // if ( Xinha._pluginLoadStatus[p] !== 'failed' && Xinha._pluginLoadStatus[p] !== 'ready' ) 
    26032610      // { 
    26042611      //   retVal = false; 
    26052612      // } 
    2606       switch ( HTMLArea._pluginLoadStatus[p] ) 
     2613      switch ( Xinha._pluginLoadStatus[p] ) 
    26072614      { 
    26082615        case 'failed': 
     
    26282635  if ( callbackIfNotReady ) 
    26292636  { 
    2630     setTimeout(function() { if ( HTMLArea.loadPlugins(plugins, callbackIfNotReady) ) { callbackIfNotReady(); } }, 150); 
     2637    setTimeout(function() { if ( Xinha.loadPlugins(plugins, callbackIfNotReady) ) { callbackIfNotReady(); } }, 150); 
    26312638  } 
    26322639  return retVal; 
     
    26342641 
    26352642// refresh plugin by calling onGenerate or onGenerateOnce method. 
    2636 HTMLArea.refreshPlugin = function(plugin) 
     2643Xinha.refreshPlugin = function(plugin) 
    26372644{ 
    26382645  if ( plugin && typeof plugin.onGenerate == "function" ) 
     
    26472654}; 
    26482655 
    2649 HTMLArea.loadStyle = function(style, plugin) 
     2656Xinha.loadStyle = function(style, plugin) 
    26502657{ 
    26512658  var url = _editor_url || ''; 
     
    26712678  //document.write("<style type='text/css'>@import url(" + url + ");</style>"); 
    26722679}; 
    2673 HTMLArea.loadStyle(typeof _editor_css == "string" ? _editor_css : "htmlarea.css"); 
     2680Xinha.loadStyle(typeof _editor_css == "string" ? _editor_css : "Xinha.css"); 
    26742681 
    26752682/*************************************************** 
     
    26772684 ***************************************************/ 
    26782685 
    2679 HTMLArea.prototype.debugTree = function() 
     2686Xinha.prototype.debugTree = function() 
    26802687{ 
    26812688  var ta = document.createElement("textarea"); 
     
    26942701  { 
    26952702    var tag = root.tagName.toLowerCase(), i; 
    2696     var ns = HTMLArea.is_ie ? root.scopeName : root.prefix; 
     2703    var ns = Xinha.is_ie ? root.scopeName : root.prefix; 
    26972704    debug(level, "- " + tag + " [" + ns + "]"); 
    26982705    for ( i = root.firstChild; i; i = i.nextSibling ) 
     
    27082715}; 
    27092716 
    2710 HTMLArea.getInnerText = function(el) 
     2717Xinha.getInnerText = function(el) 
    27112718{ 
    27122719  var txt = '', i; 
     
    27192726    else if ( i.nodeType == 1 ) 
    27202727    { 
    2721       txt += HTMLArea.getInnerText(i); 
     2728      txt += Xinha.getInnerText(i); 
    27222729    } 
    27232730  } 
     
    27252732}; 
    27262733 
    2727 HTMLArea.prototype._wordClean = function() 
     2734Xinha.prototype._wordClean = function() 
    27282735{ 
    27292736  var editor = this; 
     
    27472754  function showStats() 
    27482755  { 
    2749     var txt = "HTMLArea word cleaner stats: \n\n"; 
     2756    var txt = "Xinha word cleaner stats: \n\n"; 
    27502757    for ( var i in stats ) 
    27512758    { 
     
    27902797 
    27912798  var stripTag = null; 
    2792   if ( HTMLArea.is_ie ) 
     2799  if ( Xinha.is_ie ) 
    27932800  { 
    27942801    stripTag = function(el) 
    27952802    { 
    2796       el.outerHTML = HTMLArea.htmlEncode(el.innerText); 
     2803      el.outerHTML = Xinha.htmlEncode(el.innerText); 
    27972804      ++stats.mso_xmlel; 
    27982805    }; 
     
    28022809    stripTag = function(el) 
    28032810    { 
    2804       var txt = document.createTextNode(HTMLArea.getInnerText(el)); 
     2811      var txt = document.createTextNode(Xinha.getInnerText(el)); 
    28052812      el.parentNode.insertBefore(txt, el); 
    2806       HTMLArea.removeFromParent(el); 
     2813      Xinha.removeFromParent(el); 
    28072814      ++stats.mso_xmlel; 
    28082815    }; 
     
    28152822    if ( /^(a|span|b|strong|i|em|font)$/i.test(el.tagName) && !el.firstChild) 
    28162823    { 
    2817       HTMLArea.removeFromParent(el); 
     2824      Xinha.removeFromParent(el); 
    28182825      ++stats.empty_tags; 
    28192826    } 
     
    28242831    var tag = root.tagName.toLowerCase(), i, next; 
    28252832    // @todo : probably better to use String.indexOf() instead of this ugly regex 
    2826     // if ((HTMLArea.is_ie && root.scopeName != 'HTML') || (!HTMLArea.is_ie && tag.indexOf(':') !== -1)) { 
    2827     if ( ( HTMLArea.is_ie && root.scopeName != 'HTML' ) || ( !HTMLArea.is_ie && ( /:/.test(tag) ) ) ) 
     2833    // if ((Xinha.is_ie && root.scopeName != 'HTML') || (!Xinha.is_ie && tag.indexOf(':') !== -1)) { 
     2834    if ( ( Xinha.is_ie && root.scopeName != 'HTML' ) || ( !Xinha.is_ie && ( /:/.test(tag) ) ) ) 
    28282835    { 
    28292836      stripTag(root); 
     
    28542861}; 
    28552862 
    2856 HTMLArea.prototype._clearFonts = function() 
     2863Xinha.prototype._clearFonts = function() 
    28572864{ 
    28582865  var D = this.getInnerHTML(); 
    28592866 
    2860   if ( confirm(HTMLArea._lc("Would you like to clear font typefaces?")) ) 
     2867  if ( confirm(Xinha._lc("Would you like to clear font typefaces?")) ) 
    28612868  { 
    28622869    D = D.replace(/face="[^"]*"/gi, ''); 
     
    28642871  } 
    28652872 
    2866   if ( confirm(HTMLArea._lc("Would you like to clear font sizes?")) ) 
     2873  if ( confirm(Xinha._lc("Would you like to clear font sizes?")) ) 
    28672874  { 
    28682875    D = D.replace(/size="[^"]*"/gi, ''); 
     
    28702877  } 
    28712878 
    2872   if ( confirm(HTMLArea._lc("Would you like to clear font colours?")) ) 
     2879  if ( confirm(Xinha._lc("Would you like to clear font colours?")) ) 
    28732880  { 
    28742881    D = D.replace(/color="[^"]*"/gi, ''); 
     
    28822889}; 
    28832890 
    2884 HTMLArea.prototype._splitBlock = function() 
     2891Xinha.prototype._splitBlock = function() 
    28852892{ 
    28862893  this._doc.execCommand('formatblock', false, 'div'); 
    28872894}; 
    28882895 
    2889 HTMLArea.prototype.forceRedraw = function() 
     2896Xinha.prototype.forceRedraw = function() 
    28902897{ 
    28912898  this._doc.body.style.visibility = "hidden"; 
     
    28952902 
    28962903// focuses the iframe window.  returns a reference to the editor document. 
    2897 HTMLArea.prototype.focusEditor = function() 
     2904Xinha.prototype.focusEditor = function() 
    28982905{ 
    28992906  switch (this._editMode) 
     
    29062913      { 
    29072914        // We don't want to focus the field unless at least one field has been activated. 
    2908         if ( HTMLArea._someEditorHasBeenActivated ) 
     2915        if ( Xinha._someEditorHasBeenActivated ) 
    29092916        { 
    29102917          this.activateEditor(); // Ensure *this* editor is activated 
     
    29262933 
    29272934// takes a snapshot of the current text (for undo) 
    2928 HTMLArea.prototype._undoTakeSnapshot = function() 
     2935Xinha.prototype._undoTakeSnapshot = function() 
    29292936{ 
    29302937  ++this._undoPos; 
     
    29522959}; 
    29532960 
    2954 HTMLArea.prototype.undo = function() 
     2961Xinha.prototype.undo = function() 
    29552962{ 
    29562963  if ( this._undoPos > 0 ) 
     
    29682975}; 
    29692976 
    2970 HTMLArea.prototype.redo = function() 
     2977Xinha.prototype.redo = function() 
    29712978{ 
    29722979  if ( this._undoPos < this._undoQueue.length - 1 ) 
     
    29842991}; 
    29852992 
    2986 HTMLArea.prototype.disableToolbar = function(except) 
     2993Xinha.prototype.disableToolbar = function(except) 
    29872994{ 
    29882995  if ( this._timerToolbar ) 
     
    30153022}; 
    30163023 
    3017 HTMLArea.prototype.enableToolbar = function() 
     3024Xinha.prototype.enableToolbar = function() 
    30183025{ 
    30193026  this.updateToolbar(); 
     
    30553062// It is actually to heavy to be understable and very scary to manipulate 
    30563063// updates enabled/disable/active state of the toolbar elements 
    3057 HTMLArea.prototype.updateToolbar = function(noStatus) 
     3064Xinha.prototype.updateToolbar = function(noStatus) 
    30583065{ 
    30593066  var doc = this._doc; 
     
    30653072    if ( this.config.statusBar && !noStatus ) 
    30663073    { 
    3067       this._statusBarTree.innerHTML = HTMLArea._lc("Path") + ": "; // clear 
     3074      this._statusBarTree.innerHTML = Xinha._lc("Path") + ": "; // clear 
    30683075      for ( var i = ancestors.length; --i >= 0; ) 
    30693076      { 
     
    30813088        a.el = el; 
    30823089        a.editor = this; 
    3083         HTMLArea.addDom0Event( 
     3090        Xinha.addDom0Event( 
    30843091          a, 
    30853092          'click', 
     
    30913098          } 
    30923099        ); 
    3093         HTMLArea.addDom0Event( 
     3100        Xinha.addDom0Event( 
    30943101          a, 
    30953102          'contextmenu', 
     
    32563263          { 
    32573264            var style = btn.element.style; 
    3258             style.backgroundColor = HTMLArea._makeColor(doc.queryCommandValue(HTMLArea.is_ie ? "backcolor" : "hilitecolor")); 
     3265            style.backgroundColor = Xinha._makeColor(doc.queryCommandValue(Xinha.is_ie ? "backcolor" : "hilitecolor")); 
    32593266            if ( /transparent/i.test(style.backgroundColor) ) 
    32603267            { 
    32613268              // Mozilla 
    3262               style.backgroundColor = HTMLArea._makeColor(doc.queryCommandValue("backcolor")); 
     3269              style.backgroundColor = Xinha._makeColor(doc.queryCommandValue("backcolor")); 
    32633270            } 
    3264             style.color = HTMLArea._makeColor(doc.queryCommandValue("forecolor")); 
     3271            style.color = Xinha._makeColor(doc.queryCommandValue("forecolor")); 
    32653272            style.fontFamily = doc.queryCommandValue("fontname"); 
    32663273            style.fontWeight = doc.queryCommandState("bold") ? "bold" : "normal"; 
     
    32793286      case "righttoleft": 
    32803287        var eltBlock = this.getParentElement(); 
    3281         while ( eltBlock && !HTMLArea.isBlockElement(eltBlock) ) 
     3288        while ( eltBlock && !Xinha.isBlockElement(eltBlock) ) 
    32823289        { 
    32833290          eltBlock = eltBlock.parentNode; 
     
    33143321  //  might solve the problem, whatever the hell it was.  I'm going senile, I'm sure. 
    33153322  // @todo : since this part is disabled since a long time, does it still need to be in the source ? 
    3316   if( 0 && HTMLArea.is_gecko ) 
     3323  if( 0 && Xinha.is_gecko ) 
    33173324  { 
    33183325    var s = this._getSelection(); 
     
    33233330         s.anchorNode.nodeType == 3 && s.anchorOffset == s.anchorNode.length && 
    33243331         !( s.anchorNode.parentNode.nextSibling && s.anchorNode.parentNode.nextSibling.nodeType == 3 ) && 
    3325          !HTMLArea.isBlockElement(s.anchorNode.parentNode) ) 
     3332         !Xinha.isBlockElement(s.anchorNode.parentNode) ) 
    33263333    { 
    33273334      // Insert hair-width-space after the close tag if there isn't another text node on the other side 
     
    33493356 
    33503357 
    3351 // moved HTMLArea.prototype.insertNodeAtSelection() to browser specific file 
    3352 // moved HTMLArea.prototype.getParentElement() to browser specific file 
     3358// moved Xinha.prototype.insertNodeAtSelection() to browser specific file 
     3359// moved Xinha.prototype.getParentElement() to browser specific file 
    33533360 
    33543361// Returns an array with all the ancestor nodes of the selection. 
    3355 HTMLArea.prototype.getAllAncestors = function() 
     3362Xinha.prototype.getAllAncestors = function() 
    33563363{ 
    33573364  var p = this.getParentElement(); 
     
    33673374 
    33683375// Returns the deepest ancestor of the selection that is of the current type 
    3369 HTMLArea.prototype._getFirstAncestor = function(sel, types) 
     3376Xinha.prototype._getFirstAncestor = function(sel, types) 
    33703377{ 
    33713378  var prnt = this._activeElement(sel); 
     
    33743381    try 
    33753382    { 
    3376       prnt = (HTMLArea.is_ie ? this._createRange(sel).parentElement() : this._createRange(sel).commonAncestorContainer); 
     3383      prnt = (Xinha.is_ie ? this._createRange(sel).parentElement() : this._createRange(sel).commonAncestorContainer); 
    33773384    } 
    33783385    catch(ex) 
     
    34143421}; 
    34153422 
    3416 // moved HTMLArea.prototype._activeElement() to browser specific file 
    3417 // moved HTMLArea.prototype._selectionEmpty() to browser specific file 
    3418  
    3419 HTMLArea.prototype._getAncestorBlock = function(sel) 
     3423// moved Xinha.prototype._activeElement() to browser specific file 
     3424// moved Xinha.prototype._selectionEmpty() to browser specific file 
     3425 
     3426Xinha.prototype._getAncestorBlock = function(sel) 
    34203427{ 
    34213428  // Scan upwards to find a block level element that we can change or apply to 
    3422   var prnt = (HTMLArea.is_ie ? this._createRange(sel).parentElement : this._createRange(sel).commonAncestorContainer); 
     3429  var prnt = (Xinha.is_ie ? this._createRange(sel).parentElement : this._createRange(sel).commonAncestorContainer); 
    34233430 
    34243431  while ( prnt && ( prnt.nodeType == 1 ) ) 
     
    34633470}; 
    34643471 
    3465 HTMLArea.prototype._createImplicitBlock = function(type) 
     3472Xinha.prototype._createImplicitBlock = function(type) 
    34663473{ 
    34673474  // expand it until we reach a block element in either direction 
    34683475  // then wrap the selection in a block and return 
    34693476  var sel = this._getSelection(); 
    3470   if ( HTMLArea.is_ie ) 
     3477  if ( Xinha.is_ie ) 
    34713478  { 
    34723479    sel.empty(); 
     
    34853492 
    34863493 
    3487 // moved HTMLArea.prototype.selectNodeContents() to browser specific file 
    3488 // moved HTMLArea.prototype.insertHTML() to browser specific file 
     3494// moved Xinha.prototype.selectNodeContents() to browser specific file 
     3495// moved Xinha.prototype.insertHTML() to browser specific file 
    34893496 
    34903497/** 
     
    34933500 * @todo: when will it be deprecated ? Can it be removed already ? 
    34943501 */ 
    3495 HTMLArea.prototype.surroundHTML = function(startTag, endTag) 
     3502Xinha.prototype.surroundHTML = function(startTag, endTag) 
    34963503{ 
    34973504  var html = this.getSelectedHTML(); 
     
    35003507}; 
    35013508 
    3502 // moved  HTMLArea.prototype.getSelectedHTML() to browser specific file 
     3509// moved  Xinha.prototype.getSelectedHTML() to browser specific file 
    35033510 
    35043511/// Return true if we have some selection 
    3505 HTMLArea.prototype.hasSelectedText = function() 
     3512Xinha.prototype.hasSelectedText = function() 
    35063513{ 
    35073514  // FIXME: come _on_ mishoo, you can do better than this ;-) 
     
    35093516}; 
    35103517 
    3511 // moved HTMLArea.prototype._createLink() to popups/link.js 
    3512 // moved HTMLArea.prototype._insertImage() to popups/insert_image.js 
     3518// moved Xinha.prototype._createLink() to popups/link.js 
     3519// moved Xinha.prototype._insertImage() to popups/insert_image.js 
    35133520 
    35143521// Called when the user clicks the Insert Table button 
    3515 HTMLArea.prototype._insertTable = function() 
     3522Xinha.prototype._insertTable = function() 
    35163523{ 
    35173524  var sel = this._getSelection(); 
     
    35823589        } 
    35833590      } 
    3584       if ( HTMLArea.is_ie ) 
     3591      if ( Xinha.is_ie ) 
    35853592      { 
    35863593        range.pasteHTML(table.outerHTML); 
     
    36033610// el is reference to the SELECT object 
    36043611// txt is the name of the select field, as in config.toolbar 
    3605 HTMLArea.prototype._comboSelected = function(el, txt) 
     3612Xinha.prototype._comboSelected = function(el, txt) 
    36063613{ 
    36073614  this.focusEditor(); 
     
    36203627        break; 
    36213628      } 
    3622       if( !HTMLArea.is_gecko || value !== 'blockquote' ) 
     3629      if( !Xinha.is_gecko || value !== 'blockquote' ) 
    36233630      { 
    36243631        value = "<" + value + ">"; 
     
    36473654 * @private 
    36483655 */ 
    3649 HTMLArea.prototype._colorSelector = function(cmdID) 
     3656Xinha.prototype._colorSelector = function(cmdID) 
    36503657{ 
    36513658  var editor = this;    // for nested functions 
     
    36533660  if ( typeof colorPicker == 'undefined' ) 
    36543661  { 
    3655     HTMLArea._loadback(_editor_url + 'popups/color_picker.js', function () {editor._colorSelector(cmdID)}); 
     3662    Xinha._loadback(_editor_url + 'popups/color_picker.js', function () {editor._colorSelector(cmdID)}); 
    36563663    return false; 
    36573664  } 
     
    36613668  if ( cmdID == 'hilitecolor' ) 
    36623669  { 
    3663     if ( HTMLArea.is_ie ) 
     3670    if ( Xinha.is_ie ) 
    36643671    { 
    36653672      cmdID = 'backcolor'; 
    3666       initcolor = HTMLArea._colorToRgb(editor._doc.queryCommandValue("backcolor")); 
     3673      initcolor = Xinha._colorToRgb(editor._doc.queryCommandValue("backcolor")); 
    36673674    } 
    36683675    else 
    36693676    { 
    3670       initcolor = HTMLArea._colorToRgb(editor._doc.queryCommandValue("hilitecolor")); 
     3677      initcolor = Xinha._colorToRgb(editor._doc.queryCommandValue("hilitecolor")); 
    36713678    } 
    36723679    // @todo : useCSS is deprecated, see ticket #619 
    36733680    //[wymsy]: mozilla bug #279330 has been fixed, I don't think we need this any more 
    3674   /*  if ( HTMLArea.is_gecko ) 
     3681  /*  if ( Xinha.is_gecko ) 
    36753682    { 
    36763683      try 
     
    36823689  else 
    36833690  { 
    3684         initcolor = HTMLArea._colorToRgb(editor._doc.queryCommandValue("forecolor")); 
     3691        initcolor = Xinha._colorToRgb(editor._doc.queryCommandValue("forecolor")); 
    36853692  } 
    36863693  var cback = function(color) { editor._doc.execCommand(cmdID, false, color); }; 
    3687   if ( HTMLArea.is_ie ) 
     3694  if ( Xinha.is_ie ) 
    36883695  { 
    36893696    var range = editor._createRange(editor._getSelection()); 
     
    37073714// the execCommand function (intercepts some commands and replaces them with 
    37083715// our own implementation) 
    3709 HTMLArea.prototype.execCommand = function(cmdID, UI, param) 
     3716Xinha.prototype.execCommand = function(cmdID, UI, param) 
    37103717{ 
    37113718  var editor = this;    // for nested functions 
     
    37133720  cmdID = cmdID.toLowerCase(); 
    37143721  // @todo : useCSS is deprecated, see ticket #619 
    3715   if ( HTMLArea.is_gecko ) 
     3722  if ( Xinha.is_gecko ) 
    37163723  { 
    37173724    try 
     
    37803787    catch (ex) 
    37813788    { 
    3782       if ( HTMLArea.is_gecko ) 
    3783       { 
    3784         alert(HTMLArea._lc("The Paste button does not work in Mozilla based web browsers (technical security reasons). Press CTRL-V on your keyboard to paste directly.")); 
     3789      if ( Xinha.is_gecko ) 
     3790      { 
     3791        alert(Xinha._lc("The Paste button does not work in Mozilla based web browsers (technical security reasons). Press CTRL-V on your keyboard to paste directly.")); 
    37853792      } 
    37863793    } 
     
    37943801      var dir = (cmdID == "righttoleft") ? "rtl" : "ltr"; 
    37953802      var el = this.getParentElement(); 
    3796       while ( el && !HTMLArea.isBlockElement(el) ) 
     3803      while ( el && !Xinha.isBlockElement(el) ) 
    37973804      { 
    37983805        el = el.parentNode; 
     
    38323839 * @todo: this function is *TOO* generic, it needs to be splitted in more specific handlers 
    38333840 * This function also handles key bindings. */ 
    3834 HTMLArea.prototype._editorEvent = function(ev) 
     3841Xinha.prototype._editorEvent = function(ev) 
    38353842{ 
    38363843  var editor = this; 
    3837   var keyEvent = (HTMLArea.is_ie && ev.type == "keydown") || (!HTMLArea.is_ie && ev.type == "keypress"); 
     3844  var keyEvent = (Xinha.is_ie && ev.type == "keydown") || (!Xinha.is_ie && ev.type == "keypress"); 
    38383845 
    38393846  //call events of textarea 
     
    38433850  } 
    38443851 
    3845   if ( HTMLArea.is_gecko && keyEvent && ev.ctrlKey &&  this._unLink && this._unlinkOnUndo ) 
     3852  if ( Xinha.is_gecko && keyEvent && ev.ctrlKey &&  this._unLink && this._unlinkOnUndo ) 
    38463853  { 
    38473854    if ( String.fromCharCode(ev.charCode).toLowerCase() == 'z' ) 
    38483855    { 
    3849       HTMLArea._stopEvent(ev); 
     3856      Xinha._stopEvent(ev); 
    38503857      this._unLink(); 
    38513858      editor.updateToolbar(); 
     
    38933900 
    38943901// handles ctrl + key shortcuts  
    3895 HTMLArea.prototype._shortCuts = function (ev) 
     3902Xinha.prototype._shortCuts = function (ev) 
    38963903{ 
    38973904  var editor = this; 
    38983905  var sel = null; 
    38993906  var range = null; 
    3900   var key = String.fromCharCode(HTMLArea.is_ie ? ev.keyCode : ev.charCode).toLowerCase(); 
     3907  var key = String.fromCharCode(Xinha.is_ie ? ev.keyCode : ev.charCode).toLowerCase(); 
    39013908  var cmd = null; 
    39023909  var value = null; 
     
    39043911  { 
    39053912    case 'a': 
    3906     if ( !HTMLArea.is_ie ) 
     3913    if ( !Xinha.is_ie ) 
    39073914    { 
    39083915      // KEY select all 
     
    39123919      range.selectNodeContents(this._doc.body); 
    39133920      sel.addRange(range); 
    3914       HTMLArea._stopEvent(ev); 
     3921      Xinha._stopEvent(ev); 
    39153922    } 
    39163923    break; 
     
    39293936    case 'y': cmd = "redo"; break; 
    39303937    case 'v': 
    3931     if ( HTMLArea.is_ie || editor.config.htmlareaPaste ) 
     3938    if ( Xinha.is_ie || editor.config.htmlareaPaste ) 
    39323939    { 
    39333940      cmd = "paste"; 
     
    39363943    case 'n': 
    39373944    cmd = "formatblock"; 
    3938     value = HTMLArea.is_ie ? "<p>" : "p"; 
     3945    value = Xinha.is_ie ? "<p>" : "p"; 
    39393946    break; 
    39403947 
     
    39503957    cmd = "formatblock"; 
    39513958    value = "h" + key; 
    3952     if ( HTMLArea.is_ie ) 
     3959    if ( Xinha.is_ie ) 
    39533960    { 
    39543961      value = "<" + value + ">"; 
     
    39603967    // execute simple command 
    39613968    this.execCommand(cmd, false, value); 
    3962     HTMLArea._stopEvent(ev); 
    3963   } 
    3964 }; 
    3965  
    3966 HTMLArea.prototype.convertNode = function(el, newTagName) 
     3969    Xinha._stopEvent(ev); 
     3970  } 
     3971}; 
     3972 
     3973Xinha.prototype.convertNode = function(el, newTagName) 
    39673974{ 
    39683975  var newel = this._doc.createElement(newTagName); 
     
    39743981}; 
    39753982 
    3976 // moved HTMLArea.prototype.checkBackspace() to browser specific file 
     3983// moved Xinha.prototype.checkBackspace() to browser specific file 
    39773984 
    39783985/** The idea here is 
     
    39934000 */ 
    39944001 
    3995 HTMLArea.prototype.dom_checkInsertP = function() 
     4002Xinha.prototype.dom_checkInsertP = function() 
    39964003{ 
    39974004  var p, body; 
     
    40334040  for ( var i = 0; i < p.length; ++i ) 
    40344041  { 
    4035     if ( HTMLArea.isParaContainer(p[i]) ) 
     4042    if ( Xinha.isParaContainer(p[i]) ) 
    40364043    { 
    40374044      break; 
    40384045    } 
    4039     else if ( HTMLArea.isBlockElement(p[i]) && ! ( /body|html/i.test(p[i].tagName) ) ) 
     4046    else if ( Xinha.isBlockElement(p[i]) && ! ( /body|html/i.test(p[i].tagName) ) ) 
    40404047    { 
    40414048      block = p[i]; 
     
    40514058    // node just before any of the paragraph containers. 
    40524059    var wrap = range.startContainer; 
    4053     while ( wrap.parentNode && !HTMLArea.isParaContainer(wrap.parentNode) ) 
     4060    while ( wrap.parentNode && !Xinha.isParaContainer(wrap.parentNode) ) 
    40544061    { 
    40554062      wrap = wrap.parentNode; 
     
    40644071      if ( start.previousSibling.tagName ) 
    40654072      { 
    4066         if ( !HTMLArea.isBlockElement(start.previousSibling) ) 
     4073        if ( !Xinha.isBlockElement(start.previousSibling) ) 
    40674074        { 
    40684075          start = start.previousSibling; 
     
    40844091      if ( end.nextSibling.tagName ) 
    40854092      { 
    4086         if ( !HTMLArea.isBlockElement(end.nextSibling) ) 
     4093        if ( !Xinha.isBlockElement(end.nextSibling) ) 
    40874094        { 
    40884095          end = end.nextSibling; 
     
    41874194}; 
    41884195 
    4189 HTMLArea.prototype.scrollToElement = function(e) 
    4190 { 
    4191   if ( HTMLArea.is_gecko ) 
     4196Xinha.prototype.scrollToElement = function(e) 
     4197{ 
     4198  if ( Xinha.is_gecko ) 
    41924199  { 
    41934200    var top  = 0; 
     
    42114218 
    42124219// retrieve the HTML 
    4213 HTMLArea.prototype.getHTML = function() 
     4220Xinha.prototype.getHTML = function() 
    42144221{ 
    42154222  var html = ''; 
     
    42194226      if ( !this.config.fullPage ) 
    42204227      { 
    4221         html = HTMLArea.getHTML(this._doc.body, false, this); 
     4228        html = Xinha.getHTML(this._doc.body, false, this); 
    42224229      } 
    42234230      else 
    42244231      { 
    4225         html = this.doctype + "\n" + HTMLArea.getHTML(this._doc.documentElement, true, this); 
     4232        html = this.doctype + "\n" + Xinha.getHTML(this._doc.documentElement, true, this); 
    42264233      } 
    42274234    break; 
     
    42364243}; 
    42374244 
    4238 HTMLArea.prototype.outwardHtml = function(html) 
     4245Xinha.prototype.outwardHtml = function(html) 
    42394246{ 
    42404247  html = html.replace(/<(\/?)b(\s|>|\/)/ig, "<$1strong$2"); 
     
    42684275  // so we strip it out.  Original submitter gave a plugin, but that's 
    42694276  // a bit much just for this IMHO - james 
    4270   if ( HTMLArea.is_gecko ) 
     4277  if ( Xinha.is_gecko ) 
    42714278  { 
    42724279    html = html.replace(/<script[\s]*src[\s]*=[\s]*['"]chrome:\/\/.*?["']>[\s]*<\/script>/ig, ''); 
     
    42784285}; 
    42794286 
    4280 HTMLArea.prototype.inwardHtml = function(html) 
     4287Xinha.prototype.inwardHtml = function(html) 
    42814288{ 
    42824289  // Midas uses b and i instead of strong and em, um, hello, 
    42834290  // mozilla, this is the 21st century calling! 
    4284   if ( HTMLArea.is_gecko ) 
     4291  if ( Xinha.is_gecko ) 
    42854292  { 
    42864293    html = html.replace(/<(\/?)strong(\s|>|\/)/ig, "<$1b$2"); 
     
    43074314}; 
    43084315 
    4309 HTMLArea.prototype.outwardSpecialReplacements = function(html) 
     4316Xinha.prototype.outwardSpecialReplacements = function(html) 
    43104317{ 
    43114318  for ( var i in this.config.specialReplacements ) 
     
    43194326    }  
    43204327    // alert('out : ' + from + '=>' + to); 
    4321     var reg = new RegExp(from.replace(HTMLArea.RE_Specials, '\\$1'), 'g'); 
     4328    var reg = new RegExp(from.replace(Xinha.RE_Specials, '\\$1'), 'g'); 
    43224329    html = html.replace(reg, to.replace(/\$/g, '$$$$')); 
    43234330    //html = html.replace(from, to); 
     
    43264333}; 
    43274334 
    4328 HTMLArea.prototype.inwardSpecialReplacements = function(html) 
     4335Xinha.prototype.inwardSpecialReplacements = function(html) 
    43294336{ 
    43304337  // alert("inward"); 
     
    43424349    // html = html.replace(reg, to); 
    43434350    // html = html.replace(from, to); 
    4344     var reg = new RegExp(from.replace(HTMLArea.RE_Specials, '\\$1'), 'g'); 
     4351    var reg = new RegExp(from.replace(Xinha.RE_Specials, '\\$1'), 'g'); 
    43454352    html = html.replace(reg, to.replace(/\$/g, '$$$$')); // IE uses doubled dollar signs to escape backrefs, also beware that IE also implements $& $_ and $' like perl. 
    43464353  } 
     
    43494356 
    43504357 
    4351 HTMLArea.prototype.fixRelativeLinks = function(html) 
     4358Xinha.prototype.fixRelativeLinks = function(html) 
    43524359{ 
    43534360  if ( typeof this.config.expandRelativeUrl != 'undefined' && this.config.expandRelativeUrl )  
     
    43664373        base_m = b.match( relPath ); 
    43674374        absPath = url[2].replace(/(\.\.\/)*/,base_m[1]); 
    4368         html = html.replace( new RegExp(url[2].replace( HTMLArea.RE_Specials, '\\$1' ) ),absPath ); 
     4375        html = html.replace( new RegExp(url[2].replace( Xinha.RE_Specials, '\\$1' ) ),absPath ); 
    43694376      } 
    43704377    } 
     
    43734380  if ( typeof this.config.stripSelfNamedAnchors != 'undefined' && this.config.stripSelfNamedAnchors ) 
    43744381  { 
    4375     var stripRe = new RegExp(document.location.href.replace(/&/g,'&amp;').replace(HTMLArea.RE_Specials, '\\$1') + '(#[^\'" ]*)', 'g'); 
     4382    var stripRe = new RegExp(document.location.href.replace(/&/g,'&amp;').replace(Xinha.RE_Specials, '\\$1') + '(#[^\'" ]*)', 'g'); 
    43764383    html = html.replace(stripRe, '$1'); 
    43774384  } 
     
    43824389    if ( typeof this.config.baseHref != 'undefined' && this.config.baseHref !== null ) 
    43834390    { 
    4384       baseRe = new RegExp( "((href|src|background)=\")(" + this.config.baseHref.replace( HTMLArea.RE_Specials, '\\$1' ) + ")", 'g' ); 
     4391      baseRe = new RegExp( "((href|src|background)=\")(" + this.config.baseHref.replace( Xinha.RE_Specials, '\\$1' ) + ")", 'g' ); 
    43854392    } 
    43864393    else 
    43874394    { 
    4388       baseRe = new RegExp( "((href|src|background)=\")(" + document.location.href.replace( /([^\/]*\/?)$/, '' ).replace( HTMLArea.RE_Specials, '\\$1' ) + ")", 'g' ); 
     4395      baseRe = new RegExp( "((href|src|background)=\")(" + document.location.href.replace( /([^\/]*\/?)$/, '' ).replace( Xinha.RE_Specials, '\\$1' ) + ")", 'g' ); 
    43894396    } 
    43904397 
     
    43924399  } 
    43934400 
    4394 //  if ( HTMLArea.is_ie ) 
     4401//  if ( Xinha.is_ie ) 
    43954402//  { 
    43964403    // This is now done in inward & outward 
     
    44064413 
    44074414// retrieve the HTML (fastest version, but uses innerHTML) 
    4408 HTMLArea.prototype.getInnerHTML = function() 
     4415Xinha.prototype.getInnerHTML = function() 
    44094416{ 
    44104417  if ( !this._doc.body ) 
     
    44384445 
    44394446// completely change the HTML inside 
    4440 HTMLArea.prototype.setHTML = function(html) 
     4447Xinha.prototype.setHTML = function(html) 
    44414448{ 
    44424449  if ( !this.config.fullPage ) 
     
    44524459 
    44534460// sets the given doctype (useful when config.fullPage is true) 
    4454 HTMLArea.prototype.setDoctype = function(doctype) 
     4461Xinha.prototype.setDoctype = function(doctype) 
    44554462{ 
    44564463  this.doctype = doctype; 
     
    44624469 
    44634470// variable used to pass the object to the popup editor window. 
    4464 HTMLArea._object = null; 
     4471Xinha._object = null; 
    44654472 
    44664473// function that returns a clone of the given object 
    4467 HTMLArea.cloneObject = function(obj) 
     4474Xinha.cloneObject = function(obj) 
    44684475{ 
    44694476  if ( !obj ) 
     
    44924499      if ( typeof node == 'object' ) 
    44934500      { 
    4494         newObj[n] = HTMLArea.cloneObject(node); 
     4501        newObj[n] = Xinha.cloneObject(node); 
    44954502      } 
    44964503      else 
     
    45054512 
    45064513// FIXME!!! this should return false for IE < 5.5 
    4507 HTMLArea.checkSupportedBrowser = function() 
    4508 { 
    4509   if ( HTMLArea.is_gecko ) 
     4514Xinha.checkSupportedBrowser = function() 
     4515{ 
     4516  if ( Xinha.is_gecko ) 
    45104517  { 
    45114518    if ( navigator.productSub < 20021201 ) 
     
    45194526    } 
    45204527  } 
    4521   return HTMLArea.is_gecko || HTMLArea.is_ie; 
     4528  return Xinha.is_gecko || Xinha.is_ie; 
    45224529}; 
    45234530 
    45244531// selection & ranges 
    45254532 
    4526 // moved HTMLArea.prototype._getSelection() to browser specific file 
    4527 // moved HTMLArea.prototype._createRange()  to browser specific file 
     4533// moved Xinha.prototype._getSelection() to browser specific file 
     4534// moved Xinha.prototype._createRange()  to browser specific file 
    45284535 
    45294536// event handling 
     
    45314538/** Event Flushing 
    45324539 *  To try and work around memory leaks in the rather broken 
    4533  *  garbage collector in IE, HTMLArea.flushEvents can be called 
     4540 *  garbage collector in IE, Xinha.flushEvents can be called 
    45344541 *  onunload, it will remove any event listeners (that were added 
    45354542 *  through _addEvent(s)) and clear any DOM-0 events. 
    45364543 */ 
    4537 HTMLArea._eventFlushers = []; 
    4538 HTMLArea.flushEvents = function() 
     4544Xinha._eventFlushers = []; 
     4545Xinha.flushEvents = function() 
    45394546{ 
    45404547  var x = 0; 
    45414548  // @todo : check if Array.prototype.pop exists for every supported browsers 
    4542   var e = HTMLArea._eventFlushers.pop(); 
     4549  var e = Xinha._eventFlushers.pop(); 
    45434550  while ( e ) 
    45444551  { 
     
    45474554      if ( e.length == 3 ) 
    45484555      { 
    4549         HTMLArea._removeEvent(e[0], e[1], e[2]); 
     4556        Xinha._removeEvent(e[0], e[1], e[2]); 
    45504557        x++; 
    45514558      } 
     
    45614568      // Do Nothing 
    45624569    } 
    4563     e = HTMLArea._eventFlushers.pop(); 
     4570    e = Xinha._eventFlushers.pop(); 
    45644571  } 
    45654572   
     
    45884595if ( document.addEventListener ) 
    45894596{ 
    4590   HTMLArea._addEvent = function(el, evname, func) 
     4597  Xinha._addEvent = function(el, evname, func) 
    45914598  { 
    45924599    el.addEventListener(evname, func, true); 
    4593     HTMLArea._eventFlushers.push([el, evname, func]); 
     4600    Xinha._eventFlushers.push([el, evname, func]); 
    45944601  }; 
    4595   HTMLArea._removeEvent = function(el, evname, func) 
     4602  Xinha._removeEvent = function(el, evname, func) 
    45964603  { 
    45974604    el.removeEventListener(evname, func, true); 
    45984605  }; 
    4599   HTMLArea._stopEvent = function(ev) 
     4606  Xinha._stopEvent = function(ev) 
    46004607  { 
    46014608    ev.preventDefault(); 
     
    46054612else if ( document.attachEvent ) 
    46064613{ 
    4607   HTMLArea._addEvent = function(el, evname, func) 
     4614  Xinha._addEvent = function(el, evname, func) 
    46084615  { 
    46094616    el.attachEvent("on" + evname, func); 
    4610     HTMLArea._eventFlushers.push([el, evname, func]); 
     4617    Xinha._eventFlushers.push([el, evname, func]); 
    46114618  }; 
    4612   HTMLArea._removeEvent = function(el, evname, func) 
     4619  Xinha._removeEvent = function(el, evname, func) 
    46134620  { 
    46144621    el.detachEvent("on" + evname, func); 
    46154622  }; 
    4616   HTMLArea._stopEvent = function(ev) 
     4623  Xinha._stopEvent = function(ev) 
    46174624  { 
    46184625    try 
     
    46314638else 
    46324639{ 
    4633   HTMLArea._addEvent = function(el, evname, func) 
     4640  Xinha._addEvent = function(el, evname, func) 
    46344641  { 
    46354642    alert('_addEvent is not supported'); 
    46364643  }; 
    4637   HTMLArea._removeEvent = function(el, evname, func) 
     4644  Xinha._removeEvent = function(el, evname, func) 
    46384645  { 
    46394646    alert('_removeEvent is not supported'); 
    46404647  }; 
    4641   HTMLArea._stopEvent = function(ev) 
     4648  Xinha._stopEvent = function(ev) 
    46424649  { 
    46434650    alert('_stopEvent is not supported'); 
     
    46454652} 
    46464653 
    4647 HTMLArea._addEvents = function(el, evs, func) 
     4654Xinha._addEvents = function(el, evs, func) 
    46484655{ 
    46494656  for ( var i = evs.length; --i >= 0; ) 
    46504657  { 
    4651     HTMLArea._addEvent(el, evs[i], func); 
    4652   } 
    4653 }; 
    4654  
    4655 HTMLArea._removeEvents = function(el, evs, func) 
     4658    Xinha._addEvent(el, evs[i], func); 
     4659  } 
     4660}; 
     4661 
     4662Xinha._removeEvents = function(el, evs, func) 
    46564663{ 
    46574664  for ( var i = evs.length; --i >= 0; ) 
    46584665  { 
    4659     HTMLArea._removeEvent(el, evs[i], func); 
     4666    Xinha._removeEvent(el, evs[i], func); 
    46604667  } 
    46614668}; 
     
    46774684 */ 
    46784685 
    4679 HTMLArea.addDom0Event = function(el, ev, fn) 
    4680 { 
    4681   HTMLArea._prepareForDom0Events(el, ev); 
     4686Xinha.addDom0Event = function(el, ev, fn) 
     4687{ 
     4688  Xinha._prepareForDom0Events(el, ev); 
    46824689  el._xinha_dom0Events[ev].unshift(fn); 
    46834690}; 
     
    46904697 */ 
    46914698 
    4692 HTMLArea.prependDom0Event = function(el, ev, fn) 
    4693 { 
    4694   HTMLArea._prepareForDom0Events(el, ev); 
     4699Xinha.prependDom0Event = function(el, ev, fn) 
     4700{ 
     4701  Xinha._prepareForDom0Events(el, ev); 
    46954702  el._xinha_dom0Events[ev].push(fn); 
    46964703}; 
     
    47004707 * when handlers are added via addDom0Event and prependDom0Event. 
    47014708 */ 
    4702 HTMLArea._prepareForDom0Events = function(el, ev) 
     4709Xinha._prepareForDom0Events = function(el, ev) 
    47034710{ 
    47044711  // Create a structure to hold our lists of event handlers 
     
    47064713  { 
    47074714    el._xinha_dom0Events = {}; 
    4708     HTMLArea.freeLater(el, '_xinha_dom0Events'); 
     4715    Xinha.freeLater(el, '_xinha_dom0Events'); 
    47094716  } 
    47104717 
     
    47414748    }; 
    47424749 
    4743     HTMLArea._eventFlushers.push([el, ev]); 
    4744   } 
    4745 }; 
    4746  
    4747 HTMLArea.prototype.notifyOn = function(ev, fn) 
     4750    Xinha._eventFlushers.push([el, ev]); 
     4751  } 
     4752}; 
     4753 
     4754Xinha.prototype.notifyOn = function(ev, fn) 
    47484755{ 
    47494756  if ( typeof this._notifyListeners[ev] == 'undefined' ) 
    47504757  { 
    47514758    this._notifyListeners[ev] = []; 
    4752     HTMLArea.freeLater(this, '_notifyListeners'); 
     4759    Xinha.freeLater(this, '_notifyListeners'); 
    47534760  } 
    47544761  this._notifyListeners[ev].push(fn); 
    47554762}; 
    47564763 
    4757 HTMLArea.prototype.notifyOf = function(ev, args) 
     4764Xinha.prototype.notifyOf = function(ev, args) 
    47584765{ 
    47594766  if ( this._notifyListeners[ev] ) 
     
    47664773}; 
    47674774 
    4768 HTMLArea._removeClass = function(el, className) 
     4775Xinha._removeClass = function(el, className) 
    47694776{ 
    47704777  if ( ! ( el && el.className ) ) 
     
    47844791}; 
    47854792 
    4786 HTMLArea._addClass = function(el, className) 
     4793Xinha._addClass = function(el, className) 
    47874794{ 
    47884795  // remove the class first, if already there 
    4789   HTMLArea._removeClass(el, className); 
     4796  Xinha._removeClass(el, className); 
    47904797  el.className += " " + className; 
    47914798}; 
    47924799 
    4793 HTMLArea._hasClass = function(el, className) 
     4800Xinha._hasClass = function(el, className) 
    47944801{ 
    47954802  if ( ! ( el && el.className ) ) 
     
    48084815}; 
    48094816 
    4810 HTMLArea._blockTags = " body form textarea fieldset ul ol dl li div " + 
     4817Xinha._blockTags = " body form textarea fieldset ul ol dl li div " + 
    48114818"p h1 h2 h3 h4 h5 h6 quote pre table thead " + 
    48124819"tbody tfoot tr td th iframe address blockquote "; 
    4813 HTMLArea.isBlockElement = function(el) 
    4814 { 
    4815   return el && el.nodeType == 1 && (HTMLArea._blockTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1); 
    4816 }; 
    4817  
    4818 HTMLArea._paraContainerTags = " body td th caption fieldset div"; 
    4819 HTMLArea.isParaContainer = function(el) 
    4820 { 
    4821   return el && el.nodeType == 1 && (HTMLArea._paraContainerTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1); 
     4820Xinha.isBlockElement = function(el) 
     4821{ 
     4822  return el && el.nodeType == 1 && (Xinha._blockTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1); 
     4823}; 
     4824 
     4825Xinha._paraContainerTags = " body td th caption fieldset div"; 
     4826Xinha.isParaContainer = function(el) 
     4827{ 
     4828  return el && el.nodeType == 1 && (Xinha._paraContainerTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1); 
    48224829}; 
    48234830 
     
    48254832// forbidden, taken from the list at: 
    48264833//   http://www.w3.org/TR/REC-html40/index/elements.html 
    4827 HTMLArea._closingTags = " a abbr acronym address applet b bdo big blockquote button caption center cite code del dfn dir div dl em fieldset font form frameset h1 h2 h3 h4 h5 h6 i iframe ins kbd label legend map menu noframes noscript object ol optgroup pre q s samp script select small span strike strong style sub sup table textarea title tt u ul var "; 
    4828  
    4829 HTMLArea.needsClosingTag = function(el) 
    4830 { 
    4831   return el && el.nodeType == 1 && (HTMLArea._closingTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1); 
     4834Xinha._closingTags = " a abbr acronym address applet b bdo big blockquote button caption center cite code del dfn dir div dl em fieldset font form frameset h1 h2 h3 h4 h5 h6 i iframe ins kbd label legend map menu noframes noscript object ol optgroup pre q s samp script select small span strike strong style sub sup table textarea title tt u ul var "; 
     4835 
     4836Xinha.needsClosingTag = function(el) 
     4837{ 
     4838  return el && el.nodeType == 1 && (Xinha._closingTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1); 
    48324839}; 
    48334840 
    48344841// performs HTML encoding of some given string 
    4835 HTMLArea.htmlEncode = function(str) 
     4842Xinha.htmlEncode = function(str) 
    48364843{ 
    48374844  if ( typeof str.replace == 'undefined' ) 
     
    48504857}; 
    48514858 
    4852 // moved HTMLArea.getHTML() to getHTML.js  
    4853 HTMLArea.prototype.stripBaseURL = function(string) 
     4859// moved Xinha.getHTML() to getHTML.js  
     4860Xinha.prototype.stripBaseURL = function(string) 
    48544861{ 
    48554862  if ( this.config.baseHref === null || !this.config.stripBaseHref ) 
     
    48694876 
    48704877// creates a rgb-style color from a number 
    4871 HTMLArea._makeColor = function(v) 
     4878Xinha._makeColor = function(v) 
    48724879{ 
    48734880  if ( typeof v != "number" ) 
     
    48844891 
    48854892// returns hexadecimal color representation from a number or a rgb-style color. 
    4886 HTMLArea._colorToRgb = function(v) 
     4893Xinha._colorToRgb = function(v) 
    48874894{ 
    48884895  if ( !v ) 
     
    48914898  } 
    48924899  var r,g,b; 
    4893   // @todo: why declaring this function here ? This needs to be a public methode of the object HTMLArea._colorToRgb 
     4900  // @todo: why declaring this function here ? This needs to be a public methode of the object Xinha._colorToRgb 
    48944901  // returns the hex representation of one byte (2 digits) 
    48954902  function hex(d) 
     
    49384945// this function will get called after the dialog is closed, with the return 
    49394946// value of the dialog. 
    4940 HTMLArea.prototype._popupDialog = function(url, action, init) 
     4947Xinha.prototype._popupDialog = function(url, action, init) 
    49414948{ 
    49424949  Dialog(this.popupURL(url), action, init); 
     
    49454952// paths 
    49464953 
    4947 HTMLArea.prototype.imgURL = function(file, plugin) 
     4954Xinha.prototype.imgURL = function(file, plugin) 
    49484955{ 
    49494956  if ( typeof plugin == "undefined" ) 
     
    49574964}; 
    49584965 
    4959 HTMLArea.prototype.popupURL = function(file) 
     4966Xinha.prototype.popupURL = function(file) 
    49604967{ 
    49614968  var url = ""; 
     
    49874994 * specifically looking to search only elements having a certain tag name. 
    49884995 */ 
    4989 HTMLArea.getElementById = function(tag, id) 
     4996Xinha.getElementById = function(tag, id) 
    49904997{ 
    49914998  var el, i, objs = document.getElementsByTagName(tag); 
     
    50035010/** Use some CSS trickery to toggle borders on tables */ 
    50045011 
    5005 HTMLArea.prototype._toggleBorders = function() 
     5012Xinha.prototype._toggleBorders = function() 
    50065013{ 
    50075014  var tables = this._doc.getElementsByTagName('TABLE'); 
     
    50245031     { 
    50255032        // flashing the display forces moz to listen (JB:18-04-2005) - #102 
    5026         if ( HTMLArea.is_gecko ) 
     5033        if ( Xinha.is_gecko ) 
    50275034        { 
    50285035          tables[i].style.display="none"; 
    50295036          tables[i].style.display="table"; 
    50305037        } 
    5031         HTMLArea._addClass(tables[i], 'htmtableborders'); 
     5038        Xinha._addClass(tables[i], 'htmtableborders'); 
    50325039     } 
    50335040     else 
    50345041     { 
    5035        HTMLArea._removeClass(tables[i], 'htmtableborders'); 
     5042       Xinha._removeClass(tables[i], 'htmtableborders'); 
    50365043     } 
    50375044   } 
     
    50415048 
    50425049 
    5043 HTMLArea.addClasses = function(el, classes) 
     5050Xinha.addClasses = function(el, classes) 
    50445051{ 
    50455052  if ( el !== null ) 
     
    50665073}; 
    50675074 
    5068 HTMLArea.removeClasses = function(el, classes) 
     5075Xinha.removeClasses = function(el, classes) 
    50695076{ 
    50705077  var existing    = el.className.trim().split(); 
     
    50915098 
    50925099/** Alias these for convenience */ 
    5093 HTMLArea.addClass       = HTMLArea._addClass; 
    5094 HTMLArea.removeClass    = HTMLArea._removeClass; 
    5095 HTMLArea._addClasses    = HTMLArea.addClasses; 
    5096 HTMLArea._removeClasses = HTMLArea.removeClasses; 
     5100Xinha.addClass       = Xinha._addClass; 
     5101Xinha.removeClass    = Xinha._removeClass; 
     5102Xinha._addClasses    = Xinha.addClasses; 
     5103Xinha._removeClasses = Xinha.removeClasses; 
    50975104 
    50985105/** Use XML HTTPRequest to post some data back to the server and do something 
    50995106 * with the response (asyncronously!), this is used by such things as the tidy functions 
    51005107 */ 
    5101 HTMLArea._postback = function(url, data, handler) 
     5108Xinha._postback = function(url, data, handler) 
    51025109{ 
    51035110  var req = null; 
    5104   if ( HTMLArea.is_ie ) 
     5111  if ( Xinha.is_ie ) 
    51055112  { 
    51065113   req = new ActiveXObject("Microsoft.XMLHTTP"); 
     
    51285135    if ( req.readyState == 4 ) 
    51295136    { 
    5130       if ( req.status == 200 || HTMLArea.isRunLocally && req.status == 0 ) 
     5137      if ( req.status == 200 || Xinha.isRunLocally && req.status == 0 ) 
    51315138      { 
    51325139        if ( typeof handler == 'function' ) 
     
    51505157}; 
    51515158 
    5152 HTMLArea._getback = function(url, handler) 
     5159Xinha._getback = function(url, handler) 
    51535160{ 
    51545161  var req = null; 
    5155   if ( HTMLArea.is_ie ) 
     5162  if ( Xinha.is_ie ) 
    51565163  { 
    51575164   req = new ActiveXObject("Microsoft.XMLHTTP"); 
     
    51665173    if ( req.readyState == 4 ) 
    51675174    { 
    5168       if ( req.status == 200 || HTMLArea.isRunLocally && req.status == 0 ) 
     5175      if ( req.status == 200 || Xinha.isRunLocally && req.status == 0 ) 
    51695176      { 
    51705177        handler(req.responseText, req); 
     
    51825189}; 
    51835190 
    5184 HTMLArea._geturlcontent = function(url) 
     5191Xinha._geturlcontent = function(url) 
    51855192{ 
    51865193  var req = null; 
    5187   if ( HTMLArea.is_ie ) 
     5194  if ( Xinha.is_ie ) 
    51885195  { 
    51895196   req = new ActiveXObject("Microsoft.XMLHTTP"); 
     
    51975204  req.open('GET', url, false); 
    51985205  req.send(null); 
    5199   if ( req.status == 200 || HTMLArea.isRunLocally && req.status == 0 ) 
     5206  if ( req.status == 200 || Xinha.isRunLocally && req.status == 0 ) 
    52005207  { 
    52015208    return req.responseText; 
     
    52255232} 
    52265233 
    5227 HTMLArea.arrayContainsArray = function(a1, a2) 
     5234Xinha.arrayContainsArray = function(a1, a2) 
    52285235{ 
    52295236  var all_found = true; 
     
    52485255}; 
    52495256 
    5250 HTMLArea.arrayFilter = function(a1, filterfn) 
     5257Xinha.arrayFilter = function(a1, filterfn) 
    52515258{ 
    52525259  var new_a = [ ]; 
     
    52615268}; 
    52625269 
    5263 HTMLArea.uniq_count = 0; 
    5264 HTMLArea.uniq = function(prefix) 
    5265 { 
    5266   return prefix + HTMLArea.uniq_count++; 
     5270Xinha.uniq_count = 0; 
     5271Xinha.uniq = function(prefix) 
     5272{ 
     5273  return prefix + Xinha.uniq_count++; 
    52675274}; 
    52685275 
     
    52715278 
    52725279/** Load a language file. 
    5273  *  This function should not be used directly, HTMLArea._lc will use it when necessary. 
    5274  * @param context Case sensitive context name, eg 'HTMLArea', 'TableOperations', ... 
     5280 *  This function should not be used directly, Xinha._lc will use it when necessary. 
     5281 * @param context Case sensitive context name, eg 'Xinha', 'TableOperations', ... 
    52755282 */ 
    5276 HTMLArea._loadlang = function(context) 
     5283Xinha._loadlang = function(context) 
    52775284{ 
    52785285  var url, lang; 
     
    52875294  { 
    52885295    //use internal files 
    5289     if ( context != 'HTMLArea') 
     5296    if ( context != 'Xinha') 
    52905297    { 
    52915298      url = _editor_url+"plugins/"+context+"/lang/"+_editor_lang+".js"; 
     
    52975304  } 
    52985305 
    5299   var langData = HTMLArea._geturlcontent(url); 
     5306  var langData = Xinha._geturlcontent(url); 
    53005307  if ( langData !== "" ) 
    53015308  { 
     
    53215328 * @param string    English language string. It can also contain variables in the form "Some text with $variable=replaced text$".  
    53225329 *                  This replaces $variable in "Some text with $variable" with "replaced text" 
    5323  * @param context   Case sensitive context name, eg 'HTMLArea' (default), 'TableOperations'... 
     5330 * @param context   Case sensitive context name, eg 'Xinha' (default), 'TableOperations'... 
    53245331 * @param replace   Replace $variables in String, eg {foo: 'replaceText'} ($foo in string will be replaced) 
    53255332 */ 
    5326 HTMLArea._lc = function(string, context, replace) 
     5333Xinha._lc = function(string, context, replace) 
    53275334{ 
    53285335  var ret; 
     
    53525359  else 
    53535360  { 
    5354     if ( typeof HTMLArea._lc_catalog == 'undefined' ) 
    5355     { 
    5356       HTMLArea._lc_catalog = [ ]; 
     5361    if ( typeof Xinha._lc_catalog == 'undefined' ) 
     5362    { 
     5363      Xinha._lc_catalog = [ ]; 
    53575364    } 
    53585365 
    53595366    if ( typeof context == 'undefined' ) 
    53605367    { 
    5361       context = 'HTMLArea'; 
    5362     } 
    5363  
    5364     if ( typeof HTMLArea._lc_catalog[context] == 'undefined' ) 
    5365     { 
    5366       HTMLArea._lc_catalog[context] = HTMLArea._loadlang(context); 
     5368      context = 'Xinha'; 
     5369    } 
     5370 
     5371    if ( typeof Xinha._lc_catalog[context] == 'undefined' ) 
     5372    { 
     5373      Xinha._lc_catalog[context] = Xinha._loadlang(context); 
    53675374    } 
    53685375 
     
    53815388    } 
    53825389 
    5383     if ( typeof HTMLArea._lc_catalog[context][key] == 'undefined' ) 
    5384     { 
    5385       if ( context=='HTMLArea' ) 
     5390    if ( typeof Xinha._lc_catalog[context][key] == 'undefined' ) 
     5391    { 
     5392      if ( context=='Xinha' ) 
    53865393      { 
    53875394        // Indicate it's untranslated 
     
    53975404      else 
    53985405      { 
    5399         //if string is not found and context is not HTMLArea try if it is in HTMLArea 
    5400         return HTMLArea._lc(string, 'HTMLArea', replace); 
     5406        //if string is not found and context is not Xinha try if it is in Xinha 
     5407        return Xinha._lc(string, 'Xinha', replace); 
    54015408      } 
    54025409    } 
    54035410    else 
    54045411    { 
    5405       ret = HTMLArea._lc_catalog[context][key]; 
     5412      ret = Xinha._lc_catalog[context][key]; 
    54065413    } 
    54075414  } 
     
    54225429}; 
    54235430 
    5424 HTMLArea.hasDisplayedChildren = function(el) 
     5431Xinha.hasDisplayedChildren = function(el) 
    54255432{ 
    54265433  var children = el.childNodes; 
     
    54465453 * @public 
    54475454 */ 
    5448 HTMLArea._loadback = function(U, C, O, B) 
    5449 { 
    5450   var T = HTMLArea.is_ie ? "onreadystatechange" : "onload"; 
     5455Xinha._loadback = function(U, C, O, B) 
     5456{ 
     5457  var T = Xinha.is_ie ? "onreadystatechange" : "onload"; 
    54515458  var S = document.createElement("script"); 
    54525459  S.type = "text/javascript"; 
     
    54565463    S[T] = function() 
    54575464    { 
    5458       if ( HTMLArea.is_ie && ! ( /loaded|complete/.test(window.event.srcElement.readyState) ) ) 
     5465      if ( Xinha.is_ie && ! ( /loaded|complete/.test(window.event.srcElement.readyState) ) ) 
    54595466      { 
    54605467        return; 
     
    54675474}; 
    54685475 
    5469 HTMLArea.collectionToArray = function(collection) 
     5476Xinha.collectionToArray = function(collection) 
    54705477{ 
    54715478  var array = [ ]; 
     
    54895496} 
    54905497 
    5491 HTMLArea.makeEditors = function(editor_names, default_config, plugin_names) 
     5498Xinha.makeEditors = function(editor_names, default_config, plugin_names) 
    54925499{ 
    54935500  if ( typeof default_config == 'function' ) 
     
    54995506  for ( var x = 0; x < editor_names.length; x++ ) 
    55005507  { 
    5501     var editor = new HTMLArea(editor_names[x], HTMLArea.cloneObject(default_config)); 
     5508    var editor = new Xinha(editor_names[x], Xinha.cloneObject(default_config)); 
    55025509    editor.registerPlugins(plugin_names); 
    55035510    editors[editor_names[x]] = editor; 
     
    55065513}; 
    55075514 
    5508 HTMLArea.startEditors = function(editors) 
     5515Xinha.startEditors = function(editors) 
    55095516{ 
    55105517  for ( var i in editors ) 
     
    55175524}; 
    55185525 
    5519 HTMLArea.prototype.registerPlugins = function(plugin_names) 
     5526Xinha.prototype.registerPlugins = function(plugin_names) 
    55205527{ 
    55215528  if ( plugin_names ) 
     
    55235530    for ( var i = 0; i < plugin_names.length; i++ ) 
    55245531    { 
    5525       this.setLoadingMessage('Register plugin $plugin', 'HTMLArea', {'plugin': plugin_names[i]}); 
     5532      this.setLoadingMessage('Register plugin $plugin', 'Xinha', {'plugin': plugin_names[i]}); 
    55265533      this.registerPlugin(eval(plugin_names[i])); 
    55275534    } 
     
    55315538/** Utility function to base64_encode some arbitrary data, uses the builtin btoa() if it exists (Moz) */ 
    55325539 
    5533 HTMLArea.base64_encode = function(input) 
     5540Xinha.base64_encode = function(input) 
    55345541{ 
    55355542  var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; 
     
    55675574/** Utility function to base64_decode some arbitrary data, uses the builtin atob() if it exists (Moz) */ 
    55685575 
    5569 HTMLArea.base64_decode = function(input) 
     5576Xinha.base64_decode = function(input) 
    55705577{ 
    55715578  var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; 
     
    56045611}; 
    56055612 
    5606 HTMLArea.removeFromParent = function(el) 
     5613Xinha.removeFromParent = function(el) 
    56075614{ 
    56085615  if ( !el.parentNode ) 
     
    56155622}; 
    56165623 
    5617 HTMLArea.hasParentNode = function(el) 
     5624Xinha.hasParentNode = function(el) 
    56185625{ 
    56195626  if ( el.parentNode ) 
     
    56315638}; 
    56325639 
    5633 // moved HTMLArea.getOuterHTML() to browser specific file 
     5640// moved Xinha.getOuterHTML() to browser specific file 
    56345641 
    56355642// detect the size of visible area 
    5636 // when calling from a popup window, call HTMLArea.viewportSize(window) to get the size of the popup 
    5637 HTMLArea.viewportSize = function(scope) 
     5643// when calling from a popup window, call Xinha.viewportSize(window) to get the size of the popup 
     5644Xinha.viewportSize = function(scope) 
    56385645{ 
    56395646  scope = (scope) ? scope : window; 
     
    56595666 
    56605667// find X position of an element 
    5661 HTMLArea.findPosX = function(obj) 
     5668Xinha.findPosX = function(obj) 
    56625669{ 
    56635670  var curleft = 0; 
     
    56785685 
    56795686// find Y position of an element 
    5680 HTMLArea.findPosY = function(obj) 
     5687Xinha.findPosY = function(obj) 
    56815688{ 
    56825689  var curtop = 0; 
     
    56965703}; 
    56975704 
    5698 HTMLArea.prototype.setLoadingMessage = function(string, context, replace) 
     5705Xinha.prototype.setLoadingMessage = function(string, context, replace) 
    56995706{ 
    57005707  if ( !this.config.showLoading || !document.getElementById("loading_sub_" + this._textArea.name) ) 
     
    57035710  } 
    57045711  var elt = document.getElementById("loading_sub_" + this._textArea.name); 
    5705   elt.innerHTML = HTMLArea._lc(string, context, replace); 
    5706 }; 
    5707  
    5708 HTMLArea.prototype.removeLoadingMessage = function() 
     5712  elt.innerHTML = Xinha._lc(string, context, replace); 
     5713}; 
     5714 
     5715Xinha.prototype.removeLoadingMessage = function() 
    57095716{ 
    57105717  if ( !this.config.showLoading || !document.getElementById("loading_" + this._textArea.name) ) 
     
    57155722}; 
    57165723 
    5717 HTMLArea.toFree = []; 
    5718 HTMLArea.freeLater = function(obj,prop) 
    5719 { 
    5720   HTMLArea.toFree.push({o:obj,p:prop}); 
     5724Xinha.toFree = []; 
     5725Xinha.freeLater = function(obj,prop) 
     5726{ 
     5727  Xinha.toFree.push({o:obj,p:prop}); 
    57215728}; 
    57225729 
     
    57275734 * @private 
    57285735 */ 
    5729 HTMLArea.free = function(obj, prop) 
     5736Xinha.free = function(obj, prop) 
    57305737{ 
    57315738  if ( obj && !prop ) 
     
    57335740    for ( var p in obj ) 
    57345741    { 
    5735       HTMLArea.free(obj, p); 
     5742      Xinha.free(obj, p); 
    57365743    } 
    57375744  } 
     
    57465753 */ 
    57475754 
    5748 HTMLArea.collectGarbageForIE = function()  
     5755Xinha.collectGarbageForIE = function()  
    57495756 
    5750   HTMLArea.flushEvents();    
    5751   for ( var x = 0; x < HTMLArea.toFree.length; x++ ) 
    5752   { 
    5753     if ( !HTMLArea.toFree[x].o ) 
    5754     { 
    5755       alert("What is " + x + ' ' + HTMLArea.toFree[x].o); 
    5756     } 
    5757     HTMLArea.free(HTMLArea.toFree[x].o, HTMLArea.toFree[x].p); 
    5758     HTMLArea.toFree[x].o = null; 
    5759   } 
    5760 }; 
    5761  
    5762 HTMLArea.init(); 
    5763 HTMLArea.addDom0Event(window,'unload',HTMLArea.collectGarbageForIE); 
     5757  Xinha.flushEvents();    
     5758  for ( var x = 0; x < Xinha.toFree.length; x++ ) 
     5759  { 
     5760    if ( !Xinha.toFree[x].o ) 
     5761    { 
     5762      alert("What is " + x + ' ' + Xinha.toFree[x].o); 
     5763    } 
     5764    Xinha.free(Xinha.toFree[x].o, Xinha.toFree[x].p); 
     5765    Xinha.toFree[x].o = null; 
     5766  } 
     5767}; 
     5768// backward compatibility 
     5769HTMLArea = Xinha; 
     5770Xinha.init(); 
     5771Xinha.addDom0Event(window,'unload',Xinha.collectGarbageForIE); 
  • trunk/inline-dialog.js

    r376 r649  
    11 
    2 HTMLArea.Dialog = function(editor, html, localizer) 
     2Xinha.Dialog = function(editor, html, localizer) 
    33{ 
    44  this.id    = { }; 
     
    2424    this._lc = function(string) 
    2525    { 
    26       return HTMLArea._lc(string,localizer); 
     26      return Xinha._lc(string,localizer); 
    2727    }; 
    2828  } 
     
    4040                        if(typeof dialog.id[id] == 'undefined') 
    4141                        { 
    42                           dialog.id[id] = HTMLArea.uniq('Dialog'); 
     42                          dialog.id[id] = Xinha.uniq('Dialog'); 
    4343                          dialog.r_id[dialog.id[id]] = id; 
    4444                        } 
     
    7373}; 
    7474 
    75 HTMLArea.Dialog.prototype.onresize = function() 
     75Xinha.Dialog.prototype.onresize = function() 
    7676{ 
    7777  return true; 
    7878}; 
    7979 
    80 HTMLArea.Dialog.prototype.show = function(values) 
     80Xinha.Dialog.prototype.show = function(values) 
    8181{ 
    8282  // We need to preserve the selection for IE 
    83   if(HTMLArea.is_ie) 
     83  if(Xinha.is_ie) 
    8484  { 
    8585    this._lastRange = this.editor._createRange(this.editor._getSelection()); 
     
    9797}; 
    9898 
    99 HTMLArea.Dialog.prototype.hide = function() 
     99Xinha.Dialog.prototype.hide = function() 
    100100{ 
    101101  this.rootElem.style.display         = 'none'; 
     
    105105 
    106106  // Restore the selection 
    107   if(HTMLArea.is_ie) 
     107  if(Xinha.is_ie) 
    108108  { 
    109109    this._lastRange.select(); 
     
    113113}; 
    114114 
    115 HTMLArea.Dialog.prototype.toggle = function() 
     115Xinha.Dialog.prototype.toggle = function() 
    116116{ 
    117117  if(this.rootElem.style.display == 'none') 
     
    125125}; 
    126126 
    127 HTMLArea.Dialog.prototype.setValues = function(values) 
     127Xinha.Dialog.prototype.setValues = function(values) 
    128128{ 
    129129  for(var i in values) 
     
    210210}; 
    211211 
    212 HTMLArea.Dialog.prototype.getValues = function() 
     212Xinha.Dialog.prototype.getValues = function() 
    213213{ 
    214214  var values = [ ]; 
    215   var inputs = HTMLArea.collectionToArray(this.rootElem.getElementsByTagName('input')) 
    216               .append(HTMLArea.collectionToArray(this.rootElem.getElementsByTagName('textarea'))) 
    217               .append(HTMLArea.collectionToArray(this.rootElem.getElementsByTagName('select'))); 
     215  var inputs = Xinha.collectionToArray(this.rootElem.getElementsByTagName('input')) 
     216              .append(Xinha.collectionToArray(this.rootElem.getElementsByTagName('textarea'))) 
     217              .append(Xinha.collectionToArray(this.rootElem.getElementsByTagName('select'))); 
    218218 
    219219  for(var x = 0; x < inputs.length; x++) 
     
    317317}; 
    318318 
    319 HTMLArea.Dialog.prototype.getElementById = function(id) 
     319Xinha.Dialog.prototype.getElementById = function(id) 
    320320{ 
    321321  return this.document.getElementById(this.id[id] ? this.id[id] : id); 
    322322}; 
    323323 
    324 HTMLArea.Dialog.prototype.getElementsByName = function(name) 
     324Xinha.Dialog.prototype.getElementsByName = function(name) 
    325325{ 
    326326  return this.document.getElementsByName(this.id[name] ? this.id[name] : name); 
  • trunk/panel-dialog.js

    r376 r649  
    11 
    2 HTMLArea.PanelDialog = function(editor, side, html, localizer) 
     2Xinha.PanelDialog = function(editor, side, html, localizer) 
    33{ 
    44  this.id    = { }; 
     
    1717    this._lc = function(string) 
    1818    { 
    19       return HTMLArea._lc(string,localizer); 
     19      return Xinha._lc(string,localizer); 
    2020    }; 
    2121  } 
     
    3333                        if(typeof dialog.id[id] == 'undefined') 
    3434                        { 
    35                           dialog.id[id] = HTMLArea.uniq('Dialog'); 
     35                          dialog.id[id] = Xinha.uniq('Dialog'); 
    3636                          dialog.r_id[dialog.id[id]] = id; 
    3737                        } 
     
    5353}; 
    5454 
    55 HTMLArea.PanelDialog.prototype.show = function(values) 
     55Xinha.PanelDialog.prototype.show = function(values) 
    5656{ 
    5757  this.editor.showPanel(this.rootElem); 
    5858}; 
    5959 
    60 HTMLArea.PanelDialog.prototype.hide = function() 
     60Xinha.PanelDialog.prototype.hide = function() 
    6161{ 
    6262  this.editor.hidePanel(this.rootElem); 
     
    6464}; 
    6565 
    66 HTMLArea.PanelDialog.prototype.onresize   = HTMLArea.Dialog.prototype.onresize; 
     66Xinha.PanelDialog.prototype.onresize   = Xinha.Dialog.prototype.onresize; 
    6767 
    68 HTMLArea.PanelDialog.prototype.toggle     = HTMLArea.Dialog.prototype.toggle; 
     68Xinha.PanelDialog.prototype.toggle     = Xinha.Dialog.prototype.toggle; 
    6969 
    70 HTMLArea.PanelDialog.prototype.setValues  = HTMLArea.Dialog.prototype.setValues; 
     70Xinha.PanelDialog.prototype.setValues  = Xinha.Dialog.prototype.setValues; 
    7171 
    72 HTMLArea.PanelDialog.prototype.getValues  = HTMLArea.Dialog.prototype.getValues; 
     72Xinha.PanelDialog.prototype.getValues  = Xinha.Dialog.prototype.getValues; 
    7373 
    74 HTMLArea.PanelDialog.prototype.getElementById    = HTMLArea.Dialog.prototype.getElementById; 
     74Xinha.PanelDialog.prototype.getElementById    = Xinha.Dialog.prototype.getElementById; 
    7575 
    76 HTMLArea.PanelDialog.prototype.getElementsByName = HTMLArea.Dialog.prototype.getElementsByName; 
     76Xinha.PanelDialog.prototype.getElementsByName = Xinha.Dialog.prototype.getElementsByName; 
  • trunk/popups/about.html

    r557 r649  
    4545function initDocument() { 
    4646  editor = window.dialogArguments; 
    47   HTMLArea = window.opener.HTMLArea; 
     47  Xinha = window.opener.Xinha; 
    4848 
    4949  var plugins = document.getElementById("plugins"); 
     
    9393    TABS.push(i); 
    9494    i.__msh_tab = j; 
    95     i.onmousedown = function(ev) { selectTab(this.__msh_tab); HTMLArea._stopEvent(ev || window.event); }; 
     95    i.onmousedown = function(ev) { selectTab(this.__msh_tab); Xinha._stopEvent(ev || window.event); }; 
    9696    var area = document.getElementById("tab-area-" + j); 
    9797    if (/tab-current/.test(i.className)) { 
     
    256256<div id="tab-area-4"> 
    257257  <script type="text/javascript"> 
    258     if(window.opener && window.opener.HTMLArea) 
     258    if(window.opener && window.opener.Xinha) 
    259259    { 
    260       var ver = window.opener.HTMLArea.version; 
     260      var ver = window.opener.Xinha.version; 
    261261      document.write('<pre>' 
    262262                      + '\nRelease: ' + ver.Release + ' (' + ver.Date + ')' 
  • trunk/popups/editor_help.html

    r419 r649  
    66 
    77<script type="text/javascript"> 
    8 HTMLArea = window.opener.HTMLArea; 
     8Xinha = window.opener.Xinha; 
    99function Init() { 
    10   __dlg_translate('HTMLArea'); 
     10  __dlg_translate('Xinha'); 
    1111  __dlg_init(); 
    1212  window.resizeTo(400, 480); 
  • trunk/popups/insert_image.html

    r553 r649  
    1111window.resizeTo(400, 100); 
    1212 
    13 HTMLArea = window.opener.HTMLArea; 
     13Xinha = window.opener.Xinha; 
    1414function i18n(str) { 
    15   return (HTMLArea._lc(str, 'HTMLArea')); 
     15  return (Xinha._lc(str, 'Xinha')); 
    1616} 
    1717 
    1818function Init() { 
    19   __dlg_translate('HTMLArea'); 
     19  __dlg_translate('Xinha'); 
    2020  __dlg_init(); 
    2121  // Make sure the translated string appears in the drop down. (for gecko) 
  • trunk/popups/insert_image.js

    r635 r649  
    11// Called when the user clicks on "InsertImage" button.  If an image is already 
    22// there, it will just modify it's properties. 
    3 HTMLArea.prototype._insertImage = function(image) 
     3Xinha.prototype._insertImage = function(image) 
    44{ 
    55  var editor = this;    // for nested functions 
     
    1818    { 
    1919      f_base   : editor.config.baseHref, 
    20       f_url    : HTMLArea.is_ie ? editor.stripBaseURL(image.src) : image.getAttribute("src"), 
     20      f_url    : Xinha.is_ie ? editor.stripBaseURL(image.src) : image.getAttribute("src"), 
    2121      f_alt    : image.alt, 
    2222      f_border : image.border, 
     
    3838      if ( !img ) 
    3939      { 
    40         if ( HTMLArea.is_ie ) 
     40        if ( Xinha.is_ie ) 
    4141        { 
    4242          var sel = editor._getSelection(); 
  • trunk/popups/insert_table.html

    r552 r649  
    1111window.resizeTo(410, 250); 
    1212 
    13 HTMLArea = window.opener.HTMLArea; 
     13Xinha = window.opener.Xinha; 
    1414function i18n(str) { 
    15   return (HTMLArea._lc(str, 'HTMLArea')); 
     15  return (Xinha._lc(str, 'Xinha')); 
    1616} 
    1717 
    1818function Init() { 
    19   HTMLArea = window.opener.HTMLArea; // load the HTMLArea plugin and lang file 
    20   __dlg_translate('HTMLArea'); 
    21   __dlg_init(null, HTMLArea.is_ie ? null : {width:410,height:250}); 
     19  Xinha = window.opener.Xinha; // load the Xinha plugin and lang file 
     20  __dlg_translate('Xinha'); 
     21  __dlg_init(null, Xinha.is_ie ? null : {width:410,height:250}); 
    2222  // Make sure the translated string appears in the drop down. (for gecko) 
    2323  document.getElementById("f_unit").selectedIndex = 1; 
  • trunk/popups/link.html

    r419 r649  
    99    window.resizeTo(400, 200); 
    1010 
    11 HTMLArea = window.opener.HTMLArea; 
     11Xinha = window.opener.Xinha; 
    1212 
    1313function i18n(str) { 
    14   return (HTMLArea._lc(str, 'HTMLArea')); 
     14  return (Xinha._lc(str, 'Xinha')); 
    1515} 
    1616 
     
    2525 
    2626function Init() { 
    27   __dlg_translate('HTMLArea'); 
     27  __dlg_translate('Xinha'); 
    2828  __dlg_init(); 
    2929 
  • trunk/popups/link.js

    r635 r649  
    1 HTMLArea.prototype._createLink = function(link) 
     1Xinha.prototype._createLink = function(link) 
    22{ 
    33  var editor = this; 
     
    1919    var range = editor._createRange(sel); 
    2020    var compare = 0; 
    21     if ( HTMLArea.is_ie ) 
     21    if ( Xinha.is_ie ) 
    2222    { 
    2323      if ( sel.type == "Control" ) 
     
    3636    if ( compare === 0 ) 
    3737    { 
    38       alert(HTMLArea._lc("You need to select some text before creating a link")); 
     38      alert(Xinha._lc("You need to select some text before creating a link")); 
    3939      return; 
    4040    } 
     
    5151    outparam = 
    5252    { 
    53       f_href   : HTMLArea.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"), 
     53      f_href   : Xinha.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"), 
    5454      f_title  : link.title, 
    5555      f_target : link.target, 
     
    7070        try 
    7171        { 
    72           var tmp = HTMLArea.uniq('http://www.example.com/Link'); 
     72          var tmp = Xinha.uniq('http://www.example.com/Link'); 
    7373          editor._doc.execCommand('createlink', false, tmp); 
    7474 
  • trunk/popups/popup.js

    r617 r649  
    1111// 
    1212// $Id$ 
    13 HTMLArea = window.opener.HTMLArea; 
     13Xinha = window.opener.Xinha; 
     14// Backward compatibility will be removed some time or not? 
     15HTMLArea = window.opener.Xinha; 
    1416 
    1517function getAbsolutePos(el) { 
     
    6062    else 
    6163    { 
    62       if (!HTMLArea.is_ie) 
     64      if (!Xinha.is_ie) 
    6365      { 
    6466        var x = opener.screenX + (opener.outerWidth - win_dim.width) / 2; 
     
    100102                window.moveTo(x, y); 
    101103        } 
    102         HTMLArea.addDom0Event(document.body, 'keypress', __dlg_close_on_esc); 
     104        Xinha.addDom0Event(document.body, 'keypress', __dlg_close_on_esc); 
    103105  window.__dlg_init_done = true; 
    104106} 
     
    111113                        var span = spans[i]; 
    112114                        if (span.firstChild && span.firstChild.data) { 
    113                                 var txt = HTMLArea._lc(span.firstChild.data, context); 
     115                                var txt = Xinha._lc(span.firstChild.data, context); 
    114116                                if (txt) 
    115117                                        span.firstChild.data = txt; 
    116118                        } 
    117119                        if (span.title) { 
    118                                 var txt = HTMLArea._lc(span.title, context); 
     120                                var txt = Xinha._lc(span.title, context); 
    119121                                if (txt) 
    120122                                        span.title = txt; 
     
    122124                } 
    123125        } 
    124     document.title = HTMLArea._lc(document.title, context); 
     126    document.title = Xinha._lc(document.title, context); 
    125127} 
    126128 
  • trunk/popups/select_color.html

    r239 r649  
    88function Init() 
    99{ 
    10   __dlg_translate('HTMLArea'); 
     10  __dlg_translate('Xinha'); 
    1111  __dlg_init(); 
    12   HTMLArea.addDom0Event(document, 'keypress', __dlg_close_on_esc); 
     12  Xinha.addDom0Event(document, 'keypress', __dlg_close_on_esc); 
    1313 
    1414  var color = window.dialogArguments; 
Note: See TracChangeset for help on using the changeset viewer.