Exemplo n.º 1
0
        /// <summary>
        /// Initialize text editor provider and controls
        ///
        /// Note: made public to be accessible by unit tests
        /// </summary>
        /// <param name="e">EventArgs</param>
        public void InitControls(EventArgs e)
        {
            try
            {
                _provider           = CreateProvider();
                _provider.ControlId = ID;
                _provider.InitializeControl((Page as SubtextPage).SubtextContext);

                if (Height != Unit.Empty)
                {
                    _provider.Height = Height;
                }
                if (Width != Unit.Empty)
                {
                    _provider.Width = Width;
                }

                editor = _provider.RichTextEditorControl;
                Controls.Add(editor);
                base.OnInit(e);
            }
            catch (ArgumentNullException ex)
            {
                OnError(ex);
            }
            catch (InvalidOperationException ex)
            {
                OnError(ex);
            }
            catch (UnauthorizedAccessException ex)
            {
                OnError(ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a provider instance based on User preferences
        ///
        /// If UsePlainHtmlEditor preference is set, PlainTextBlogEntryEditorProvider is created,
        /// otherwise default provider is created
        /// </summary>
        /// <returns></returns>
        private BlogEntryEditorProvider CreateProvider()
        {
            BlogEntryEditorProvider provider;

            if (Preferences.UsePlainHtmlEditor)
            {
                provider = BlogEntryEditorProvider.Providers["PlainTextBlogEntryEditorProvider"];
            }
            else
            {
                //TODO: might be changed from default to exact provider here..
                provider = BlogEntryEditorProvider.Instance();
            }

            return(provider);
        }