A directory of browser-based WYSIWYG editors


Home: WYSIWYG Forums: WYSIWYG Editor Discussion:
HTMLArea 3 not <html> or <head> BUT <body> for newsletter


New User

Jun 1, 2005, 5:15 AM

Post #1 of 1 (14141 views)
HTMLArea 3 not <html> or <head> BUT <body> for newsletter Can't Post


I'm trying to customize the HTML Area 3 so that I can use it for editing and creating an HTML newsletter (I offer text version to users as well).

I have downloaded the latest htmlarea.js script from the CVS at Sourceforge and implemented the following changes. I get the desired changes in IE 6.0 but firefox still leaves the <head></head> part.

This is what I did:

 HTMLArea.prototype.getHTML = function() { 
switch (this._editMode) {
case "wysiwyg" :
if (!this.config.fullPage) {
return HTMLArea.getHTML(this._doc.body, false, this);
} else
//TN this is where the <html><head></head></html> is outputted:
//used to be: return this.doctype + "\n" + HTMLArea.getHTML(this._doc.documentElement, true, this);
return HTMLArea.getHTML(this._doc.documentElement, false, this);
case "textmode" : return this._textArea.value;
default : alert("Mode <" + mode + "> not defined!");
return false;

I then also commented the following lines out:

   if (HTMLArea.is_ie && root_tag == "head") { 
if (outputRoot)
//TN removed for newsletter: html += "<head>";
// lowercasize
var save_multiline = RegExp.multiline;
RegExp.multiline = true;
var txt = root.innerHTML.replace(HTMLArea.RE_tagName, function(str, p1, p2) {
return p1 + p2.toLowerCase();
RegExp.multiline = save_multiline;
html += txt;
if (outputRoot)
//TN removed for newsletter: html += "</head>";

This works for in IE 6.0 but not in the latest Firefox. I get the <head></head> before my <body> tag.

I also tried to remove the instance of the head closing tag:

 //TN removed head for newsletter: HTMLArea._closingTags = " head script style div span tr td tbody table em strong b i code cite dfn abbr acronym font a title "; 
HTMLArea._closingTags = " script style div span tr td tbody table em strong b i code cite dfn abbr acronym font a title ";

but that didn't quite work. Instead Firefox adds the head tag an treats it like a single tag like:

 <head /><body>

Obviously I'm not an expert in javascript and would therefore love it if someone could point out what I'm doing wrong. The other option for me would be to not do the editor.config.fullPage = true; and instead come up with a way to allow the <body> tag in the normal size (not FULL HTML) editor.

If anyone got an idea on how to do it that way I would be extatic.

I plan on renaming the htmlarea.js file to newsletter_htmlarea.js and calling it that way for the newsletter.Then just leave the default htmlarea.js script for other pages.

Thanks in advance,



Search for (options)