/// <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();
 }
        /// <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 = new UrlString(
                    Regex.Replace(richTextEditorUrl.GetUrl().ToString(),
                                  "%26so_mce%3D",
                                  "&so_mce=",
                                  RegexOptions.IgnoreCase));
                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();
            }
        }