File: //usr/local/usermin-1.750/file/xinha/examples/testbed.html
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <!--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
    --  Xinha example usage.  This file shows how a developer might make use of
    --  Xinha, it forms the primary example file for the entire Xinha project.
    --  This file can be copied and used as a template for development by the
    --  end developer who should simply removed the area indicated at the bottom
    --  of the file to remove the auto-example-generating code and allow for the
    --  use of the file as a boilerplate.
    --
    --  $HeadURL: http://svn.xinha.org/trunk/examples/testbed.html $
    --  $LastChangedDate: 2008-10-12 19:42:42 +0200 (So, 12. Okt 2008) $
    --  $LastChangedRevision: 1084 $
    --  $LastChangedBy: ray $
    --------------------------------------------------------------------------->
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Example of Xinha</title>
  <link rel="stylesheet" href="files/full_example.css" />
  <script type="text/javascript">
    // You must set _editor_url to the URL (including trailing slash) where
    // where xinha is installed, it's highly recommended to use an absolute URL
    //  eg: _editor_url = "/path/to/xinha/";
    // You may try a relative URL if you wish]
    //  eg: _editor_url = "../";
    // in this example we do a little regular expression to find the absolute path.
    _editor_url  = document.location.href.replace(/examples\/.*/, '')
    _editor_lang = "en";      // And the language we need to use in the editor.
  </script>
  <!-- Load up the actual editor core -->
  <script type="text/javascript" src="../XinhaCore.js"></script>
  <script type="text/javascript">
    xinha_editors = null;
    xinha_init    = null;
    xinha_config  = null;
    xinha_plugins = null;
    // This contains the names of textareas we will make into Xinha editors
    xinha_init = xinha_init ? xinha_init : function()
    {
      /** STEP 1 ***************************************************************
       * First, what are the plugins you will be using in the editors on this
       * page.  List all the plugins you will need, even if not all the editors
       * will use all the plugins.
       ************************************************************************/
      xinha_plugins = xinha_plugins ? xinha_plugins :
      [
        'CharacterMap', 'SpellChecker', 'Linker'
      ];
             // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :)
             if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
      /** STEP 2 ***************************************************************
       * Now, what are the names of the textareas you will be turning into
       * editors?
       ************************************************************************/
      xinha_editors = xinha_editors ? xinha_editors :
      [
        'myTextArea'
      ];
      /** STEP 3 ***************************************************************
       * We create a default configuration to be used by all the editors.
       * If you wish to configure some of the editors differently this will be
       * done in step 4.
       *
       * If you want to modify the default config you might do something like this.
       *
       *   xinha_config = new Xinha.Config();
       *   xinha_config.width  = 640;
       *   xinha_config.height = 420;
       *
       *************************************************************************/
       xinha_config = xinha_config ? xinha_config : new Xinha.Config();
       xinha_config.fullPage = true;
       xinha_config.CharacterMap.mode = 'panel';
/*
       // We can load an external stylesheet like this - NOTE : YOU MUST GIVE AN ABSOLUTE URL
      //  otherwise it won't work!
      xinha_config.stylistLoadStylesheet(document.location.href.replace(/[^\/]*\.html/, 'files/stylist.css'));
      // Or we can load styles directly
      xinha_config.stylistLoadStyles('p.red_text { color:red }');
      // If you want to provide "friendly" names you can do so like
      // (you can do this for stylistLoadStylesheet as well)
      xinha_config.stylistLoadStyles('p.pink_text { color:pink }', {'p.pink_text' : 'Pretty Pink'});
*/
      /** STEP 3 ***************************************************************
       * We first create editors for the textareas.
       *
       * You can do this in two ways, either
       *
       *   xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
       *
       * if you want all the editor objects to use the same set of plugins, OR;
       *
       *   xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config);
       *   xinha_editors['myTextArea'].registerPlugins(['Stylist']);
       *   xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']);
       *
       * if you want to use a different set of plugins for one or more of the
       * editors.
       ************************************************************************/
      xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
      /** STEP 4 ***************************************************************
       * If you want to change the configuration variables of any of the
       * editors,  this is the place to do that, for example you might want to
       * change the width and height of one of the editors, like this...
       *
       *   xinha_editors.myTextArea.config.width  = 640;
       *   xinha_editors.myTextArea.config.height = 480;
       *
       ************************************************************************/
      /** STEP 5 ***************************************************************
       * Finally we "start" the editors, this turns the textareas into
       * Xinha editors.
       ************************************************************************/
      Xinha.startEditors(xinha_editors);
      window.onload = null;
    }
    window.onload   = xinha_init;
  </script>
</head>
<body>
  <form action="javascript:void(0);" id="editors_here" onsubmit="alert(this.myTextArea.value);">
 <div>
     <textarea id="myTextArea" name="myTextArea" style="width:100%;height:320px;">
      <html>
      <head>
        <title>Hello</title>
        <style type="text/css">
          li { color:red; }
        </style>
      </head>
      <body><span style="color:purple">
      <img src="../images/xinha_logo.gif" usemap="#m1">
      <map name="m1">
      <area shape="rect" coords="137,101,255,124" href="http://www.mydomain.com">
      </map>
      <p>
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
        Aliquam et tellus vitae justo varius placerat. Suspendisse iaculis
        velit semper dolor. Donec gravida tincidunt mi. Curabitur tristique
        ante elementum turpis.  <span style="color:green">Aliquam </span> nisl. Nulla posuere neque non
        tellus. Morbi vel nibh. <font face="Arial"><font color="#009933">Cum  sociis natoque</font></font> penatibus et magnis dis
        parturient montes, nascetur ridiculus mus. Nam nec wisi. In wisi.
        Curabitur pharetra bibendum lectus.
      </p>
      <ul>
        <li style="color:green"> Phasellus et massa sed diam viverra semper.  </li>
        <li> Mauris tincidunt felis in odio.              </li>
        <li> Nulla placerat nunc ut pede.                 </li>
        <li> Vivamus ultrices mi sit amet urna.           </li>
        <li> Quisque sed augue quis nunc laoreet volutpat.</li>
        <li> Nunc sit amet metus in tortor semper mattis. </li>
      </ul>
      </span></body>
      </html>
    </textarea>
    <input type="submit" /> <input type="reset" />
</div>
  </form>
  <script type="text/javascript">
    document.write(document.compatMode);
  </script>
<div>
  <a href="#" onclick="xinha_editors.myTextArea.hidePanels();">Hide</a>
  <a href="#" onclick="xinha_editors.myTextArea.showPanels();">Show</a>
</div>
</body>
</html>