+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / HtmlContentEditor as webeditor - share content not working

HtmlContentEditor as webeditor - share content not working

7 posts, 0 answered
  1. Adam
    Adam avatar
    33 posts
    Registered:
    23 Feb 2009
    02 Dec 2009
    Link to this post
    Hi,

    I'm using Sitefinity 3.6x. I have a property using the HtmlContentEditor as a webeditor. When clicking the "share this content" link, it creates the shared generic content in the modules but does not maintain the link to that shared content after saving. Is this a known issue? If so, is there a fix available?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Dec 2009
    Link to this post
    Hello Adam,

    HtmlContentEditor is obsolete and no more in use. Please use GenericContentDesigner instead. You can also create a custom WebUITypeEditor.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Adam
    Adam avatar
    33 posts
    Registered:
    23 Feb 2009
    02 Dec 2009
    Link to this post
    Hi Ivan,

    The custom type editor is way out of scope and budget for us on this project, although I may look into it for the future.

    How do I use the GenericContentDesigner as a web editor?

    This code:

    [Category("Main")]
    [WebEditor("Telerik.Cms.Engine.WebControls.Design.GenericContentDesigner")]
    public string BodyText { get; set; }


    Throws this error:

    Unable to cast object of type 'Telerik.Cms.Engine.WebControls.Design.GenericContentDesigner' to type 'Telerik.Cms.Web.UI.IWebUITypeEditor'.



    ---------

    Basically, I'm just trying to quickly add rich text editing to some string properties on one of my usercontrols with that ability to share content just like you would in the generic content control.

    I got the info from this article http://www.sitefinitywatch.com/blog/09-01-29/Using_Built-In_Sitefinity_WebEditors.aspx.



    thanks!






  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Dec 2009
    Link to this post
    Hello Adam,

    You cannot use GenericConentDesigner directly as you have type it, because it does not inherits from WebUITypeEditor<T>. I suggest that you should create WebUITypeEditor because there is no built in selector that you can use.

    Below is sample implementation.

    public class CustomTextWebEditor : Telerik.Cms.Web.UI.WebUITypeEditor<string>
    {
        public CustomTextWebEditor()
        {
            this.EnsureChildControls();
        }
        public override string Value
        {
            get { return _RadEditor.Content; }
            set
            {
                _value = value;
                if (_value != _RadEditor.Content)
                {
                    _RadEditor.Content = value;
                }
            }
        }
        // HERE YOU CAN USE GENERIC CONTENT TO GET THE SHARED CONTENT
        //INSTEAD OF RAD EDITOR CONTROL
        protected override void CreateChildControls()
        {
            Controls.Clear();
            _RadEditor = new RadEditor();
            _RadEditor.ToolsFile = "~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml";
            _RadEditor.Skin = "Black";
            _RadEditor.Width = 800;
            Controls.Add(_RadEditor);
        }
     
        // USE GENERIC CONTENT IF YOU ARE GOING TO WORK WITH SHARED CONTENT OBJECTS
        // private GenericContent _GenericContent = null;
        private RadEditor _RadEditor = null;
        private string _value = null;
    }

    You can add GenericContent or RadEditor controls in your class dynamically or declaretively in the template for the WebEditor.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Adam
    Adam avatar
    33 posts
    Registered:
    23 Feb 2009
    04 Dec 2009
    Link to this post
    Ivan,

    Thanks for the sample. It looks easy enough to do, but it still does not have the share content functionality I am looking for. Could you send a sample with that functionality in place. My guess is that you would have to hit the api directly and somehow link the content back to recreate how that would work with the generic content editor.

    It's kind of a bummer that this functionality does not work with the htmlcontenteditor. Are there any plans to fix or add a similar built-in editor in the future?
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    04 Dec 2009
    Link to this post
    Hello Adam,

    I am not sure whether you have go through the code but there is written

    "// HERE YOU CAN USE GENERIC CONTENT TO GET THE SHARED CONTENT
     //INSTEAD OF RAD EDITOR CONTROL"


    So you have to create an instance of GenricContent control or wrap it entirely.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Jaime Weise
    Jaime Weise avatar
    120 posts
    Registered:
    02 Nov 2008
    22 Jul 2010
    Link to this post
    Have a little bit of a nicer editor

    protected override void CreateChildControls()
      {
          Controls.Clear();
            
          _RadEditor = new RadEditor();
          _RadEditor.ToolsFile = "~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml";
          _RadEditor.Skin = "Black";
          _RadEditor.ContentAreaCssFile = "~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorContentArea.css";
          EditorCssFile file = new EditorCssFile();
          file.Value = "~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorCssFile.css";
          _RadEditor.CssFiles.Add(file);
          EditorFilters filters = EditorFilters.EncodeScripts | EditorFilters.FixUlBoldItalic | EditorFilters.IECleanAnchors | EditorFilters.MozEmStrong | EditorFilters.ConvertFontToSpan | EditorFilters.ConvertToXhtml | EditorFilters.IndentHTMLContent;
          _RadEditor.ContentFilters = filters;
          _RadEditor.Width = 700;
          Controls.Add(_RadEditor);
      }

    Cheers !
Register for webinar
7 posts, 0 answered