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

RadEditor fire 'copy' event with javascript not working

2 Answers 79 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Pramod
Top achievements
Rank 1
Pramod asked on 18 Mar 2014, 02:29 PM
I used the below link for performing a 'select all' using javascript and it worked perfectly.
http://www.telerik.com/forums/highlight-a-word-in-radeditor

However, when trying to do the same for 'Copy', it does not work. There is no error thrown.
'Allow programmatic access to clipboard' has been enabled in IE8 security settings.
Using ToolsFile.xml to define controls.

Note: Clicking the editor's 'copy' button works fine, but I need to fire this programmatically.

Actual Code:

<telerik:RadEditor runat="server" ID="RadEditor1" OnClientLoad="StartWithPreviewMode"
StripFormattingOnPaste="NoneSupressCleanMessage" EditModes="Design,Preview" ToolsFile="ToolsFile.xml">

<script type="text/javascript">
function PerformCopy() {
var editor = $find("<%=RadEditor1.ClientID%>");
editor.fire("SelectAll");
editor.fire("Copy");    //--> Does not copy anything to clipboard.

function StartWithPreviewMode(editor, args) {
editor.set_mode(4);
}
</script>

2 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 20 Mar 2014, 02:24 PM
Hi Pramod,

The Copy command needs an second argument to work properly, in you case it does not need to be a firm one. You can pass just an empty object:
editor.fire("Copy", {});


Regards,
Ianko
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Pramod
Top achievements
Rank 1
answered on 21 Mar 2014, 05:26 PM
Just perfect. Thanks!
Tags
Editor
Asked by
Pramod
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Pramod
Top achievements
Rank 1
Share this question
or