/// <summary>Raises the <see cref="E:System.Web.UI.Control.Load"></see> event.</summary> /// <param name="e">The <see cref="T:System.EventArgs"></see> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { Assert.ArgumentNotNull((object)e, ExtensionMethods.nameof(() => e)); base.OnLoad(e); if (Sitecore.Context.ClientPage.IsEvent) { return; } TinyMCEEditorUrl tinyMCEEditorUrl = new TinyMCEEditorUrl() { Conversion = TinyMCEEditorUrl.HtmlConversion.DoNotConvert, Disabled = this.Disabled, FieldID = this.FieldID, ID = this.ID, ItemID = this.ItemID, Language = this.ItemLanguage, Mode = "ContentEditor", ShowInFrameBasedDialog = true, Source = this.Source, Url = string.Empty, Value = this.Value, Version = this.ItemVersion }; UrlString url = tinyMCEEditorUrl.GetUrl(); this.handle = tinyMCEEditorUrl.Handle; this.setValueOnPreRender = true; this.SourceUri = url.ToString(); }
/// <summary>Loads the post data.</summary> /// <param name="value">The value.</param> /// <returns>The load post data.</returns> protected override bool LoadPostData(string value) { Assert.ArgumentNotNull((object)value, ExtensionMethods.nameof(() => value)); if (!(value != this.Value)) return false; this.Value = value; return true; }
protected override void OnPreRender(EventArgs e) { Assert.ArgumentNotNull((object)e, ExtensionMethods.nameof(() => e)); base.OnPreRender(e); if (this.setValueOnPreRender) HttpContext.Current.Session[this.handle] = (object)this.Value; this.ServerProperties["ItemLanguage"] = this.ServerProperties["ItemLanguage"]; this.ServerProperties["Source"] = this.ServerProperties["Source"]; this.ServerProperties["FieldID"] = this.ServerProperties["FieldID"]; }
/// <summary>Updates the HTML.</summary> /// <param name="args">The arguments.</param> protected virtual void UpdateHtml(ClientPipelineArgs args) { Assert.ArgumentNotNull((object)args, ExtensionMethods.nameof(() => args)); string str = args.Result; if (str == "__#!$No value$!#__") str = string.Empty; string text = this.ProcessValidateScripts(str); if (text != this.Value) this.SetModified(); SheerResponse.Eval("scForm.browser.getControl('" + this.ID + "').contentWindow.scSetText(" + StringUtil.EscapeJavascriptString(text) + ")"); SheerResponse.Eval("scContent.startValidators()"); }
/// <summary>Handles the message.</summary> /// <param name="message">The message.</param> public override void HandleMessage(Message message) { Assert.ArgumentNotNull((object)message, ExtensionMethods.nameof(() => message)); base.HandleMessage(message); if (!(message["id"] == this.ID)) return; switch (message.Name) { case "tinyrte:edit": Sitecore.Context.ClientPage.Start((object)this, "EditHtmlTinyMCE"); break; } }
/// <summary>Loads the post data.</summary> /// <param name="value">The value.</param> /// <returns>The load post data.</returns> protected override bool LoadPostData(string value) { base.LoadPostData(value); Assert.ArgumentNotNull((object)value, ExtensionMethods.nameof(() => value)); if (value == this.Value) { return(false); } this.Value = value; return(true); }
/// <summary>Creates the specified profile.</summary> /// <param name="profile">The profile.</param> /// <returns>The editor configuration.</returns> public static TinyEditorConfiguration Create(Sitecore.Data.Items.Item profile) { Assert.ArgumentNotNull((object)profile, ExtensionMethods.nameof(() => profile)); string configurationType = Sitecore.Configuration.Settings.GetSetting("TinyEditor.DefaultConfigurationType"); TinyEditorConfiguration editorConfiguration = ReflectionUtil.CreateObject(configurationType, new object[1] { (object)profile }) as TinyEditorConfiguration; Assert.IsNotNull((object)editorConfiguration, "editor configuration"); return(editorConfiguration); }
/// <summary>Edits the text.</summary> /// <param name="args">The args.</param> protected void EditHtmlTinyMCE(ClientPipelineArgs args) { Assert.ArgumentNotNull((object)args, ExtensionMethods.nameof(() => args)); if (this.Disabled) { return; } if (args.IsPostBack) { if (args.Result == null || args.Result == "undefined") { return; } this.UpdateHtml(args); } else { TinyMCEEditorUrl richTextEditorUrl = new TinyMCEEditorUrl() { Conversion = TinyMCEEditorUrl.HtmlConversion.DoNotConvert, Disabled = this.Disabled, FieldID = this.FieldID, ID = this.ID, ItemID = this.ItemID, Language = this.ItemLanguage, Mode = string.Empty, ShowInFrameBasedDialog = true, Source = this.Source, Url = "/sitecore/shell/Controls/TinyMCE Editor/EditorPage.aspx", Value = this.Value, Version = this.ItemVersion }; UrlString url = richTextEditorUrl.GetUrl(); url.Add("so_mce", SourceMce); this.handle = richTextEditorUrl.Handle; SheerResponse.ShowModalDialog(new ModalDialogOptions(url.ToString()) { Width = "1200", Height = "730px", Response = true, Header = Translate.Text("Rich Text Editor") }); args.WaitForPostBack(); } }
/// <summary>Edits the text.</summary> /// <param name="args">The args.</param> protected void EditHtmlTinyMCE(ClientPipelineArgs args) { TinyEditorConfigurationResult configurationResult = Utils.LoadTinyEditorConfiguration(); int windowWidth, windowHeight; if (!int.TryParse(configurationResult.EditorWindowWidth, out windowWidth)) { windowWidth = 1220; } if (!int.TryParse(configurationResult.EditorWindowHeight, out windowHeight)) { windowHeight = 730; } Assert.ArgumentNotNull((object)args, ExtensionMethods.nameof(() => args)); if (this.Disabled) return; if (args.IsPostBack) { if (args.Result == null || !(args.Result != "undefined")) return; this.UpdateHtml(args); } else { TinyMCEEditorUrl richTextEditorUrl = new TinyMCEEditorUrl() { Conversion = TinyMCEEditorUrl.HtmlConversion.DoNotConvert, Disabled = this.Disabled, FieldID = this.FieldID, ID = this.ID, ItemID = this.ItemID, Language = this.ItemLanguage, Mode = string.Empty, ShowInFrameBasedDialog = true, Source = this.Source, Url = "/sitecore/shell/Controls/TinyMCE Editor/EditorPage.aspx", Value = this.Value, Version = this.ItemVersion }; UrlString url = richTextEditorUrl.GetUrl(); this.handle = richTextEditorUrl.Handle; SheerResponse.ShowModalDialog(new ModalDialogOptions(url.ToString()) { Width = string.Format("{0}px", windowWidth), Height = string.Format("{0}px", windowHeight), Response = true, Header = Translate.Text("Rich Text Editor") }); args.WaitForPostBack(); } }
/// <summary>Parse string</summary> /// <param name="urlString">The url String.</param> /// <returns>Initialized TinyMCEEditorUrl object</returns> public static TinyMCEEditorUrl Parse(string urlString) { Assert.ArgumentNotNull((object)urlString, ExtensionMethods.nameof(() => urlString)); TinyMCEEditorUrl tinyMCEEditorUrl = new TinyMCEEditorUrl(); UrlString urlString1 = new UrlString(urlString); tinyMCEEditorUrl.ItemID = StringUtil.GetString(new string[2] { urlString1["id"], string.Empty }); tinyMCEEditorUrl.ID = StringUtil.GetString(new string[1] { urlString1["ed"] }); tinyMCEEditorUrl.Version = StringUtil.GetString(new string[1] { urlString1["vs"] }); tinyMCEEditorUrl.Language = StringUtil.GetString(new string[1] { urlString1["la"] }); tinyMCEEditorUrl.FieldID = StringUtil.GetString(new string[1] { urlString1["fld"] }); tinyMCEEditorUrl.Source = StringUtil.GetString(new string[1] { urlString1["so"] }); tinyMCEEditorUrl.Disabled = urlString1["di"] == "1"; tinyMCEEditorUrl.Handle = StringUtil.GetString(new string[1] { urlString1["hdl"] }); tinyMCEEditorUrl.Mode = StringUtil.GetString(new string[1] { urlString1["mo"] }); tinyMCEEditorUrl.IsPageEdit = urlString1["pe"] == "1"; tinyMCEEditorUrl.ShowInFrameBasedDialog = urlString1["fbd"] == "1"; return(tinyMCEEditorUrl); }
/// <summary> /// Initializes a new instance of the <see cref="T:Sitecore.Data.Fields.TinyMCERTEType" /> class. /// </summary> /// <param name="innerField">The inner field.</param> /// <contract> /// <requires name="innerField" condition="none" /> /// </contract> public TinyMCERTEType(Field innerField) : base(innerField) { Assert.ArgumentNotNull((object)innerField, ExtensionMethods.nameof(() => innerField)); }
/// <summary> /// Initializes a new instance of the <see cref="T:Sitecore.Shell.Controls.RichTextEditor.TinyEditorConfiguration" /> class. /// </summary> /// <param name="profile">The profile.</param> public TinyEditorConfiguration(Sitecore.Data.Items.Item profile) { Assert.ArgumentNotNull((object)profile, ExtensionMethods.nameof(() => profile)); this.profile = profile; this.Result = new TinyEditorConfigurationResult(); }