This is a migrated thread and some comments may be shown as answers.

Using pasteHtml() in Firefox

2 Answers 66 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Serrin
Top achievements
Rank 1
Serrin asked on 23 Oct 2008, 01:42 PM
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 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 27 Oct 2008, 12:59 PM
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="*.*" />
    </telerik:RadEditor>
    <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>");
        editor.set_mode(4);
        editor.set_mode(1);

    }
    </script>


Greetings,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Serrin
Top achievements
Rank 1
answered on 27 Oct 2008, 01:07 PM
Today, you are my hero! :D
Tags
Editor
Asked by
Serrin
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Serrin
Top achievements
Rank 1
Share this question
or