Completed
Last Updated: 13 Jan 2014 10:41 by ADMIN
ADMIN
Ianko
Created on: 09 Jan 2014 14:35
Category: Editor
Type: Bug Report
1
When in the content is inserted HTML code with full page markup, switching from HTML mode to Design and creating a simple post back is throwing a JavaScript error
Setting a content as the following one:

<html>
    <head>
    </head>
    <body>
        <h2>content</h2>
    </body>
</html>

After switching the editor mode and creating a post back, a JavaScript error is thrown in the browser console. 


A possible resolution is overriding the detachEvents methods of the editor with the provided ones. You can use the following setup as example, note that the script tag should be after the RadEditor declaration to override the methods correctly:

<telerik:RadEditor runat="server" ID="RadEditor1" ContentFilters="none">
    <Content>
        <html>
            <head>
            </head>
            <body>
                <h2>content</h2>
            </body>
        </html>
    </Content>
</telerik:RadEditor>
<asp:Button Text="text" runat="server" OnClick="Unnamed_Click" />

<script type="text/javascript">
    Telerik.Web.UI.Editor.NodesTracker.prototype.detachEvents = function () {
        if (!this.isActive) return;
        var contentArea = this.editor.get_contentArea();
        this.editor.remove_submit(this.cleanUpDelegate);
        try {
            $telerik.removeHandler(contentArea, "keyup", this.keyupDelegate);
            $telerik.removeHandler(contentArea, "keydown", this.keydownDelegate);
        }
        catch (ex) { }
        $telerik.removeExternalHandler(contentArea, "paste", this.pasteDelegate);
    }

    Telerik.Web.UI.Editor.EmptyWhitespaceCharTracker.prototype.detachEvents = function () {
        var contentArea = this.editor.get_contentArea();
        this.editor.remove_submit(this.cleanUpDelegate);
        try {
            $telerik.removeHandler(contentArea, "keypress", this.cleanUpDelegate);
        }
        catch (ex) { }
        $telerik.removeExternalHandler(contentArea, "mousedown", this.cleanUpDelegate);
        $telerik.removeExternalHandler(contentArea, "touchstart", this.cleanUpDelegate);
    }
</script>
1 comment
ADMIN
Ianko
Posted on: 13 Jan 2014 10:41
The fix of this issue will be introduced in the upcoming official release of the RadCotnrols suite (2013 Q3 SP2), which is going to be available by the end of January.