Overide Telerik.Web.UI.Editor.CommandList["InsertTab"] not working in chrome, safari

2 posts, 0 answers
  1. Ankur
    Ankur avatar
    2 posts
    Member since:
    Oct 2012

    Posted 15 Oct 2012 Link to this post

    Hello,

    Telerik Version we are using:2010.3.1317 we are using .net framework 2.0 and cannot upgrade to 3.5 or 4.0 at the moment.

    and the version we are using, i think, is the latest one for 2.0.

    Problem Detail:
    we have an user control .ascx(Editor) that is wrapping RadEditor.

    now using chrome or safari, on pressing "Tab" key it inserts:
    <span class="Apple-tab-span" style="white-space:pre"> </span>

    to overcome this problem i decided to override Telerik.Web.UI.Editor.CommandList["InsertTab"] event so on .ascx page i did following:
    <script type="text/javascript">
     if (typeof (Telerik) != 'undefined') {
            Telerik.Web.UI.Editor.CommandList["InsertTab"] = function(commandName, editor, args) {
       //alert('success");
               editor.pasteHtml("&nbsp;&nbsp;&nbsp;&nbsp;");
            };
        }
    </script>

    Which is working fine in IE9 but not in chrome/safari. i tried using an alert message but it simply not firing the code.

    I would appreciate any/all help i could get.

  2. Rumen
    Admin
    Rumen avatar
    14459 posts

    Posted 15 Oct 2012 Link to this post

    Hello,

    The InsertTab command is implemented only for Internet Explorer and it is not fired in the other browsers. If you want to attach to the Tab key you can use the following code:

    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad">
    </telerik:RadEditor>
    <script type="text/javascript">
        function OnClientLoad(editor) {
                editor.attachEventHandler("onkeydown", function (e) {
                    if (e.keyCode == '9') {
                        editor.pasteHtml("    ");
                        $telerik.cancelRawEvent(e); //cancel further execution of the event
                    }
                });
        }
    </script>


    Kind regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top