Hi gim-matt,
Yes, please try the example below, I added two editors in it. one is the normal editor, another ues for image selector.
- <%@ Page Language="c#" %>
-
- <%@ Register TagPrefix="RTE" Namespace="RTE" Assembly="RichTextEditor" %>
-
- <script runat="server">
- </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 - Editor as image selector</title>
- <link rel="stylesheet" href="../example.css" type="text/css" />
- <script type="text/javascript">
- var editor;
- var showed = false;
-
- function ShowEditorGallery() {
- showed = true;
- if (editor) {
- editor.ExecUICommand(null, "InsertGallery");
- }
- }
-
- function RichTextEditor_OnLoad(argeditor) {
- var config = argeditor._config;
- if (config.uniqueid == "Editor1") {
- config.showtoolbar = false;
- config.showtoolbar_code = false;
- config.showbottombar = false;
- config.preloadplugins = "";
- var div = document.getElementById(config.containerid);
- div.style.display = "none";
- editor = argeditor;
- if (showed)
- ShowEditorGallery()
- }
- }
-
- function RichTextEditor_OnTextChanged() {
- if (!showed) return;
- showed = false;
- var img = editor.GetPointNode();
- if (img && img.GetNameLower() == "img") {
- var src = img.GetAttribute("src");
- OnGetImageUrl(src);
- }
- editor.SetText("");
- }
- function OnGetImageUrl(src) {
- document.getElementById("result").innerHTML = "You selected : " + src;
- }
-
- </script>
- </head>
- <body>
- <form id="Form1" method="post" runat="server">
- <RTE:Editor runat="server" ID="Editor2" />
- <div style="display: none;">
- <RTE:Editor runat="server" ID="Editor1" />
- </div>
-
- <br />
- <div>
- <button type="button" onclick="ShowEditorGallery();return false;">Select Image</button>
- </div>
- <br />
- <div id="result"></div>
- </form>
- </body>
- </html>
Regards,
Ken