Using pasteHtml() in Firefox

3 posts, 0 answers
  1. Serrin
    Serrin avatar
    286 posts
    Member since:
    Sep 2008

    Posted 23 Oct 2008 Link to this post

    Hi all,

    I'm running into a bit of a problem and was wondering if anyone knew a workaround to this...

    I'm working on a small report program which makes use of RadEditor for people to input daily activities, except we're kinda forcing the users to use bulleted lists for the sake of storing report items into a backend for future reporting. 

    The pasteHtml I am using is...

    editor.pasteHtml("<p><b>" + val + "</b></p><ul><li>"); 

    Now, in IE this works fine.  RadEditor does close the tags, but it sets the cursor inside the <li> and allows people to start typing report items.

    In Firefox, which everyone around her prefers to use, the cursor goes to the beginning of the textbox, and you cannot click into the <li> to insert an item.  You can, however, click to html preview mode, and when you click back, it puts the cursor right where we want it.  The question is, how can I use javascript to let people enter items (after the pasteHtml) without having to click to html preview and back? :)

    Any help or suggestions are welcome. ;D
  2. Rumen
    Rumen avatar
    13244 posts

    Posted 27 Oct 2008 Link to this post

    Hi Serrin,

    The unclosed html <ul> and <li> tags are closed automatically by the browser, but not RadEditor.

    Nevertheless, if you want to switch to Preview and back to Design mode you can do this programmatically with the set_mode() method:

        <telerik:RadEditor ID="RadEditor1" runat="server">
            <MediaManager ViewPaths="~/files" UploadPaths="~/files" SearchPatterns="*.*" />
        <input onclick="PasteContent()" value="Paste Content" type="button"/>
        <script type="text/javascript">
        function PasteContent()
            var editor = $find("<%=RadEditor1.ClientID%>");
            editor.pasteHtml("<p><b>" + "test" + "</b></p><ul><li>");


    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Serrin
    Serrin avatar
    286 posts
    Member since:
    Sep 2008

    Posted 27 Oct 2008 Link to this post

    Today, you are my hero! :D
Back to Top