source: branches/unified_backend/examples/full_example-body.php @ 172

Last change on this file since 172 was 172, checked in by yermol, 15 years ago

htmlarea.js

. added workaround fix for NASTY FIREFOX BUG resulting in the infamous

uneditable area problem (exception on designMode="on" issue -
refer to bug:


https://bugzilla.mozilla.org/show_bug.cgi?id=207842


and this thread:


http://xinha.gogo.co.nz/punbb/viewtopic.php?id=229


. trailing <BR>'s are no longer stripped out of the document. This

was wreaking havoc on EnterParagraphs?. It's not clear whether or not
this is going to have unanticipated side-effects.

plugins/EnterParagraphs/enter-paragraphs.js

NOT FULLY FUNCTIONAL YET - DOESN'T HANDLE ALL CASES CORRECTLY,
but it's much better than it was I think.

. largely reworked.
. changed obfuscated variables names to make it more readable.
. expanded out nested (x ? y : z) constructs to make it more readable.
. added alot of comments.
. fixed a serious bug in findEachNodeUnder() that was not correctly

handling beginning and end node conditions.

. fixed design flaw that selected a non-existent insertion point for

placing the cursor.

. fixed several exceptions.
. now correctly handles lists by passing the back back to the Gecko

engine if we are in a list with the exception of being at the
first position in the first element in which case we insert
a paragraph before the list and move the cursor back to the first
item on the list.

  • Property svn:eol-style set to native
  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 9.2 KB
Line 
1<?php
2
3// [NOSTRIP
4// -----------------------------------------------------------------
5// Copyright (C) Gogo Code.
6// http://code.gogo.co.nz
7//
8// Unified backend modifications by DTLink, LLC.
9// http://www.dtlink.com and http://www.formvista.com
10// -----------------------------------------------------------------
11// This code is distributed under the the sames terms as Xinha
12// itself. (HTMLArea license based on the BSD license)
13//
14// Please read license.txt in this package for details.
15//
16// All software distributed under the Licenses is provided strictly on
17// an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
18// IMPLIED, AND DTLINK LLC HEREBY DISCLAIMS ALL SUCH
19// WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
20// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT,
21// OR NON-INFRINGEMENT.
22// ------------------------------------------------------------------
23// NOSTRIP]
24
25/**
26* Modified version of full_example-body.html for use with the PHP unified backend.
27*
28* To use the unified backend you must first include the backend_conf.php file which
29* is generated by Configure.php.
30*/
31
32/**
33* Configure.php generated config file for PHP unified backend.
34*/
35
36include_once( "../backends/backend_conf.php" );
37
38?><html>
39<head>
40
41  <!--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
42    --  Xinha example usage.  This file shows how a developer might make use of
43    --  Xinha, it forms the primary example file for the entire Xinha project.
44    --  This file can be copied and used as a template for development by the
45    --  end developer who should simply removed the area indicated at the bottom
46    --  of the file to remove the auto-example-generating code and allow for the
47    --  use of the file as a boilerplate.
48    --
49    --  $HeadURL$
50    --  $LastChangedDate$
51    --  $LastChangedRevision$
52    --  $LastChangedBy$
53    --------------------------------------------------------------------------->
54
55  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
56  <title>Example of Xinha</title>
57  <link rel="stylesheet" href="<? echo XINHA_INSTALL_URL; ?>/examples/full_example.css" />
58
59  <script type="text/javascript">
60    // You must set _editor_url to the URL (including trailing slash) where Xinha
61         // is installed.
62         //
63         // Before we had the central config, this is the way it was done.
64         //
65    // _editor_url  = document.location.href.replace(/examples\/full_example-body\.html.*/, '')
66
67    _editor_url  = "<? echo XINHA_INSTALL_URL; ?>";
68    _editor_lang = "en";      // And the language we need to use in the editor.
69  </script>
70
71  <!--  load in debug trace message class -->
72
73  <script type="text/javascript" src="<? echo XINHA_INSTALL_URL; ?>/ddt/ddt.js"></script>
74
75  <!-- create a global trace message object -->
76
77  <script type="text/javascript">
78   var startupDDT = new DDT( "startup" );
79   startupDDT._ddtOn();
80
81        startupDDT._ddt( "full_example-body.php", "81", "ddt object created on calling page" );
82  </script>
83 
84  <!-- Load up the actual editor core -->
85  <script type="text/javascript" src="<? echo XINHA_INSTALL_URL; ?>/htmlarea.js"></script>
86
87  <script type="text/javascript">
88    xinha_editors = null;
89    xinha_init    = null;
90    xinha_config  = null;
91    xinha_plugins = null;
92
93    // This contains the names of textareas we will make into Xinha editors
94    xinha_init = xinha_init ? xinha_init : function()
95    {
96      /** STEP 1 ***************************************************************
97       * First, what are the plugins you will be using in the editors on this
98       * page.  List all the plugins you will need, even if not all the editors
99       * will use all the plugins.
100       ************************************************************************/
101
102      xinha_plugins = xinha_plugins ? xinha_plugins :
103      [
104       'CharacterMap',
105       'ContextMenu',
106       'FullScreen',
107       'ListType',
108       'SpellChecker',
109       'Stylist',
110       'SuperClean',
111       'TableOperations'
112      ];
113
114                // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :)
115                if (!HTMLArea.loadPlugins(xinha_plugins, xinha_init))
116                        return;
117
118      /** STEP 2 ***************************************************************
119       * Now, what are the names of the textareas you will be turning into
120       * editors?
121       ************************************************************************/
122
123      xinha_editors = xinha_editors ? xinha_editors :
124      [
125        'myTextArea',
126        'anotherOne'
127      ];
128
129      /** STEP 3 ***************************************************************
130       * We create a default configuration to be used by all the editors.
131       * If you wish to configure some of the editors differently this will be
132       * done in step 4.
133       *
134       * If you want to modify the default config you might do something like this.
135       *
136       *   xinha_config = new HTMLArea.Config();
137       *   xinha_config.width  = 640;
138       *   xinha_config.height = 420;
139       *
140       *************************************************************************/
141
142       xinha_config = xinha_config ? xinha_config : new HTMLArea.Config();
143
144      /** STEP 3 ***************************************************************
145       * We first create editors for the textareas.
146       *
147       * You can do this in two ways, either
148       *
149       *   xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
150       *
151       * if you want all the editor objects to use the same set of plugins, OR;
152       *
153       *   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config);
154       *   xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']);
155       *   xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']);
156       *
157       * if you want to use a different set of plugins for one or more of the
158       * editors.
159       ************************************************************************/
160
161      xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
162
163      /** STEP 4 ***************************************************************
164       * If you want to change the configuration variables of any of the
165       * editors,  this is the place to do that, for example you might want to
166       * change the width and height of one of the editors, like this...
167       *
168       *   xinha_editors.myTextArea.config.width  = 640;
169       *   xinha_editors.myTextArea.config.height = 480;
170       *
171       ************************************************************************/
172
173
174      /** STEP 5 ***************************************************************
175       * Finally we "start" the editors, this turns the textareas into
176       * Xinha editors.
177       ************************************************************************/
178
179      HTMLArea.startEditors(xinha_editors);
180    }
181
182    // calling xinha_init twice can cause a nasty little exception.
183    // window.onload = xinha_init;
184
185  </script>
186</head>
187
188<body onload="xinha_init()">
189
190  <form id="editors_here">
191    <textarea id="myTextArea" name="myTextArea" rows="10" cols="80" style="width:100%"></textarea>
192    <textarea id="anotherOne" name="anotherOne" rows="10" cols="80" style="width:100%"></textarea>
193  </form>
194
195
196  <!----------------------------------------------------------------------------
197    -                            !! IMPORTANT !!
198    -  The html and javascript below is the code used to create the example page.
199    -  It renders a lot of the above unused because it pre-fills xinha_editors,
200    -  xinha_config and xinha_plugins for you, and creates new textareas in place
201    -  of the ones above. The items above are not used while the example is being
202    -  used!
203    -
204    -  If you are going to take the code in this file to form the basis of your
205    -  own, then leave out this marked area.
206    --------------------------------------------------------------------------->
207
208    <div id="lipsum" style="display:none"><h1>TEST</h1></div>
209
210        <div id="lipsumx" style="display:none">
211          <p>This is an example of a Xinha editor with extensive trace messages
212                         turned on. To turn off trace messages, assuming you have the source, just
213                         comment out the _ddtOn() calls. Eventually we'll have a script that
214                         strips out the trace messages and comments to produce a "runtime' version.</p>
215
216          <p>This branch of Xinha development is called the Unified
217                         Backend branch. It includes a number of changes over the
218                         trunk<p>
219
220          <ul>
221            <li> JSDoc documentation headers on all functions (partially complete)  </li>
222            <li> _ddt() debugging trace messages added to most methods. </li>
223            <li> svn_commit.php front end to svn commit. </li>
224            <li> Configure.php script to generate server side scripts and permissions. </li>
225            <li> makedocs.pl script to generate documentation.</li>
226                                <li> unified PHP backend script in backends/backend.php through which all
227                                                plugin to server communications are routed (ImageManager and Linker are
228                                                done, SpellChecker is next).
229          </ul>
230
231                         <p>For more information see the README.txt and README_DEVELOPERS.txt
232                         file from the Xinha_ub branch.</p>
233        </div>
234
235        <script src="full_example.js"></script>
236
237  <!--------------------------------------------------------------------------->
238
239
240</body>
241</html>
Note: See TracBrowser for help on using the repository browser.