cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephane Delort" <Stephane.Del...@edag.de>
Subject [htmlarea] config file
Date Wed, 07 Jul 2004 07:33:23 GMT
Hi,

I saw the sample with htmlarea and found it pretty and am currently working
on adding this function into my webapp.

Though, I don't know how to specify an home-made file which could override
default settings.
(the way it is told in the htmlarea doc)

I pasted the code (1) from the doc into the file : "mycustomsettings.js"
and then, modify
"forms-htmlarea-styling.xsl"  with this <script type="text/javascript" src
="{$resources-uri}/htmlarea/mycustomsettings.js"></script>
but, unfortunatly, this, does NOT work.

regards,
Stephane




1 :
<script language="JavaScript1.2" defer>

// All our custom buttons will call this function when clicked.
// We use the buttonId parameter to determine what button
// triggered the call.
function clickHandler(editor, buttonId) {
  switch (buttonId) {
    case "my-toc":
      editor.insertHTML("<h1>Table Of Contents</h1>");
      break;
    case "my-date":
      editor.insertHTML((new Date()).toString());
      break;
    case "my-bold":
      editor.execCommand("bold");
      editor.execCommand("italic");
      break;
    case "my-hilite":
      editor.surroundHTML("<span class=\"hilite\">", "</span>");
      break;
  }
};

// Create a new configuration object
var config = new HTMLArea.Config();

// Register our custom buttons
config.registerButton("my-toc",  "Insert TOC", "my-toc.gif", false, clickHandler);
config.registerButton("my-date", "Insert date/time", "my-date.gif", false, clickHandler);
config.registerButton("my-bold", "Toggle bold/italic", "my-bold.gif", false, clickHandler);
config.registerButton("my-hilite", "Hilite selection", "my-hilite.gif", false, clickHandler);

// Append the buttons to the default toolbar
config.toolbar.push(["linebreak", "my-toc", "my-date", "my-bold", "my-hilite"]);

// Replace an existing textarea with an HTMLArea object having the above config.
HTMLArea.replace("textAreaID", config);

</script>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message