/// <summary>
        /// Executes the modification and calls the ID setter with the ID of the created or modified HTML block.
        /// </summary>
        public void Execute()
        {
            if (htmlBlockId == null)
            {
                htmlBlockId = HtmlBlockStatics.CreateHtmlBlock(Html);
            }
            else
            {
                HtmlBlockStatics.UpdateHtmlBlock(htmlBlockId.Value, Html);
            }

            idSetter(htmlBlockId.Value);
        }
 /// <summary>
 /// Creates an HTML block container.
 /// </summary>
 /// <param name="htmlBlockId"></param>
 /// <param name="displaySetup"></param>
 /// <param name="classes">The classes on the container.</param>
 public HtmlBlockContainer(int htmlBlockId, DisplaySetup displaySetup = null, ElementClassSet classes = null) : this(
         HtmlBlockStatics.GetHtml(htmlBlockId),
         displaySetup : displaySetup,
         classes : classes)
 {
 }
        /// <summary>
        /// Creates an HTML block editor.
        /// </summary>
        /// <param name="htmlBlockId"></param>
        /// <param name="idSetter"></param>
        /// <param name="mod"></param>
        /// <param name="setup">The setup object for the HTML block editor.</param>
        public HtmlBlockEditor(int?htmlBlockId, Action <int> idSetter, out HtmlBlockEditorModification mod, HtmlBlockEditorSetup setup = null)
        {
            setup = setup ?? new HtmlBlockEditorSetup();

            this.mod = mod = new HtmlBlockEditorModification(htmlBlockId, htmlBlockId.HasValue ? HtmlBlockStatics.GetHtml(htmlBlockId.Value) : "", idSetter);

            var wysiwygEditor = new WysiwygHtmlEditor(
                mod.Html,
                true,
                (postBackValue, validator) => {
                this.mod.Html = postBackValue;
                setup.AdditionalValidationMethod?.Invoke(validator);
            },
                setup: setup.WysiwygSetup);

            component =
                new DisplayableElement(
                    context => {
                return(new DisplayableElementData(
                           setup.DisplaySetup,
                           () => new DisplayableElementLocalData("div"),
                           classes: new ElementClass(CssElementCreator.CssClass),
                           children: wysiwygEditor.PageComponent.ToCollection()));
            });

            validation = wysiwygEditor.Validation;
        }
 /// <summary>
 /// Creates an HTML block placeholder.
 /// </summary>
 public HtmlBlockPlaceholder(int htmlBlockId) : this(HtmlBlockStatics.GetHtml(htmlBlockId))
 {
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates an HTML block editor.
 /// </summary>
 /// <param name="htmlBlockId"></param>
 /// <param name="idSetter"></param>
 /// <param name="mod"></param>
 /// <param name="ckEditorConfiguration">Do not pass null.</param>
 public HtmlBlockEditor(int?htmlBlockId, Action <int> idSetter, out HtmlBlockEditorModification mod, string ckEditorConfiguration = "")
 {
     this.ckEditorConfiguration = ckEditorConfiguration;
     this.mod = mod = new HtmlBlockEditorModification(htmlBlockId, htmlBlockId.HasValue ? HtmlBlockStatics.GetHtml(htmlBlockId.Value) : "", idSetter);
 }