Completed
Last Updated: 07 Jun 2016 05:30 by croach01
ADMIN
Ianko
Created on: 15 Jan 2016 07:57
Category: UI for ASP.NET AJAX
Type: Feature Request
0
Improve the DeleteCommand to handle deletion of last list item in IE
IE browser handles backspaces at some extent, but causes undesired HTML formatting when the entire UL|OL is wrapped in another DOM element. 

RadEditor can reuse the DeleteCommand implementation in order to bypass browser's behavior and give more reliable results.


The following override can show you how you can handle this on your own and correct the browser result (Note that the script should be loaded after the RadEditor scripts in order to work):

<telerik:RadEditor runat="server" ID="RadEditor1">
    <Content>
            <div>
                <ul>
                    <li>Purple</li>
                    <li></li>
                </ul>
            </div>
    </Content>
</telerik:RadEditor>

<script>
    var originalApplyFix = Telerik.Web.UI.Editor.DeleteFix.prototype.applyFix;

    Telerik.Web.UI.Editor.DeleteFix.prototype.applyFix = function (e) {
        var that = this;
        var $E = Telerik.Web.UI.Editor;
        var utils = $E.Utils;
        var range = that._getRange();
        
        originalApplyFix.call(that, e);

        if (Telerik.Web.Browser.ie) {
            var startContainer = range.startContainer;
            if (utils.isTag(startContainer, "li") && utils.isEmptyDom(startContainer) && !startContainer.nextElementSibling) {
                var outdent = new $E.OutdentCommand(that.editor);
                outdent.onExecute();
                $telerik.preventDefault(e);
            }
        }

    };
</script>

1 comment
croach01
Posted on: 18 Jan 2016 17:06
This does seem to fix the issue, thank you.