hi fulles,
Please try the new one below. Two editors has its own custom button.
- <%@ Page Language="c#" %>
-
- <%@ Register TagPrefix="RTE" Namespace="RTE" Assembly="RichTextEditor" %>
-
- <script runat="server">
- protected override void OnInit(EventArgs e)
- {
- base.OnInit(e);
-
- Editor1.ToolbarItems = "{unlink,removeformat}//{mybutton1}";
- Editor2.ToolbarItems = "{unlink,removeformat}//{mybutton2}";
- }
-
- </script>
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>RichTextEditor - Custom buttons</title>
- <link rel="stylesheet" href="../example.css" type="text/css" />
- </head>
- <body>
- <form id="Form1" method="post" runat="server">
- <p>
- <RTE:Editor runat="server" ID="Editor1" />
- <br /><br />
- <RTE:Editor runat="server" ID="Editor2" />
- </p>
-
- </form>
- </body>
- </html>
- <script type="text/javascript">
- var editor1;
- var editor2;
- function RichTextEditor_OnLoad(editor) {
- if (editor._config.uniqueid == "Editor1") {
- editor1 = editor;
- }
- if (editor._config.uniqueid == "Editor2") {
- editor2 = editor;
- }
-
- }
- function RichTextEditor_OnCoreLoad(rteloader) {
- var config = rteloader._config;
- if (config.uniqueid == "Editor1") {
- var config = rteloader._config;
- var toolbar = config._toolbartemplate || config.toolbar;
-
- var btnname = "item_" + toolbar + "_" + config.skin + "_" + config.color + "_mybutton1";
- var basetype = "image_" + config.skin + "_" + config.color;
-
- var define = jsml.class_define(btnname, basetype);
- define.constructor(function () {
- this[basetype + "_constructor"]();
- this.set_imagename("openfolder");
- this.set_tooltip("My custom button!");
- });
- define.attach("click", function () {
- editor1.InsertHTML("editor1");
- });
- }
-
- if (config.uniqueid == "Editor2") {
- var config = rteloader._config;
- var toolbar = config._toolbartemplate || config.toolbar;
-
- var btnname = "item_" + toolbar + "_" + config.skin + "_" + config.color + "_mybutton2";
- var basetype = "image_" + config.skin + "_" + config.color;
-
- var define = jsml.class_define(btnname, basetype);
- define.constructor(function () {
- this[basetype + "_constructor"]();
- this.set_imagename("openfolder");
- this.set_tooltip("My custom button!");
- });
- define.attach("click", function () {
- editor2.InsertHTML("editor2");
- });
- }
-
- }
-
- </script>
Regards,
Ken