This is a migrated thread and some comments may be shown as answers.
Paste Plain Text Always
1 Answer 14 Views
This is a migrated thread and some comments may be shown as answers.
Eli
Top achievements
Rank 1
Eli asked on 12 Dec 2014, 07:20 PM
How would I get pasted content into the RadEditor to always "Paste Plain Text".  I want the exact same thing to happen as when I right click and select "Paste Plain Text"

I am unable to find the right StripFormattingOptions to simulate it exactly.  Removing all Word Content leaves other HTML and <p> tags.  If I remove "AllExceptNewLines" it puts a double space (two BR tags) every place there should only be a singe space.

When I right click and choose Paste Plain Text it correctly puts a single <br /> tag after each line. 

I attached #1 the original (email in this case).  #2 I attached the way the content looks using right click "Paste Plain Text" and #3 I attached what it looks like when removing "AllExceptNewLines"

1 Answer, 1 is accepted

Sort by
0
Accepted
Ianko
Telerik team
answered on 15 Dec 2014, 03:00 PM
Hi Eli,

The described issue is logged as a bug. You can follow the progress of the task with this feedback portal item.

You can workaround this by manipulating the content that is pasted via the OnClientPasteHtml event:
<telerik:RadEditor runat="server" ID="RadEditor1"
    OnClientPasteHtml="OnClientPasteHtml"
    StripFormattingOptions="AllExceptNewLines">
</telerik:RadEditor>
 
<script type="text/javascript">
    function OnClientPasteHtml(editor, args) {
        var commandName = args.get_commandName();
        var contentToPaste = args.get_value();
 
        if (commandName === "Paste") {
            contentToPaste = contentToPaste.replace(/(<br\/>)+/gi, "<br/>");
 
            args.set_value(contentToPaste);
        }
    }
</script>


Regards,
Ianko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Asked by
Eli
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or