예제 #1
0
        /// <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();
        }
예제 #2
0
 /// <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();
            }
        }