This repository has been archived on 2025-05-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
qemudb/xinha/examples/testbed.html
Chris Morgan 2d4b27530d Upgrade to Xinha 0.931. Xinha has been optimized for size and dozens of issues have been closed
out since the last upgrade . Add Firefox and Xinha buttons to main page to show our support.
2007-05-31 22:43:05 +00:00

191 lines
8.2 KiB
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.python-hosting.com/trunk/examples/testbed.html $
-- $LastChangedDate: 2007-01-19 23:24:36 +0100 (Fr, 19 Jan 2007) $
-- $LastChangedRevision: 677 $
-- $LastChangedBy: ray $
--------------------------------------------------------------------------->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Example of Xinha</title>
<link rel="stylesheet" href="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="../htmlarea.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/, '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','FullScreen']);
* 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;
// window.onunload = Xinha.collectGarbageForIE;
</script>
</head>
<body>
<form action="javascript:var x = document.getElementById('editors_here');alert(x.myTextArea.value);" id="editors_here" onsubmit="alert(this.myTextArea.value);">
<textarea id="myTextArea" name="myTextArea" style="width:100%;height:320px;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Hello&lt;/title&gt;
&lt;style type="text/css"&gt;
li { color:red; }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;img src="http://xinha.python-hosting.com/trac/logo.jpg" usemap="#m1"&gt;
&lt;map name="m1"&gt;
&lt;area shape="rect" coords="137,101,255,124" href="http://www.mydomain.com"&gt;
&lt;/map&gt;
&lt;p&gt;
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. Aliquam nisl. Nulla posuere neque non
tellus. Morbi vel nibh. Cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus. Nam nec wisi. In wisi.
Curabitur pharetra bibendum lectus.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; Phasellus et massa sed diam viverra semper. &lt;/li&gt;
&lt;li&gt; Mauris tincidunt felis in odio. &lt;/li&gt;
&lt;li&gt; Nulla placerat nunc ut pede. &lt;/li&gt;
&lt;li&gt; Vivamus ultrices mi sit amet urna. &lt;/li&gt;
&lt;li&gt; Quisque sed augue quis nunc laoreet volutpat.&lt;/li&gt;
&lt;li&gt; Nunc sit amet metus in tortor semper mattis. &lt;/li&gt;
&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea>
<input type="submit" /> <input type="reset" />
</form>
<script language="javascript">
document.write(document.compatMode);
</script>
<a href="#" onclick="xinha_editors.myTextArea.hidePanels();">Hide</a>
<a href="#" onclick="xinha_editors.myTextArea.showPanels();">Show</a>
</body>
</html>