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

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

1 Answer 134 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ankur
Top achievements
Rank 1
Ankur asked on 15 Oct 2012, 06:57 AM
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.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 15 Oct 2012, 02:55 PM
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.
Tags
Editor
Asked by
Ankur
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or