Re: Problem using CE as a seperate Flash/.swf selector

  •  12-04-2010, 1:04 PM

    Re: Problem using CE as a seperate Flash/.swf selector

    Dear spencet,
     
    Please refer to the following code:
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <%@ Page Language="C#" %>
    <html>
    <head>
        <title>ASP and ASP.NET WYSIWYG Editor - Use CuteEditor as a document selector</title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="10" nowrap>
                    </td>
                    <td width="20" nowrap>
                    </td>
                    <td valign="top" width="760">
                        <b>Use CuteEditor as a document selector</b>
                        <hr>
                        This example demonstrates how to use CuteEditor as a document selector.
                        <br>
                        <br>
                        <asp:TextBox ID="imageFld" Width="300" runat="server" />
                        <input type="button" value="Pick a file" onclick="callInsertImage()" id="Change"
                            runat="server" name="Change">
                        <div>
                            <CE:Editor ID="Editor1" runat="server" Width="1" Height="1" AutoConfigure="None"
                                ShowHtmlMode="False" ShowPreviewMode="False" EnableContextMenu="false" ShowGroupMenuImage="False"
                                ShowBottomBar="False" BackColor="White" BorderColor="White">
                            </CE:Editor>
                            <br>
                        </div>
                    </td>
                </tr>
            </table>
        </form>
         <Script Language="javascript">   
        function callInsertImage()    
        {    
                var editor1 = document.getElementById('CE_Editor1_ID');  
                editor1.FocusDocument();    
                var editdoc = editor1.GetDocument();    
                editor1.ExecCommand('new');  
                editor1.ExecCommand('InsertFlash');  
                InputURL();  
        }  
          
        function InputURL()  
        {   
            var editor1 = document.getElementById('CE_Editor1_ID');  
            var editdoc = editor1.GetDocument();    
            var imgs = editdoc.images;  
            if(editor1.getHTML()!="")    
            {     
                var s = editor1.getHTML();  
                s=s.replace(/(<object[^\>]*>[\s|\S]*?)(<embed[^\>]*?)(\ssrc=\s*)\s*("|')(.+?)\4([^>]*)(.*<\/embed>)[\s|\S]*?<\/object>/gi,"$5");  
                document.getElementById("imageFld").value = s;  
                editor1.ExecCommand('new');  
                document.getElementById("imageFld").focus();   
            }    
            else 
            {  
                setTimeout(InputURL,500);   
            }    
        }         
    </script>
    </body>
    </html>
     
    Thank you for asking
View Complete Thread