How can I show text that I type in a RadEditor in another RadEditor

2 posts, 0 answers
  1. Lee
    Lee avatar
    9 posts
    Member since:
    Jul 2012

    Posted 14 Mar 2013 Link to this post


    Live, as the user types, I would like the same characters that are entered in one editor to appear in another.  How can I do this?  If there is some way to do this with client-side events, that would be awesome.

    What I'm doing is using a RadEditor for a text area where the user types message content for the body of an email.  We have HTML templates for these emails that the user selects.  These get loaded into another RadEditor that shows a Preview of the user's email.   When the user clicks an Update button, the text from the message content editor gets inserted into part of the template inside the preview editor.   This is done so that we can control exactly what parts of the template a user modifies.   

    It would be awesome if I could do away with that "Update" button and instead update the Preview as the user types!   

    Thanks for your time.
  2. Lee
    Lee avatar
    9 posts
    Member since:
    Jul 2012

    Posted 14 Mar 2013 Link to this post


     
    Looks like it is indeed possible.  This works:


    function
    MessageEditorLoad(editor, args) {
     
     
               editor.attachEventHandler("onkeydown", function (e) {
                   setTimeout(function () {
     
                       var messageEditor = $find("<%=EmailMessageEditor.ClientID%>");
                       var previewEditor = $find("<%=EmailPreviewEditor.ClientID%>");
     
                       previewEditor.set_html(messageEditor.get_html(false));
                       messageEditor.setFocus();
     
                   }, 0);
               });
           }

    Got the idea from:
    http://www.telerik.com/community/forums/aspnet-ajax/editor/text-changed-client-side-event-in-radeditor.aspx

Back to Top