/// <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 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 );
 }
Пример #3
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);
 }