Mac Safari - Copy and Paste Error

7 posts, 0 answers
  1. Ryan
    Ryan avatar
    16 posts
    Member since:
    Mar 2008

    Posted 26 Jun 2009 Link to this post

    We are having issues with our Mac Safari users when coping and pasting in the editor. The buttons in the toolbar do nothing and the short cuts do not work as well. At first I thought there was an issue on our end, but even the demos are your site do not work. 

     

    Is there a workaround for this issue?

  2. Rumen
    Admin
    Rumen avatar
    14374 posts

    Posted 26 Jun 2009 Link to this post

    Hi Ryan,

    To protect users' private information, unprivileged scripts cannot invoke the Cut, Copy, and Paste commands in the Gecko browsers, so the corresponding RadEditor's buttons on the toolbar just notify the user to use Ctrl + X, Ctrl + C and Ctrl + V in FireFox.

    Safari however presents itself as a browser which supports the paste command and for this reason the Use Ctrl+V message is not appearing in this browser.

     To fix the problem you can use the following code:
    <script type="text/javascript"
    function OnClientCommandExecuting(editor, args) 
        if ($telerik.isSafari && args.get_commandName() == "Paste"
        { 
            
            alert("Use Command-V to paste"); 
        } 
    </script> 
     <telerik:RadEditor id="RadEditor1" OnClientCommandExecuting="OnClientCommandExecuting" Runat="server"></telerik:RadEditor> 



    Best regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. skysailor
    skysailor avatar
    113 posts
    Member since:
    Jul 2007

    Posted 13 Aug 2009 Link to this post

    Hi,
    I have tried the workaround you listed. It does show the popup when you click on the button - which is helpful. But when I do a Ctrl-V in the editor it does a paste then comes up with the popup again! This is not desireable. I am using Safari 4 on Windows.
    Also is it possible to detect Safari Windows vs Safari Mac and display Ctrl-V vs Command-V in the message?
    Clayton
  4. skysailor
    skysailor avatar
    113 posts
    Member since:
    Jul 2007

    Posted 13 Aug 2009 Link to this post

    Hi,
    this is the code I came up with to get around this issue. Any suggestions?
    Clayton

    function OnClientCommandExecuting(editor, args) {    
        if ($telerik.isSafari && args.get_commandName() == "Paste" && args._tool) {  
            if (navigator.userAgent.indexOf('Mac') != -1)  
                alert("Use Command-V to paste");  
            else 
                alert("Use Ctrl-V to paste");  
        }    
    }    
     

  5. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 14 Aug 2009 Link to this post

    Hi skysailor,

    Your workaround is OK like this.

    Best wishes,
    Tervel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Janean Angeles
    Janean Angeles avatar
    12 posts
    Member since:
    Jul 2009

    Posted 27 Feb 2012 Link to this post

    I know this post is old, but since I didn't find this online I thought I'd share.  To allow custom paste message on the mac (regardless of the browser) and to stop the 2nd telerik default alert from popping I used the following with the key actually being the 'args.set_cancel(true); line.

    function OnClientCommandExecuting(editor, args) {
        if (args.get_commandName() == "Paste" && args._tool) {
            if (navigator.userAgent.indexOf('Mac') != -1) {
                alert("Please use Command-V to paste the content");
                args.set_cancel(true);
            }
        }
    }

    So far this seems to have stopped the 2nd alert in it's tracks on the mac and for the pc the normal alert works just fine.
  7. Janean Angeles
    Janean Angeles avatar
    12 posts
    Member since:
    Jul 2009

    Posted 27 Feb 2012 Link to this post

    I know this post is old, but since I didn't find this online I thought I'd share.  To allow custom paste message on the mac (regardless of the browser) and to stop the 2nd telerik default alert from popping I used the following with the key actually being the 'args.set_cancel(true); line.

    function OnClientCommandExecuting(editor, args) {
        if (args.get_commandName() == "Paste" && args._tool) {
            if (navigator.userAgent.indexOf('Mac') != -1) {
                alert("Please use Command-V to paste the content");
                args.set_cancel(true);
            }
        }
    }

    So far this seems to have stopped the 2nd alert in it's tracks on the mac and for the pc the normal alert works just fine.
Back to Top