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 - Add-Ons:
customising multiple editors automatically


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.

 


aubrey
Novice

Aug 17, 2004, 12:55 PM

Post #1 of 3 (15709 views)
Shortcut
customising multiple editors automatically Can't Post

Is there a way to customize multiple editors without having to initialize each one? For example, it says to use htmlarea.replaceAll() to initalise all the editors on the page, but is there a way to initialise AND load plugins for all the editors on the page? I tried to write my own function to do this, but for some unknown reason it was a failure :-) all textboxes show up on the page as plain old textboxes, and nothing more. Mabye someone knows why?

My try at it:

<script type="text/javascript">
_editor_url = "/includes/HTMLArea/";
_editor_lang = "en";
</script>

<!-- load the main HTMLArea file, this will take care of loading the CSS and
other required core scripts. -->
<script type="text/javascript" src="/includes/HTMLArea/htmlarea.js"></script>

<!-- load the plugins -->
<script type="text/javascript">
// WARNING: using this interface to load plugin
// will _NOT_ work if plugins do not have the language
// loaded by HTMLArea.
// In other words, this function generates SCRIPT tags
// that load the plugin and the language file, based on the
// global variable HTMLArea.I18N.lang (defined in the lang file,
// in our case "lang/en.js" loaded above).

// If this lang file is not found the plugin will fail to
// load correctly and nothing will work.

HTMLArea.loadPlugin("TableOperations");
HTMLArea.loadPlugin("SpellChecker");
HTMLArea.loadPlugin("CSS");
HTMLArea.loadPlugin("ImageManager");

</script>

<script type="text/javascript">
var editor = null;
function initEditors() {

var tas = document.getElementsByTagName("textarea");
for (var i = tas.length; i > 0; editor = new HTMLArea(tas)) {

alert(tas);
alert(tas.name);
alert(tas[--i]);

// register the SpellChecker plugin
editor.registerPlugin(TableOperations);

// register the SpellChecker plugin
editor.registerPlugin(SpellChecker);

// register the CSS plugin
editor.registerPlugin(CSS, {
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"
}
}
]
});


// load the stylesheet used by our CSS plugin configuration
editor.config.pageStyle = "@import url(custom.css);";

editor.generate();
}
}

function insertHTML() {
var html = prompt("Enter some HTML code here");
if (html) {
editor.insertHTML(html);
}
}
function highlight() {
editor.surroundHTML('<span style="background-color: yellow">', '</span>');
}
</script>
</head>
<body onload="initEditors()">

Hopefully someone can think of a solution,

-Aubrey


JimmyVH
Novice

Aug 24, 2004, 7:56 AM

Post #2 of 3 (15662 views)
Shortcut
Re: [aubrey] customising multiple editors automatically [In reply to] Can't Post

Check this one:

http://www.interactivetools.com/iforum/Open_Source_C3/htmlArea_v3.0_-_Beta_Release_F14/multiple_areas_%2B_plugins_%2B_HTMLArea.replace%28%29_P29000/


aubrey
Novice

Aug 24, 2004, 11:29 AM

Post #3 of 3 (15652 views)
Shortcut
Re: [JimmyVH] customising multiple editors automatically [In reply to] Can't Post

Thanks,

Viperal's function was just what I was looking for!

-Aubrey

 
 
 


Search for (options)