RadEditor fire 'copy' event with javascript not working

3 posts, 0 answers
  1. Pramod
    Pramod avatar
    6 posts
    Member since:
    Mar 2014

    Posted 18 Mar 2014 Link to this post

    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. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 20 Mar 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pramod
    Pramod avatar
    6 posts
    Member since:
    Mar 2014

    Posted 21 Mar 2014 in reply to Ianko Link to this post

    Just perfect. Thanks!
Back to Top