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

Mac Safari - Copy and Paste Error

6 Answers 117 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 26 Jun 2009, 03:44 PM

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?

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 26 Jun 2009, 03:59 PM
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.
0
skysailor
Top achievements
Rank 1
answered on 14 Aug 2009, 12:30 AM
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
0
skysailor
Top achievements
Rank 1
answered on 14 Aug 2009, 12:55 AM
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");  
    }    
}    
 

0
Tervel
Telerik team
answered on 14 Aug 2009, 07:30 AM
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.
0
Janean Angeles
Top achievements
Rank 1
answered on 28 Feb 2012, 12:28 AM
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.
0
Janean Angeles
Top achievements
Rank 1
answered on 28 Feb 2012, 12:29 AM
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.
Tags
Editor
Asked by
Ryan
Top achievements
Rank 1
Answers by
Rumen
Telerik team
skysailor
Top achievements
Rank 1
Tervel
Telerik team
Janean Angeles
Top achievements
Rank 1
Share this question
or