/// <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>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);
        }