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

[Solved] How to block all CTRL+V Operations in Editor?

2 Answers 73 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Prince M. Premnath
Top achievements
Rank 2
Prince M. Premnath asked on 01 Mar 2010, 02:55 PM
Hello All ,

 I wish to block all the Ctrl+V Operation in Rad Editor , i ve partially accomplished  this using the following code

    var CmdName = commandName.get_commandName();
    if (CmdName == "PastePlainText")
    {
        if (document.all)
        {
            var textLength = CalculateLength(editor);
            if (textLength >= maxTextLength)
            {
                alert(messageText);
                commandName.set_cancel(true);
                //return false;
            }
        }
    }
    else if(CmdName == "PasteFromWord"
            || CmdName == "PasteFromWordNoFontsNoSizes"
            || CmdName == "Paste"
            || CmdName == "PasteAsHtml"  )
            {
                 alert("nCtrl+V is not currently supported in Y-Change. Please click right mouse button click and select \"paste\" or \"paste plain text\" from the drop down menu. ");
                return;
            }
}

Above function works in IE well But fails in Firefox ??? what can i do further ?

Thanks
Prince

2 Answers, 1 is accepted

Sort by
0
Prince M. Premnath
Top achievements
Rank 2
answered on 01 Mar 2010, 03:08 PM
OOps , i ve failed to specify the event Name of the function - OnClientCommandExecuting

function OnClientCommandExecuting(editor, commandName, oTool)
{
    var CmdName = commandName.get_commandName();
    if (CmdName == "PastePlainText")
    {
        if (document.all)
        {
            var textLength = CalculateLength(editor);
            if (textLength >= maxTextLength)
            {
                alert(messageText);
                commandName.set_cancel(true);
                //return false;
            }
        }
    }
    else if(CmdName == "PasteFromWord"
            || CmdName == "PasteFromWordNoFontsNoSizes"
            || CmdName == "Paste"
            || CmdName == "PasteAsHtml"  )
            {
                 alert("Alert:\nCtrl+V is not currently supported in Y-Change. Please click right mouse button click and select \"paste\" or \"paste plain text\" from the drop down menu. ");
                 commandName.set_cancel(true);
                return;
            }
}

Thanks
Prince
0
Dobromir
Telerik team
answered on 03 Mar 2010, 12:41 PM
Hi Prince,

Rumen, already answered your question in your other thread : http://www.telerik.com/community/forums/aspnet-ajax/editor/286158-how-to-block-all-ctrl-v-operations-in-editor.aspx

Kind regards,
Dobromir
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Editor
Asked by
Prince M. Premnath
Top achievements
Rank 2
Answers by
Prince M. Premnath
Top achievements
Rank 2
Dobromir
Telerik team
Share this question
or