Append text into the cuteeditor

Last post 06-21-2007, 4:38 PM by AnnieSun. 4 replies.
Sort Posts: Previous Next
  •  06-21-2007, 2:23 PM 30970

    Append text into the cuteeditor

    Hello, I'm using the example page : customize.aspx.   
     
    In the page, it add a tool control to append the local time into the cuteeditor. However, it insert the text at the beginning.   The code is:

    Image1.Attributes("onclick")="var d = new Date(); CuteEditor_GetEditor(this).ExecCommand('PasteHTML',false,d.toLocaleDateString())"

    is there a way to "append" text into the cuteeditor?
     
    Thank you so much,
     
    Annie
  •  06-21-2007, 2:58 PM 30975 in reply to 30970

    Re: Append text into the cuteeditor

    Annie,
     
    The above example pastes the HTML code in the cursor position.
     
    Please check the following article:

     
    create/register a custom button (Server Control) to Cute Editor

    How to create/register a custom button (Server Control) so that it can be used in the template?( C# | VB )

    This example demonstrates how easy it can be to add Server Controls to the CuteEditor and register it into Cute Editor toolbar.

     
     
    Is that what you are looking for?
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  06-21-2007, 3:39 PM 30978 in reply to 30975

    Re: Append text into the cuteeditor

    Hello Adam,
     
    Thanks for the prompt reply.  Yes and No. I'm looking for something like the javascript in my first post.  I would prefer doing the appending of the text from javascript, rather than from server code.
     
    If what you are saying is that if the cursor was put at the end of the text in the cuteeditor, then the javascript in my first post, would insert text at the end.   However, the user might not put the cursor inside the cuteeditor, but just click on the button though.  Is there a similiar javascript function call that I can make to make it "append" text automatically?
     
    Thank you so much,
     
    Sincerely,
    Annie
  •  06-21-2007, 4:22 PM 30981 in reply to 30978

    Re: Append text into the cuteeditor

    Annie,
     
    You can move the cursor position to the end of your content.
     
    Please Try the following code:
     
    function set_cursor_at_End()
    {

     try{
           // get the cute editor instance
          var editor1 = document.getElementById('<%= Editor1.ClientID%>');
       // get the active editor document
       var editdoc = editor1.GetDocument();

       // get the active editor selection
       var sel = editor1.GetSelection();

       var r = sel.createRange();
       r.moveToElementText(editdoc.body);
       r.select();
       r.collapse(false); // set to true if you want to move cursor to begin
       r.select();
    }
    catch(e){}
    }
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  06-21-2007, 4:38 PM 30983 in reply to 30981

    Re: Append text into the cuteeditor

    WOW Adam,  thank you so much for the quick reply.   I'm very impressed.     I like the cute editor!!!  
     
    Thanks again.
     
    Annie
View as RSS news feed in XML