Hi fulles,
I have correct the example page to support multiple editors, please try it.
- <%@ Page Language="c#" %>
-
- <%@ Register TagPrefix="RTE" Namespace="RTE" Assembly="RichTextEditor" %>
-
- <script runat="server">
- protected override void OnInit(EventArgs e)
- {
- base.OnInit(e);
-
- Editor1.ToolbarItems = "{bold,italic,underlinemenu}{forecolor,backcolor,fontname,fontsize}{justifyleft,justifycenter,justifyright,justifyfull}{insertorderedlist,insertunorderedlist,outdent,indent}{insertlink,insertimage,insertblockquote,syntaxhighlighter}{unlink,removeformat}//{mydialog1}";
- }
-
- </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" />
-
- <link type="text/css" href="http://jquery-ui.googlecode.com/svn/tags/1.8.22/themes/ui-lightness/jquery-ui.css"
- rel="stylesheet" />
-
- <script type="text/javascript" src="http://jquery-ui.googlecode.com/svn/tags/1.8.22/jquery-1.7.2.js"></script>
-
- <script type="text/javascript" src="http://jquery-ui.googlecode.com/svn/tags/1.8.22/ui/jquery-ui.js"></script>
-
- <script type="text/javascript">
- var editor;
- function RichTextEditor_OnLoad(rteeditor) {
- editor = rteeditor;
- }
- $(function () {
- $('#dialog').dialog({
- autoOpen: false,
- width: 350,
- buttons: {
- "Ok": function () {
- if (editor) {
- editor.AppendHTML(document.getElementById("txt_input").value);
- document.getElementById("txt_input").value = "";
- }
- $(this).dialog("close");
- },
- "Cancel": function () {
- $(this).dialog("close");
- }
- }
- });
- });
- </script>
-
- <script type="text/javascript">
- var loader;
-
- function RichTextEditor_OnCoreLoad(rteloader) {
- loader = rteloader;
-
- var config = loader._config;
- if (config.uniqueid == "Editor1") {
- var toolbar = config._toolbartemplate || config.toolbar;
-
- var basetype = "image_" + config.skin + "_" + config.color;
-
- var dialog1 = "item_" + toolbar + "_" + config.skin + "_" + config.color + "_mydialog1";
- var define = jsml.class_define(dialog1, basetype);
- define.constructor(function () {
- this[basetype + "_constructor"]();
- this.set_imagename("openfolder");
- this.set_tooltip("My custom dialog!");
- });
- define.attach("click", function () {
- $('#dialog').dialog('open');
- return false;
- });
- }
-
-
- }
-
- </script>
-
- </head>
- <body>
- <form id="Form1" method="post" runat="server">
- <h1>Adding custom buttons (dialog)</h1>
- <p>
- The Rich Text Editor allows you extend the functions of the editor. You can create
- new custom buttons and add them to the editor's toolbar list.
- </p>
- <p>
- <RTE:Editor runat="server" ID="Editor1" />
- <RTE:Editor runat="server" ID="Editor2" />
- </p>
- <div id="dialog" title="RichTextEditor Custom Dialog" style="display: none;">
- <textarea id="txt_input" rows="4" style="width: 300px; height: 200px;"></textarea>
- </div>
- </form>
- </body>
- </html>
Regards,
Ken