Import xinha so we can switch from htmlarea and fix a bunch of in-browser issues that htmlarea has

This commit is contained in:
Chris Morgan
2005-09-30 02:25:07 +00:00
committed by WineHQ
parent 2311d4d572
commit 9242a68c4a
375 changed files with 26623 additions and 0 deletions

40
xinha/examples/custom.css Normal file
View File

@@ -0,0 +1,40 @@
/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
-- CSS plugin example CSS file. This file is used by full_example.js
-- when the CSS plugin is included in an auto-generated example.
-- @TODO Make this CSS more useful.
--
-- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/custom.css $
-- $LastChangedDate: 2005-02-19 17:10:03 +1300 (Sat, 19 Feb 2005) $
-- $LastChangedRevision: 14 $
-- $LastChangedBy: gogo $
--------------------------------------------------------------------------*/
body { background-color: #234; color: #dd8; font-family: tahoma; font-size: 12px; }
a:link, a:visited { color: #8cf; }
a:hover { color: #ff8; }
h1 { background-color: #456; color: #ff8; padding: 2px 5px; border: 1px solid; border-color: #678 #012 #012 #678; }
/* syntax highlighting (used by the first combo defined for the CSS plugin) */
pre { margin: 0px 1em; padding: 5px 1em; background-color: #000; border: 1px dotted #02d; border-left: 2px solid #04f; }
.code { color: #f5deb3; }
.string { color: #00ffff; }
.comment { color: #8fbc8f; }
.variable-name { color: #fa8072; }
.type { color: #90ee90; font-weight: bold; }
.reference { color: #ee82ee; }
.preprocessor { color: #faf; }
.keyword { color: #ffffff; font-weight: bold; }
.function-name { color: #ace; }
.html-tag { font-weight: bold; }
.html-helper-italic { font-style: italic; }
.warning { color: #ffa500; font-weight: bold; }
.html-helper-bold { font-weight: bold; }
/* info combo */
.quote { font-style: italic; color: #ee9; }
.highlight { background-color: yellow; color: #000; }
.deprecated { text-decoration: line-through; color: #aaa; }

View File

@@ -0,0 +1,56 @@
/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
-- DynamicCSS plugin example CSS file. Used by full_example.js
-- when the DynamicCSS plugin is included in an auto-generated example.
-- @TODO Make this CSS more useful.
--
-- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/dynamic.css $
-- $LastChangedDate: 2005-02-19 17:10:03 +1300 (Sat, 19 Feb 2005) $
-- $LastChangedRevision: 14 $
-- $LastChangedBy: gogo $
--------------------------------------------------------------------------*/
p {
FONT-FAMILY: Arial, Helvetica;
FONT-SIZE: 9pt;
FONT-WEIGHT: normal;
COLOR: #000000;
}
p.p1 {
FONT-FAMILY: Arial, Helvetica;
FONT-SIZE: 11pt;
FONT-WEIGHT: normal;
COLOR: #000000;
}
p.p2 {
FONT-FAMILY: Arial, Helvetica;
FONT-SIZE: 13pt;
FONT-WEIGHT: normal;
COLOR: #000000;
}
div {
FONT-FAMILY: Arial, Helvetica;
FONT-SIZE: 9pt;
FONT-WEIGHT: bold;
COLOR: #000000;
}
div.div1 {
FONT-FAMILY: Arial, Helvetica;
FONT-SIZE: 11pt;
FONT-WEIGHT: bold;
COLOR: #000000;
}
div.div2 {
FONT-FAMILY: Arial, Helvetica;
FONT-SIZE: 13pt;
FONT-WEIGHT: bold;
COLOR: #000000;
}
.quote { font-style: italic; color: #ee9; }
.highlight { background-color: yellow; color: #000; }
.deprecated { text-decoration: line-through; color: #aaa; }

View File

@@ -0,0 +1,185 @@
<!DOCTYPE BHTML PUBLIC "-//BC//DTD BHTML 3.2 Final//EN">
<html>
<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/full_example-body.html $
-- $LastChangedDate: 2005-07-28 02:43:19 +1200 (Thu, 28 Jul 2005) $
-- $LastChangedRevision: 287 $
-- $LastChangedBy: gocher $
--------------------------------------------------------------------------->
<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\/full_example-body\.html.*/, '')
_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',
'ContextMenu',
'FullScreen',
'ListType',
'SpellChecker',
'Stylist',
'SuperClean',
'TableOperations'
];
// THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :)
if(!HTMLArea.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',
'anotherOne'
];
/** 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 5.
*
* If you want to modify the default config you might do something like this.
*
* xinha_config = new HTMLArea.Config();
* xinha_config.width = '640px';
* xinha_config.height = '420px';
*
*************************************************************************/
xinha_config = xinha_config ? xinha_config() : new HTMLArea.Config();
/** STEP 4 ***************************************************************
* We first create editors for the textareas.
*
* You can do this in two ways, either
*
* xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
*
* if you want all the editor objects to use the same set of plugins, OR;
*
* xinha_editors = HTMLArea.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 = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
/** STEP 5 ***************************************************************
* 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 = '640px';
* xinha_editors.myTextArea.config.height = '480px';
*
************************************************************************/
/** STEP 6 ***************************************************************
* Finally we "start" the editors, this turns the textareas into
* Xinha editors.
************************************************************************/
HTMLArea.startEditors(xinha_editors);
}
window.onload = xinha_init;
</script>
<!--link type="text/css" rel="alternate stylesheet" title="blue-look" href="../skins/blue-look/skin.css" />
<link type="text/css" rel="alternate stylesheet" title="green-look" href="../skins/green-look/skin.css" />
<link type="text/css" rel="alternate stylesheet" title="xp-blue" href="../skins/xp-blue/skin.css" />
<link type="text/css" rel="alternate stylesheet" title="xp-green" href="../skins/xp-green/skin.css" />
<link type="text/css" rel="alternate stylesheet" title="inditreuse" href="../skins/inditreuse/skin.css" />
<link type="text/css" rel="alternate stylesheet" title="blue-metallic" href="../skins/blue-metallic/skin.css" /-->
</head>
<body>
<form id="editors_here">
<textarea id="myTextArea" name="myTextArea" rows="10" cols="80" style="width:100%"></textarea>
<textarea id="anotherOne" name="anotherOne" rows="10" cols="80" style="width:100%"></textarea>
</form>
<!-- *************************************************************************
- !! IMPORTANT !!
- The html and javascript below is the code used to create the example page.
- It renders a lot of the above unused because it pre-fills xinha_editors,
- xinha_config and xinha_plugins for you, and creates new textareas in place
- of the ones above. The items above are not used while the example is being
- used!
-
- If you are going to take the code in this file to form the basis of your
- own, then leave out this marked area.
- ********************************************************************* -->
<div id="lipsum" style="display:none">
<p>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.</p>
<ul>
<li> Phasellus et massa sed diam viverra semper. </li>
<li> Mauris tincidunt felis in odio. </li>
<li> Nulla placerat nunc ut pede. </li>
<li> Vivamus ultrices mi sit amet urna. </li>
<li> Quisque sed augue quis nunc laoreet volutpat.</li>
<li> Nunc sit amet metus in tortor semper mattis. </li>
</ul>
</div>
<script src="full_example.js"></script>
<!-- ********************************************************************* -->
</body>
</html>

View File

@@ -0,0 +1,187 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!--
:noTabs=true:tabSize=2:indentSize=2:
Xinha example menu. This file is used by full_example.html within a
frame to provide a menu for generating example editors using
full_example-body.html, and full_example.js.
-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example of Xinha</title>
<link rel="stylesheet" href="full_example.css" type="text/css">
<style type="text/css">
form, p {margin:0; padding:0;}
label {display:block;}
#numeditor {width:25px;}
.options {display:none;}
</style>
<script type="text/javascript">
function checkPluginsOptions()
{
var plugins = document.forms[0].elements['plugins'];
for(var x = 0; x < plugins.length; x++)
if (document.getElementById(plugins[x].value + 'Options'))
document.getElementById(plugins[x].value + 'Options').style.display = (plugins[x].checked)? 'block':'none';
}
function toggleOnChange(elt) {
document.getElementById(elt.value + 'Options').style.display = (elt.checked)? 'block':'none';
}
</script>
</head>
<body onload="checkPluginsOptions();">
<form action="full_example-body.html" target="body">
<p>
Select from the options below and <input type="submit" value="click to show Example">
</p>
<fieldset>
<legend>Settings</legend>
<label>
Number of Editors: <input type="text" name="num" value="1" id="numeditor" maxlength="2">
</label>
<label>
Language:
<select name="lang">
<option value="en">English</option>
<option value="de">German</option>
<option value="fr">French</option>
<option value="it">Italian</option>
</select>
</label>
<label>
Skin:
<select name="skin">
<option value="blue-look">blue-look</option>
<option value="green-look">green-look</option>
<option value="xp-blue">xp-blue</option>
<option value="xp-green">xp-green</option>
<option value="inditreuse">inditreuse</option>
<option value="blue-metallic">blue-metallic</option>
</select>
</label>
</fieldset>
<fieldset>
<legend>Plugins</legend>
<label>
<input type="checkbox" name="plugins" value="Abbreviation"> Abbreviation
</label>
<label>
<input type="checkbox" name="plugins" value="CharacterMap" checked="checked" onchange="toggleOnChange(this);"> CharacterMap
</label>
<div id="CharacterMapOptions" class="options">
mode : <select name="CharacterMapMode">
<option value="popup">popup</option>
<option value="panel">panel</option>
</select>
</div>
<label>
<input type="checkbox" name="plugins" value="CharCounter"> CharCounter
</label>
<label>
<input type="checkbox" name="plugins" value="ContextMenu" checked="checked"> ContextMenu
</label>
<label>
<input type="checkbox" name="plugins" value="CSS" > CSS
</label>
<label>
<input type="checkbox" name="plugins" value="DoubleClick"> DoubleClick
</label>
<label>
<input type="checkbox" name="plugins" value="DynamicCSS" > DynamicCSS
</label>
<label>
<input type="checkbox" name="plugins" value="EditTag"> EditTag
</label>
<label>
<input type="checkbox" name="plugins" value="Equation"> Equation
</label>
<label>
<input type="checkbox" name="plugins" value="FindReplace" checked="checked"> FindReplace
</label>
<label>
<input type="checkbox" name="plugins" value="FormOperations"> FormOperations
</label>
<label>
<input type="checkbox" name="plugins" value="Forms"> Forms
</label>
<label>
<input type="checkbox" name="plugins" value="FullPage" > FullPage
</label>
<label>
<input type="checkbox" name="plugins" value="FullScreen" checked="checked"> FullScreen
</label>
<label>
<input type="checkbox" name="plugins" value="InsertAnchor" checked="checked"> InsertAnchor
</label>
<label>
<input type="checkbox" name="plugins" value="InsertMarquee"> InsertMarquee
</label>
<label>
<input type="checkbox" name="plugins" value="InsertSmiley"> InsertSmiley
</label>
<label>
<input type="checkbox" name="plugins" value="InsertWords"> InsertWords
</label>
<label>
<input type="checkbox" name="plugins" value="LangMarks"> LangMarks
</label>
<label>
<input type="checkbox" name="plugins" value="ListType" checked="checked" onchange="toggleOnChange(this);"> ListType
</label>
<div id="ListTypeOptions" class="options">
mode : <select name="ListTypeMode">
<option value="toolbar">toolbar</option>
<option value="panel">panel</option>
</select>
</div>
<label>
<input type="checkbox" name="plugins" value="NoteServer"> NoteServer
</label>
<label>
<input type="checkbox" name="plugins" value="QuickTag"> QuickTag
</label>
<label>
<input type="checkbox" name="plugins" value="Stylist" checked="checked"> Stylist
</label>
<label>
<input type="checkbox" name="plugins" value="TableOperations" checked="checked"> TableOperations
</label>
<label>
<input type="checkbox" name="plugins" value="Template"> Template
</label>
<label>
<input type="checkbox" name="plugins" value="BackgroundImage"> BackgroundImage
</label>
</fieldset>
<fieldset>
<legend>PHP Plugins</legend>
<p>
<small>These plugins require PHP in order to run.</small>
</p>
<label>
<input type="checkbox" name="plugins" value="HtmlTidy"> HtmlTidy
</label>
<label>
<input type="checkbox" name="plugins" value="ImageManager"> ImageManager
</label>
<label>
<input type="checkbox" name="plugins" value="Linker"> Linker
</label>
<label>
<input type="checkbox" name="plugins" value="SpellChecker"> SpellChecker
</label>
<label>
<input type="checkbox" name="plugins" value="SuperClean"> SuperClean
</label>
</fieldset>
</form>
<script type="text/javascript">
top.frames["body"].location.href = document.location.href.replace(/full_example-menu\.html.*/, 'full_example-body.html')
</script>
</body>
</html>

View File

@@ -0,0 +1,47 @@
/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
-- Xinha example CSS file. This is ripped from Trac ;)
--
-- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/full_example.css $
-- $LastChangedDate: 2005-02-19 17:10:03 +1300 (Sat, 19 Feb 2005) $
-- $LastChangedRevision: 14 $
-- $LastChangedBy: gogo $
--------------------------------------------------------------------------*/
body {
background: #fff;
color: #000;
margin: 10px;
}
body, th, td {
font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;
}
h1, h2, h3, h4 {
font-family: arial,verdana,'Bitstream Vera Sans',helvetica,sans-serif;
font-weight: bold;
letter-spacing: -0.018em;
}
h1 { font-size: 21px; margin: .15em 1em 0 0 }
h2 { font-size: 16px; margin: 2em 0 .5em; }
h3 { font-size: 14px; margin: 1.5em 0 .5em; }
hr { border: none; border-top: 1px solid #ccb; margin: 2em 0; }
address { font-style: normal }
img { border: none }
:link, :visited {
text-decoration: none;
color: #b00;
border-bottom: 1px dotted #bbb;
}
:link:hover, :visited:hover {
background-color: #eee;
color: #555;
}
h1 :link, h1 :visited ,h2 :link, h2 :visited, h3 :link, h3 :visited,
h4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited {
color: inherit;
}
.area_holder
{
margin:10px;
}

View File

@@ -0,0 +1,16 @@
<html>
<!--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
-- Xinha example frameset.
--
-- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/full_example.html $
-- $LastChangedDate: 2005-09-08 01:12:14 +1200 (Thu, 08 Sep 2005) $
-- $LastChangedRevision: 312 $
-- $LastChangedBy: gocher $
--------------------------------------------------------------------------->
<frameset cols="220,*">
<frame src="full_example-menu.html" name="menu">
<frame src="about:blank" name="body">
</frameset>
</html>

View File

@@ -0,0 +1,150 @@
/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
-- Xinha example logic. This javascript is used to auto-generate examples
-- as controlled by the options set in full_example-menu.html. it's called
-- from full_example-body.html.
--
-- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/full_example.js $
-- $LastChangedDate: 2005-09-15 00:09:22 +1200 (Thu, 15 Sep 2005) $
-- $LastChangedRevision: 318 $
-- $LastChangedBy: mokhet $
--------------------------------------------------------------------------*/
var num = 1;
if(window.parent && window.parent != window)
{
var f = window.parent.menu.document.forms[0];
_editor_lang = f.lang.value;
_editor_skin = f.skin.value;
num = parseInt(f.num.value);
if(isNaN(num))
{
num = 1;
f.num.value = 1;
}
xinha_plugins = [ ];
for(var x = 0; x < f.plugins.length; x++)
{
if(f.plugins[x].checked) xinha_plugins.push(f.plugins[x].value);
}
}
xinha_editors = [ ]
for(var x = 0; x < num; x++)
{
var ta = 'myTextarea' + x;
xinha_editors.push(ta);
}
xinha_config = function()
{
var config = new HTMLArea.Config();
if(typeof CSS != 'undefined')
{
config.pageStyle = "@import url(custom.css);";
}
if(typeof Stylist != 'undefined')
{
// We can load an external stylesheet like this - NOTE : YOU MUST GIVE AN ABSOLUTE URL
// otherwise it won't work!
config.stylistLoadStylesheet(document.location.href.replace(/[^\/]*\.html/, 'stylist.css'));
// Or we can load styles directly
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)
config.stylistLoadStyles('p.pink_text { color:pink }', {'p.pink_text' : 'Pretty Pink'});
}
if(typeof DynamicCSS != 'undefined')
{
config.pageStyle = "@import url(dynamic.css);";
}
if(typeof InsertWords != 'undefined')
{
// Register the keyword/replacement list
var keywrds1 = new Object();
var keywrds2 = new Object();
keywrds1['-- Dropdown Label --'] = '';
keywrds1['onekey'] = 'onevalue';
keywrds1['twokey'] = 'twovalue';
keywrds1['threekey'] = 'threevalue';
keywrds2['-- Insert Keyword --'] = '';
keywrds2['Username'] = '%user%';
keywrds2['Last login date'] = '%last_login%';
config.InsertWords = {
combos : [ { options: keywrds1, context: "body" },
{ options: keywrds2, context: "li" } ]
}
}
if (typeof ListType != 'undefined')
{
if(window.parent && window.parent != window)
{
var f = window.parent.menu.document.forms[0];
config.ListType.mode = f.elements['ListTypeMode'].options[f.elements['ListTypeMode'].selectedIndex].value;
}
}
if (typeof CharacterMap != 'undefined')
{
if(window.parent && window.parent != window)
{
var f = window.parent.menu.document.forms[0];
config.CharacterMap.mode = f.elements['CharacterMapMode'].options[f.elements['CharacterMapMode'].selectedIndex].value;
}
}
return config;
}
var f = document.forms[0];
f.innerHTML = '';
var lipsum = document.getElementById('lipsum').innerHTML;
for(var x = 0; x < num; x++)
{
var ta = 'myTextarea' + x;
var div = document.createElement('div');
div.className = 'area_holder';
var txta = document.createElement('textarea');
txta.id = ta;
txta.name = ta;
txta.value = lipsum;
txta.style.width="100%";
txta.style.height="420px";
div.appendChild(txta);
f.appendChild(div);
}
//check submitted values
var submit = document.createElement('input');
submit.type = "submit";
submit.id = "submit";
submit.value = "submit";
f.appendChild(submit);
var _oldSubmitHandler = null;
if (document.forms[0].onsubmit != null) {
_oldSubmitHandler = document.forms[0].onsubmit;
}
function frame_onSubmit(){
alert(document.getElementById("myTextarea0").value);
if (_oldSubmitHandler != null) {
_oldSubmitHandler();
}
}
document.forms[0].onsubmit = frame_onSubmit;

View File

@@ -0,0 +1,31 @@
/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
-- Stylist plugin example CSS file. Used by full_example.js
-- when the Stylist plugin is included in an auto-generated example.
--
-- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/stylist.css $
-- $LastChangedDate: 2005-07-19 18:23:58 +1200 (Tue, 19 Jul 2005) $
-- $LastChangedRevision: 277 $
-- $LastChangedBy: gogo $
--------------------------------------------------------------------------*/
.bluetext
{
color:blue;
}
p.blue_paragraph
{
color:darkblue;
}
li.green_list_item
{
color:green;
}
h1.webdings_lvl_1
{
font-family:webdings;
}
img.polaroid { border:1px solid black; background-color:white; padding:10px; padding-bottom:30px; }

174
xinha/examples/testbed.html Normal file
View File

@@ -0,0 +1,174 @@
<?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: svn://gogo@xinha.gogo.co.nz/repository/trunk/examples/full_example-body.html $
-- $LastChangedDate: 2005-03-05 21:42:32 +1300 (Sat, 05 Mar 2005) $
-- $LastChangedRevision: 35 $
-- $LastChangedBy: gogo $
--------------------------------------------------------------------------->
<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 :
[
];
// THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :)
if(!HTMLArea.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 HTMLArea.Config();
* xinha_config.width = 640;
* xinha_config.height = 420;
*
*************************************************************************/
xinha_config = xinha_config ? xinha_config : new HTMLArea.Config();
/*
// 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 = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
*
* if you want all the editor objects to use the same set of plugins, OR;
*
* xinha_editors = HTMLArea.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 = HTMLArea.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.
************************************************************************/
HTMLArea.startEditors(xinha_editors);
window.onload = null;
}
window.onload = xinha_init;
// window.onunload = HTMLArea.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;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;
</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>