htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 3 (beta): htmlArea 2 & 3 archive (read only): htmlArea v3.0 - Discussion:
HTMLArea Help Needed, URGENT!!!!


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

 


prism
New User

Dec 23, 2004, 1:59 AM

Post #1 of 2 (3995 views)
Shortcut
HTMLArea Help Needed, URGENT!!!! Can't Post

i want to concatenate some new text to the already existing text in HTMLArea

for this what i have done is as below

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Example of seperate toolbar & Iframe</title>
<script type="text/javascript">
// the _editor_url is REQUIRED! don't forget to set it.
_editor_url = "../";
// implicit language will be "en", but let's set it for brevity
_editor_lang = "en";
</script>
<script type="text/javascript" src="../htmlarea.js"></script>
<script type="text/javascript">
// load the plugins that we will use
// loading is necessary ONLY ONCE, regardless on how many editors you create
// basically calling the following functions will load the plugin files as if
// we would have wrote script src="..." but with easier and cleaner code
HTMLArea.loadPlugin("TableOperations");
HTMLArea.loadPlugin("SpellChecker");
HTMLArea.loadPlugin("CSS");

// this function will get called at body.onload
function initDocument() {
// cache these values as we need to pass it for both editors
var css_plugin_args = {
combos : [
{ label: "Syntax",
// menu text // CSS class
options: { "None" : "",
"Code" : "code",
"String" : "string",
"Comment" : "comment",
"Variable name" : "variable-name",
"Type" : "type",
"Reference" : "reference",
"Preprocessor" : "preprocessor",
"Keyword" : "keyword",
"Function name" : "function-name",
"Html tag" : "html-tag",
"Html italic" : "html-helper-italic",
"Warning" : "warning",
"Html bold" : "html-helper-bold"
},
context: "pre"
},
{ label: "Info",
options: { "None" : "",
"Quote" : "quote",
"Highlight" : "highlight",
"Deprecated" : "deprecated"
}
}
]
};

//---------------------------------------------------------------------
// GENERAL PATTERN
//
// 1. Instantitate an editor object.
// 2. Register plugins (note, it's required to have them loaded).
// 3. Configure any other items in editor.config.
// 4. generate() the editor
//
// The above are steps that you use to create one editor. Nothing new
// so far. In order to create more than one editor, you just have to
// repeat those steps for each of one. Of course, you can register any
// plugins you want (no need to register the same plugins for all
// editors, and to demonstrate that we'll skip the TableOperations
// plugin for the second editor). Just be careful to pass different
// ID-s in the constructor (you don't want to _even try_ to create more
// editors for the same TEXTAREA element ;-)).
//
// So much for the noise, see the action below.
//---------------------------------------------------------------------


//---------------------------------------------------------------------
// CREATE FIRST EDITOR
//
var editor1 = new HTMLArea("text-area-1");

// plugins must be registered _per editor_. Therefore, we register
// plugins for the first editor here, and we will also do this for the
// second editor.
editor1.registerPlugin(TableOperations);
editor1.registerPlugin(SpellChecker);
editor1.registerPlugin(CSS, css_plugin_args);

// custom config must be done per editor. Here we're importing the
// stylesheet used by the CSS plugin.
editor1.config.pageStyle = "@import url(custom.css);";

// generate first editor
editor1.generate();

// generate toolbar
editor1.display_toolbar();
};
</script>



<script language="JavaScript">
<!--
function read_value(form)
{
var value = form.text1.value;

value += "NEW val";

var editor1 = new HTMLArea("text-area-1");
editor1.set_NewHtml(value);
}
//-->
</script>
</head>

<body onload="initDocument()">
<h1>Example of seperate toolbar & Iframe</h1>

<form action="" method="post" target="_blank">
<table border="1">
<tr>
<td><textarea id="text-area-1" name="text1" style="width: 100%; height: 12em">test test</textarea></td>
<td>test</td>
</tr>
<tr>
<td><input type="button" name="read_text" value="Read Value" onclick="javascript:read_value(this.form);"></td>
<td>test</td>
</tr>
<tr>
<td><h1>new test</h1></td>
<td><h1>sdfsdf</h1></td>
</tr>
</table>
</form>





</body>

</html>


set_NewHtml function is teh new function that i have written in htmlarea.js file.This function is as below

HTMLArea.prototype.set_NewHtml = function (newhtml) {

this.setHTML(newhtml);

};



setHTML function is alerady defined in htmlarea.js but i get error this._doc.body is null or not an object



can anybody help meUnsure


maheshvn
Novice

Dec 24, 2004, 2:17 AM

Post #2 of 2 (3934 views)
Shortcut
Re: [prism] HTMLArea Help Needed, URGENT!!!! [In reply to] Can't Post

I have also faced this error as this._doc is not declared.
try this

editor._iframe.contentWindow.document.body.innerHTML = newhtml + editor._iframe.contentWindow.document.body.innerHTML
or try this
say ur textarea id is txtDescription.
In the function HTMLArea.prototype.generate = function () in htmlarea.js, add the following
var iframeid = this._textArea;
in the place where is the IFrame is getting created add this
iframe.id = "_"+iframeid+"_editor";

now u can add ur text
document.all._txtDescription_editor.contentWindow.document.body.innerHTML = yourtext + document.all._txtDescription_editor.contentWindow.document.body.innerHTML;
hope this helps

 
 
 


Search for (options)