RadEditor in Custom Designer in IE
I have successfully gotten the the RADEditor to appear in a custom designer in SiteFinity 4.0 using Firefox.
However in IE, I get a javascript error:
Line: 2
Char:1
Error: 'parent.sys.Application' is null or is not an object
Code: 0
Any ideas??
Here's my .js code below.
/// <reference name="MicrosoftAjax.js"/>/// <reference name="Telerik.Sitefinity.Resources.Scripts.jquery-1.3.2.min-vsdoc2.js" assembly="Telerik.Sitefinity.Resources"/>Type.registerNamespace("iDBControls");iDBControls.MixedHTMLDesigner = function (element) iDBControls.MixedHTMLDesigner.initializeBase(this, [element]); this._parentDesigner = null; this._googleAnalyticsCodeTextField = null; this._scriptEmbedPositionChoiceField = null; this._toogleGroupSettingsDelegate = null;iDBControls.MixedHTMLDesigner.prototype = /* --------------------------------- set up and tear down --------------------------------- */ initialize: function () iDBControls.MixedHTMLDesigner.callBaseMethod(this, 'initialize'); this._toogleGroupSettingsDelegate = Function.createDelegate(this, function () dialogBase.resizeToContent(); ); //jQuery("#expanderDesignSettings").click(this._toogleDesignSettingsDelegate); jQuery(".sfExpandableSection a").click(this._toogleGroupSettingsDelegate).click(function() $(this).parents(".sfExpandableSection:first").toggleClass("sfExpandedSection"); ); , dispose: function () iDBControls.MixedHTMLDesigner.callBaseMethod(this, 'dispose'); , /* --------------------------------- public methods --------------------------------- */ // implementation of IControlDesigner: Forces the control to refersh from the control Data refreshUI: function () //this._refreshMode = true; var data = this.get_controlData(); try $find(jQuery("#rdeEditorID").html()).set_html(data.HTML) catch(e) //$find(jQuery("#rdeEditorID").html()).set_html("") , // implementation of IControlDesigner: forces the designer view to apply the changes on UI to the control Data applyChanges: function () var controlData = this.get_controlData(); controlData.HTML=GetHtmlSelection(); , get_controlData: function () return this.get_propertyEditor().get_control(); , _getSelectedChoice: function (groupName) return jQuery(this.get_element()).find("input[name='" + groupName + "']:checked").val(); , _clickRadioChoice: function (groupName, value) return jQuery(this.get_element()).find("input[name='" + groupName + "'][value='" + value + "']").click(); , /* --------------------------------- event handlers --------------------------------- */ /* --------------------------------- private methods --------------------------------- */ /* --------------------------------- properties --------------------------------- */ // gets the reference to the propertyEditor control get_propertyEditor: function () return this._propertyEditor; , // sets the reference fo the propertyEditor control set_propertyEditor: function (value) this._propertyEditor = value; , //get_googleAnalyticsCodeTextField: function () return this._googleAnalyticsCodeTextField; , //set_googleAnalyticsCodeTextField: function (value) this._googleAnalyticsCodeTextField = value; iDBControls.MixedHTMLDesigner.registerClass('iDBControls.MixedHTMLDesigner', Telerik.Sitefinity.Web.UI.ControlDesign.ControlDesignerBase);if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();function GetHtmlSelection()try var html=$find(jQuery("#rdeEditorID").html()).get_html() return html catch(e) //alert(e)
This is my .ascx:
<%@ Control Language="C#"%><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %> <sitefinity:ResourceLinks ID="resourcesLinks" runat="server"> <sitefinity:ResourceFile AssemblyInfo="iDBControls.MixedHTML, iDBControls" Name="iDBControls.Resources.Stylesheets.Designer.css" Static="true"/> </sitefinity:ResourceLinks><div class="sfContentViews">This is the place1 <div id="rdeEditorID" style="display:none;"><asp:Literal ID="litECID" runat="server" ></asp:Literal></div> <telerik:RadEditor ID="rdEditor" runat="server" Editable="true" > </telerik:RadEditor>This is the place too</div>
And finally, the .cs file:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using Telerik.Sitefinity.Web.UI.ControlDesign;using Telerik.Sitefinity.Web.UI;using System.Web.UI;using Telerik.Web.UI;using System.Web.UI.WebControls;namespace iDBControls class MixedHTMLDesigner: ControlDesignerBase protected override void InitializeControls(GenericContainer container) base.DesignerMode = ControlDesignerModes.Simple; protected override string LayoutTemplateName get return "iDBControls.Resources.MixedHTMLDesigner.ascx"; protected override HtmlTextWriterTag TagKey get //Use div wrapper tag to make easier common styling. This will surround the layout template with a div tag. return HtmlTextWriterTag.Div; public override IEnumerable<System.Web.UI.ScriptReference> GetScriptReferences() var res = new List<ScriptReference>(base.GetScriptReferences()); var assemblyName = this.GetType().Assembly.GetName().ToString(); res.Add(new ScriptReference("iDBControls.Resources.MixedHTMLJS.js", assemblyName)); return res.ToArray(); protected virtual Literal litECID get return base.Container.GetControl<Literal>("litECID", true); protected virtual RadEditor rdEditor get return base.Container.GetControl<RadEditor>("rdEditor", true); protected override void RenderContents(HtmlTextWriter writer) this.litECID.Text= rdEditor.ClientID; rdEditor.Content = " "; base.RenderContents(writer); Hello Victor,
There is a comma before the last closing bracket in the designer javascript code:
// gets the reference to the propertyEditor control get_propertyEditor: function () return this._propertyEditor; , // sets the reference fo the propertyEditor control set_propertyEditor: function (value) this._propertyEditor = value; , //get_googleAnalyticsCodeTextField: function () return this._googleAnalyticsCodeTextField; , //set_googleAnalyticsCodeTextField: function (value) this._googleAnalyticsCodeTextField = value;