Completed
Last Updated: 28 Aug 2015 05:30 by ADMIN
ADMIN
Ianko
Created on: 17 Jul 2015 10:07
Category: UI for ASP.NET AJAX
Type: Bug Report
0
Incorrectly positioned cursor when pressing Tab key in an empty paragraph
Cursor is placed in the next available element (e.g., <p>) instead of being placed right after the tab space in the same paragraph.

Possible workaround is to implement a custom command to be triggered with tab key press:

<telerik:RadEditor runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad">
</telerik:RadEditor>

<script>
    Telerik.Web.UI.Editor.CommandList["MyInsertTab"] = function (commandName, editor, oTool) {
        var utils = Telerik.Web.UI.Editor.Utils;
        var selecedElm = editor.getSelectedElement();
        var blockElm = utils.isBlockElement(selecedElm) ? selecedElm : utils.getBlockParent(selecedElm);
        var executeDefaultCommand = utils.isList(blockElm) ||
                                    utils.isTag(blockElm, "LI") ||
                                    utils.isTag(blockElm, "TD") ||
                                    utils.isTag(blockElm, "TH");

        if (executeDefaultCommand) {
            editor.fire("InsertTab");
        } else {
            editor.pasteHtml("<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>&#8203;", commandName);
        }

    };

    function OnClientLoad(editor, args) {
        var shortcutManager = editor.get_shortCutManager();
        // Removing the InsertTabMozilla shortcut will 
        // assure that in Firefox the behavior will be consistent with IE.
        shortcutManager.removeShortCut("InsertTabMozilla");
        editor.addShortCut("MyInsertTab", "TAB");
    }
</script>
0 comments