Ticket #258: simple_example.html

File simple_example.html, 6.4 KB (added by mokhet, 14 years ago)

simple example

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5<title>Simple example of Xinha</title>
6<script type="text/javascript">
7/************************************************************************
8 * Please refer to http://xinha.python-hosting.com/wiki/NewbieGuide
9 ************************************************************************
10 * You must set _editor_url to the URL (including trailing slash) where
11 * where xinha is installed, it's highly recommended to use an absolute URL
12 *  eg: _editor_url = "/path/to/xinha/";
13 * You may try a relative URL if you wish]
14 *  eg: _editor_url = "../";
15 * in this example we do a little regular expression to find the absolute path.
16 ************************************************************************/
17_editor_url  = document.location.href.replace(/examples\/simple_example\.html.*/, '')
18// And the language we need to use in the editor.
19_editor_lang = "en";
20</script>
21<!-- Load up the actual editor core -->
22<script type="text/javascript" src="../htmlarea.js"></script>
23<script type="text/javascript">
24/************************************************************************
25 * Plugins you will be using in the editors on this page.
26 * List all the plugins you will need, even if not all the editors will
27 * use all the plugins.
28 ************************************************************************
29 * Please refer to http://xinha.python-hosting.com/wiki/Plugins for the
30 * list of availables plugins
31 ************************************************************************/
32var xinha_plugins =
33[
34 'CharacterMap',
35 'ContextMenu',
36 'FullScreen',
37 'ListType',
38 'SpellChecker',
39 'Stylist',
40 'SuperClean',
41 'TableOperations'
42];
43/************************************************************************
44 * Names of the textareas you will be turning into editors
45 ************************************************************************/
46var xinha_editors =
47[
48  'myTextArea',
49  'anotherOne'
50];
51/************************************************************************
52 * Initialisation function
53 ************************************************************************/
54function xinha_init()
55{
56  // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :)
57  if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;
58  /*************************************************************************
59   * We create a default configuration to be used by all the editors.
60   * If you wish to configure some of the editors differently this will be
61   * done later after editors are initiated.
62   ************************************************************************
63   * Please refer to http://xinha.python-hosting.com/wiki/Documentation/Customise
64   * for the configuration parameters
65   ************************************************************************/
66  var xinha_config = new HTMLArea.Config();
67  /************************************************************************
68   * We first create editors for the textareas.
69   * You can do this in two ways, either
70   *
71   *   xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
72   *
73   * if you want all the editor objects to use the same set of plugins, OR;
74   *
75   *   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config);
76   *   xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']);
77   *   xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']);
78   *
79   * if you want to use a different set of plugins for one or more of the
80   * editors.
81   ************************************************************************/
82  xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
83  /************************************************************************
84   * If you want to change the configuration variables of any of the
85   * editors,  this is the place to do that, for example you might want to
86   * change the width and height of one of the editors, like this...
87   ************************************************************************/
88  xinha_editors.myTextArea.config.width = '640px';
89  xinha_editors.myTextArea.config.height = '480px';
90  /************************************************************************
91   * Finally we "start" the editors, this turns the textareas into
92   * Xinha editors.
93   ************************************************************************/
94  HTMLArea.startEditors(xinha_editors);
95}
96window.onload = xinha_init;
97</script>
98<link type="text/css" rel="stylesheet" title="blue-look" href="../skins/blue-look/skin.css" />
99<link type="text/css" rel="alternate stylesheet" title="green-look" href="../skins/green-look/skin.css" />
100<link type="text/css" rel="alternate stylesheet" title="xp-blue" href="../skins/xp-blue/skin.css" />
101<link type="text/css" rel="alternate stylesheet" title="xp-green" href="../skins/xp-green/skin.css" />
102<link type="text/css" rel="alternate stylesheet" title="inditreuse" href="../skins/inditreuse/skin.css" />
103<link type="text/css" rel="alternate stylesheet" title="blue-metallic" href="../skins/blue-metallic/skin.css" />
104</head>
105
106<body>
107
108<form onsubmit="alert(this.myTextArea.value); alert(this.anotherOne.value); return false;">
109<textarea id="myTextArea" name="myTextArea" rows="10" cols="80" style="width:100%">
110&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
111Aliquam et tellus vitae justo varius placerat. Suspendisse iaculis
112velit semper dolor. Donec gravida tincidunt mi. Curabitur tristique
113ante elementum turpis. Aliquam nisl. Nulla posuere neque non
114tellus. Morbi vel nibh. Cum sociis natoque penatibus et magnis dis
115parturient montes, nascetur ridiculus mus. Nam nec wisi. In wisi.
116Curabitur pharetra bibendum lectus.&lt;/p&gt;
117</textarea>
118<textarea id="anotherOne" name="anotherOne" rows="10" cols="80" style="width:100%">
119&lt;ul&gt;
120&lt;li&gt; Phasellus et massa sed diam viverra semper.  &lt;/li&gt;
121&lt;li&gt; Mauris tincidunt felis in odio.              &lt;/li&gt;
122&lt;li&gt; Nulla placerat nunc ut pede.                 &lt;/li&gt;
123&lt;li&gt; Vivamus ultrices mi sit amet urna.           &lt;/li&gt;
124&lt;li&gt; Quisque sed augue quis nunc laoreet volutpat.&lt;/li&gt;
125&lt;li&gt; Nunc sit amet metus in tortor semper mattis. &lt;/li&gt;
126&lt;/ul&gt;
127</textarea>
128<input type="submit">
129</form>
130
131</body>
132</html>