source: branches/ray/examples/testbed.html @ 774

Last change on this file since 774 was 774, checked in by ray, 13 years ago

updated branch

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 9.6 KB
Line 
1<!DOCTYPE html
2     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5<head>
6
7  <!--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
8    --  Xinha example usage.  This file shows how a developer might make use of
9    --  Xinha, it forms the primary example file for the entire Xinha project.
10    --  This file can be copied and used as a template for development by the
11    --  end developer who should simply removed the area indicated at the bottom
12    --  of the file to remove the auto-example-generating code and allow for the
13    --  use of the file as a boilerplate.
14    --
15    --  $HeadURL$
16    --  $LastChangedDate$
17    --  $LastChangedRevision$
18    --  $LastChangedBy$
19    --------------------------------------------------------------------------->
20
21  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
22  <title>Example of Xinha</title>
23  <link rel="stylesheet" href="full_example.css" />
24
25  <script type="text/javascript">
26    // You must set _editor_url to the URL (including trailing slash) where
27    // where xinha is installed, it's highly recommended to use an absolute URL
28    //  eg: _editor_url = "/path/to/xinha/";
29    // You may try a relative URL if you wish]
30    //  eg: _editor_url = "../";
31    // in this example we do a little regular expression to find the absolute path.
32    _editor_url  = document.location.href.replace(/examples\/.*/, '')
33    _editor_lang = "en";      // And the language we need to use in the editor.
34  </script>
35
36  <!-- Load up the actual editor core -->
37  <script type="text/javascript" src="../htmlarea.js"></script>
38
39  <script type="text/javascript">
40    xinha_editors = null;
41    xinha_init    = null;
42    xinha_config  = null;
43    xinha_plugins = null;
44
45    // This contains the names of textareas we will make into Xinha editors
46    xinha_init = xinha_init ? xinha_init : function()
47    {
48      /** STEP 1 ***************************************************************
49       * First, what are the plugins you will be using in the editors on this
50       * page.  List all the plugins you will need, even if not all the editors
51       * will use all the plugins.
52       ************************************************************************/
53
54      xinha_plugins = xinha_plugins ? xinha_plugins :
55      [
56        //'CharacterMap',
57        //'SpellChecker',
58       //'SmartReplace'//,
59        //'PasteText'//,'SuperClean',
60        'Linker'//,'GetHtml'
61      ];
62             // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :)
63             if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
64
65      /** STEP 2 ***************************************************************
66       * Now, what are the names of the textareas you will be turning into
67       * editors?
68       ************************************************************************/
69
70      xinha_editors = xinha_editors ? xinha_editors :
71      [
72      'HAllo', 
73      'myTextArea'
74       
75      ];
76
77      /** STEP 3 ***************************************************************
78       * We create a default configuration to be used by all the editors.
79       * If you wish to configure some of the editors differently this will be
80       * done in step 4.
81       *
82       * If you want to modify the default config you might do something like this.
83       *
84       *   xinha_config = new Xinha.Config();
85       *   xinha_config.width  = 640;
86       *   xinha_config.height = 420;
87       *
88       *************************************************************************/
89
90       xinha_config = xinha_config ? xinha_config : new Xinha.Config();
91   xinha_config.width  = 300;
92   xinha_config.height = 300;
93       xinha_config.fullPage = false;
94      // xinha_config.CharacterMap.mode = 'panel';
95       xinha_config.toolbar =
96  [
97   ["htmlmode","formatblock"]
98  ];
99/*
100       // We can load an external stylesheet like this - NOTE : YOU MUST GIVE AN ABSOLUTE URL
101      //  otherwise it won't work!
102      xinha_config.stylistLoadStylesheet(document.location.href.replace(/[^\/]*\.html/, 'stylist.css'));
103
104      // Or we can load styles directly
105      xinha_config.stylistLoadStyles('p.red_text { color:red }');
106
107      // If you want to provide "friendly" names you can do so like
108      // (you can do this for stylistLoadStylesheet as well)
109      xinha_config.stylistLoadStyles('p.pink_text { color:pink }', {'p.pink_text' : 'Pretty Pink'});
110*/
111      /** STEP 3 ***************************************************************
112       * We first create editors for the textareas.
113       *
114       * You can do this in two ways, either
115       *
116       *   xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
117       *
118       * if you want all the editor objects to use the same set of plugins, OR;
119       *
120       *   xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config);
121       *   xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']);
122       *   xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']);
123       *
124       * if you want to use a different set of plugins for one or more of the
125       * editors.
126       ************************************************************************/
127
128      xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
129
130      /** STEP 4 ***************************************************************
131       * If you want to change the configuration variables of any of the
132       * editors,  this is the place to do that, for example you might want to
133       * change the width and height of one of the editors, like this...
134       *
135       *   xinha_editors.myTextArea.config.width  = 640;
136       *   xinha_editors.myTextArea.config.height = 480;
137       *
138       ************************************************************************/
139
140
141      /** STEP 5 ***************************************************************
142       * Finally we "start" the editors, this turns the textareas into
143       * Xinha editors.
144       ************************************************************************/
145
146      Xinha.startEditors(xinha_editors);
147      window.onload = null;
148    }
149
150    window.onload   = xinha_init;
151    // window.onunload = Xinha.collectGarbageForIE;
152  </script>
153</head>
154
155<body bgcolor="Aqua">
156
157  <form action="test_dest.php" id="editors_here" onsubmit="alert(this.myTextArea.value);">
158<input type="checkbox" name="hallo" />
159<select>
160<option>Test</option>
161</select>
162  <textarea id="myTextArea" name="myTextArea" style="width:100%;height:320px;">
163    <table cellspacing="1" cellpadding="1" border="1" style="width: 100%;"><tbody><tr><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td></tr><tr><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td></tr></tbody></table><br /></textarea>
164
165    <input type="submit" /> <input type="reset" /><input type="checkbox" name="hallo" />
166<select>
167<option>Test</option>
168</select>
169  <textarea name="myTextArea" style="width:100%;height:320px;">
170    <table cellspacing="1" cellpadding="1" border="1" style="width: 100%;"><tbody><tr><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td></tr><tr><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td></tr></tbody></table><br /></textarea>
171
172    <input type="submit" /> <input type="reset" /><input type="checkbox" name="hallo" />
173<select>
174<option>Test</option>
175</select>
176  <textarea name="myTextArea" style="width:100%;height:320px;">
177    <table cellspacing="1" cellpadding="1" border="1" style="width: 100%;"><tbody><tr><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td></tr><tr><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td></tr></tbody></table><br /></textarea>
178
179    <input type="submit" /> <input type="reset" /><input type="checkbox" name="hallo" />
180<select>
181<option>Test</option>
182</select>
183  <textarea id="myTextArea" name="myTextArea" style="width:100%;height:320px;">
184    <table cellspacing="1" cellpadding="1" border="1" style="width: 100%;"><tbody><tr><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td></tr><tr><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td></tr></tbody></table><br /></textarea>
185
186    <input type="submit" /> <input type="reset" /><input type="checkbox" name="hallo" />
187<select>
188<option>Test</option>
189</select>
190  <textarea name="myTextArea" style="width:100%;height:320px;">
191    <table cellspacing="1" cellpadding="1" border="1" style="width: 100%;"><tbody><tr><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td></tr><tr><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td><td style="width: 25%;">&nbsp;</td></tr></tbody></table><br /></textarea>
192
193    <input type="submit" /> <input type="reset" />
194  </form>
195  <script language="javascript">
196    document.write(document.compatMode);
197  </script>
198  <a href="#" onclick="xinha_editors.myTextArea.hidePanels();">Hide</a>
199  <a href="#" onclick="xinha_editors.myTextArea.showPanels();">Show</a>
200</body>
201</html>
Note: See TracBrowser for help on using the repository browser.