Completed
Last Updated: 03 May 2016 14:15 by ADMIN
ADMIN
Ianko
Created on: 07 Mar 2016 08:28
Category: Editor
Type: Bug Report
0
Node inspector does not show properties for input of type text in Chrome and Firefox
When an input of type text is selected user cannot change its properties from Design mode. 

Workaround: 

<telerik:RadEditor runat="server" ID="RadEditor1">
    <Content>
        <input type="text" style="width: 100px; height: 22px;" />
        <br />
        
        <textarea></textarea>
    </Content>
</telerik:RadEditor>

<script>
    Telerik.Web.UI.RadEditor.prototype.getSelectedElement = function (range) {
        var editor = this;
        var contentArea = editor.get_contentArea();
        var $ = $telerik.$;
        var $Editor = Telerik.Web.UI.Editor;
        var utils = $Editor.Utils;

        if (editor.get_renderMode() === Telerik.Web.UI.RenderMode.Mobile) {
            var highlighted = $(contentArea).find(".__reTextHighlight,.__reNodeHighlight");
            if (highlighted.length) {
                var first = highlighted.get(0);
                var last = highlighted.last().get(0);
                return first === last ? first :
                    utils.findCommonAncestor(first, last);
            }
        }

        range = range || editor.getDomRange();
        if (!range) {
            var activeElement;
            try {
                activeElement = editor.get_document().activeElement;
            } catch (ex) { return undefined; }
            return $(activeElement).is('input[type=text],input[type=password],textarea') ?
                activeElement : undefined;
        }

        var container = range.commonAncestorContainer;
        if (container === contentArea || $.contains(contentArea, container)) {
            var selectedNode = $Editor.RangeEdges.commonNode(range);
            var isTextNode = utils.isTextNode(selectedNode);

            return utils.isTextNode(selectedNode) ? selectedNode.parentNode : selectedNode;
        }
    };
</script>
0 comments