source: trunk/examples/full_example-body.html @ 20

Last change on this file since 20 was 20, checked in by gogo, 10 years ago

Setting eol-style subversion property.

  • Property svn:eol-style set to native
  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 7.0 KB
Line 
1<html>
2<head>
3
4  <!--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
5    --  Xinha example usage.  This file shows how a developer might make use of
6    --  Xinha, it forms the primary example file for the entire Xinha project.
7    --  This file can be copied and used as a template for development by the
8    --  end developer who should simply removed the area indicated at the bottom
9    --  of the file to remove the auto-example-generating code and allow for the
10    --  use of the file as a boilerplate.
11    --
12    --  $HeadURL$
13    --  $LastChangedDate$
14    --  $LastChangedRevision$
15    --  $LastChangedBy$
16    --------------------------------------------------------------------------->
17
18  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
19  <title>Example of Xinha</title>
20  <link rel="stylesheet" href="full_example.css" />
21
22  <script type="text/javascript">
23    _editor_url = "../";      // This is a path to the base xinha directory.
24    _editor_lang = "en";      // And the language we need to use in the editor.
25  </script>
26
27  <!-- Load up the actual editor core -->
28  <script type="text/javascript" src="../htmlarea.js"></script>
29
30  <script type="text/javascript">
31    xinha_editors = null;
32    xinha_init    = null;
33    xinha_config  = null;
34    xinha_plugins = null;
35
36    // This contains the names of textareas we will make into Xinha editors
37    xinha_init = xinha_init ? xinha_init : function()
38    {
39      /** STEP 1 ***************************************************************
40       * First, what are the plugins you will be using in the editors on this
41       * page.  List all the plugins you will need, even if not all the editors
42       * will use all the plugins.
43       ************************************************************************/
44
45      xinha_plugins = xinha_plugins ? xinha_plugins :
46      [
47       'CharacterMap',
48       'ContextMenu',
49       'FullScreen',
50       'ListType',
51       'SpellChecker',
52       'Stylist',
53       'SuperClean',
54       'TableOperations'
55      ];
56             // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :)
57             if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;
58
59      /** STEP 2 ***************************************************************
60       * Now, what are the names of the textareas you will be turning into
61       * editors?
62       ************************************************************************/
63
64      xinha_editors = xinha_editors ? xinha_editors :
65      [
66        'myTextArea',
67        'anotherOne'
68      ];
69
70      /** STEP 3 ***************************************************************
71       * We create a default configuration to be used by all the editor.
72       * If you wish to configure some of the editors differently this will be
73       * done in step 4.
74       *
75       * If you want to modify the default config you might do something like this.
76       *
77       *   xinha_config = new HTMLArea.Config();
78       *   xinha_config.width  = 640;
79       *   xinha_config.height = 420;
80       *
81       *************************************************************************/
82
83       xinha_config = xinha_config ? xinha_config : new HTMLArea.Config();
84
85      /** STEP 3 ***************************************************************
86       * We first create editors for the textareas.
87       *
88       * You can do this in two ways, either
89       *
90       *   xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
91       *
92       * if you want all the editor objects to use the same set of plugins, OR;
93       *
94       *   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config);
95       *   xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']);
96       *   xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']);
97       *
98       * if you want to use a different set of plugins for one or more of the
99       * editors.
100       ************************************************************************/
101
102      xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
103
104      /** STEP 4 ***************************************************************
105       * If you want to change the configuration variables of any of the
106       * editors,  this is the place to do that, for example you might want to
107       * change the width and height of one of the editors, like this...
108       *
109       *   xinha_editors.config.myTextArea.width  = 640;
110       *   xinha_editors.config.myTextArea.height = 480;
111       *
112       ************************************************************************/
113
114
115      /** STEP 5 ***************************************************************
116       * Finally we "start" the editors, this turns the textareas into
117       * Xinha editors.
118       ************************************************************************/
119
120      HTMLArea.startEditors(xinha_editors);
121    }
122
123    window.onload = xinha_init;
124  </script>
125</head>
126
127<body onload="xinha_init()">
128
129  <form id="editors_here">
130    <textarea id="myTextArea" name="myTextArea" rows="10" cols="80" style="width:100%"></textarea>
131    <textarea id="anotherOne" name="anotherOne" rows="10" cols="80" style="width:100%"></textarea>
132  </form>
133
134
135  <!----------------------------------------------------------------------------
136    -                            !! IMPORTANT !!
137    -  The html and javascript below is the code used to create the example page.
138    -  It renders a lot of the above unused because it pre-fills xinha_editors,
139    -  xinha_config and xinha_plugins for you, and creates new textareas in place
140    -  of the ones above. The items above are not used while the example is being
141    -  used!
142    -
143    -  If you are going to take the code in this file to form the basis of your
144    -  own, then leave out this marked area.
145    --------------------------------------------------------------------------->
146
147        <div id="lipsum" style="display:none">
148          <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
149          Aliquam et tellus vitae justo varius placerat. Suspendisse iaculis
150          velit semper dolor. Donec gravida tincidunt mi. Curabitur tristique
151          ante elementum turpis. Aliquam nisl. Nulla posuere neque non
152          tellus. Morbi vel nibh. Cum sociis natoque penatibus et magnis dis
153          parturient montes, nascetur ridiculus mus. Nam nec wisi. In wisi.
154          Curabitur pharetra bibendum lectus.</p>
155
156          <ul>
157            <li> Phasellus et massa sed diam viverra semper.  </li>
158            <li> Mauris tincidunt felis in odio.              </li>
159            <li> Nulla placerat nunc ut pede.                 </li>
160            <li> Vivamus ultrices mi sit amet urna.           </li>
161            <li> Quisque sed augue quis nunc laoreet volutpat.</li>
162            <li> Nunc sit amet metus in tortor semper mattis. </li>
163          </ul>
164        </div>
165        <script src="full_example.js"></script>
166
167  <!--------------------------------------------------------------------------->
168
169
170</body>
171</html>
Note: See TracBrowser for help on using the repository browser.