Build toolbars programatically without using config files

Last post 03-03-2010, 12:24 PM by Adam. 13 replies.
Sort Posts: Previous Next
  •  03-01-2010, 12:27 PM 59065

    Build toolbars programatically without using config files

    How do we go about creating an instance of the editor in C#, and adding our own toolbars and toolbar controls without using inline markup or config files? We want to lock down the ability of developers to override our pre-defined tool bars without relying on a configuration file.
     
    e.g. pseudo-code
     
     
    CuteEditor.Editor editor = new CuteEditor.Editor();
    Toolbar toolbar = new Toolbar()
    toolbar.Add(new ToolbarControl("Bold");
    toolbar.Add(new ToolbarControl("Separator");
     
    editor.Toolbars.Add(toolbar)
  •  03-01-2010, 12:38 PM 59066 in reply to 59065

    Re: Build toolbars programatically without using config files

    MMCD:
    How do we go about creating an instance of the editor in C#, and adding our own toolbars and toolbar controls without using inline markup or config files? We want to lock down the ability of developers to override our pre-defined tool bars without relying on a configuration file.
     
    e.g. pseudo-code
     
     
    CuteEditor.Editor editor = new CuteEditor.Editor();
    Toolbar toolbar = new Toolbar()
    toolbar.Add(new ToolbarControl("Bold");
    toolbar.Add(new ToolbarControl("Separator");
     
    editor.Toolbars.Add(toolbar)
     
    Please use TemplateItemList property.
     

    C#:

    Editor1.TemplateItemList = "{bold, ilatic, underline}";

     


    VB:

    Editor1.TemplateItemList = "{bold, ilatic, underline}"

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  03-01-2010, 12:47 PM 59069 in reply to 59066

    Re: Build toolbars programatically without using config files

     Thanks. Is there more info somewhere in the documentation? How do we create multiple toolbars across multiple lines?
  •  03-01-2010, 2:19 PM 59075 in reply to 59069

    Re: Build toolbars programatically without using config files

    We would really like to know the proper formats needed to include the various buttons and dropdowns programmatically. We are ready to purchase a Rich Text Editor very shortly, and while this one has all the features we need to implement, we find the documentation and developers guides sorely lacking in details of implementation.
  •  03-01-2010, 3:24 PM 59077 in reply to 59075

    Re: Build toolbars programatically without using config files

    MMCD:
    We would really like to know the proper formats needed to include the various buttons and dropdowns programmatically. We are ready to purchase a Rich Text Editor very shortly, and while this one has all the features we need to implement, we find the documentation and developers guides sorely lacking in details of implementation.
     
    Please wait a few minutes. We will publish an article to explain how it works.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  03-01-2010, 4:11 PM 59083 in reply to 59075

    Re: Build toolbars programatically without using config files

  •  03-01-2010, 4:17 PM 59084 in reply to 59083

    Re: Build toolbars programatically without using config files

    Thank you very much!
  •  03-02-2010, 3:17 PM 59117 in reply to 59084

    Re: Build toolbars programatically without using config files

    Please see the screenshot of how this renders using the code behind technique. Why does this render this way? I would expect that all the buttons would appear on one toolbar across the top with no line breaks?
     
     
     
     
     
     
     
     
     
     
     
     
  •  03-02-2010, 3:32 PM 59118 in reply to 59117

    Re: Build toolbars programatically without using config files

    MMCD:
    Please see the screenshot of how this renders using the code behind technique. Why does this render this way? I would expect that all the buttons would appear on one toolbar across the top with no line breaks?
     
     
     
     
     
     
     
     
     
     
     
     
     
    It works for me.
     
    <CE:Editor id="Editor1" TemplateItemList="[bold,italic][print,find,tofullpage,fromfullpage][cute,copy,paste]" runat="server" ></CE:Editor>
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  03-02-2010, 3:44 PM 59120 in reply to 59118

    Re: Build toolbars programatically without using config files

    Your example that you gave me yesterday indicated to place a pipe "|" between each group of toolbars to force a separator. See below from your documentation. (http://cutesoft.net/developer+guide/index.htm#page=Toolbar-Configuration-using-TemplateItemList.htm)
     
    Toolbar Separator

    Within Toolbar groups, you can add toolbar separators between a group of toolbar buttons.

    You can use the "|" string to create separators.

    Editor1.TemplateItemList = "{bold, ilatic}|{Cut,Copy,Paste}"
    Editor1.TemplateItemList = "[bold, ilatic]|[Cut,Copy,Paste]"
    Editor1.TemplateItemList = "(bold, ilatic)|(Cut,Copy,Paste)"
     
  •  03-02-2010, 3:48 PM 59121 in reply to 59120

    Re: Build toolbars programatically without using config files

    MMCD:
    Your example that you gave me yesterday indicated to place a pipe "|" between each group of toolbars to force a separator. See below from your documentation. (http://cutesoft.net/developer+guide/index.htm#page=Toolbar-Configuration-using-TemplateItemList.htm)
     
    Toolbar Separator

    Within Toolbar groups, you can add toolbar separators between a group of toolbar buttons.

    You can use the "|" string to create separators.

    Editor1.TemplateItemList = "{bold, ilatic}|{Cut,Copy,Paste}"
    Editor1.TemplateItemList = "[bold, ilatic]|[Cut,Copy,Paste]"
    Editor1.TemplateItemList = "(bold, ilatic)|(Cut,Copy,Paste)"
     
     
    Sorry, it should be:
     
     
    Editor1.TemplateItemList = "{bold, ilatic | Cut,Copy,Paste}"
    Editor1.TemplateItemList = "[bold, ilatic | Cut,Copy,Paste]"
    Editor1.TemplateItemList = "(bold, ilatic | Cut,Copy,Paste)"
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  03-02-2010, 3:51 PM 59122 in reply to 59120

    Re: Build toolbars programatically without using config files

    Going back to my original question regarding configuration files. Is there any way to use and configure this control 100% on the server without relying on any config files at all. By this, I mean we do not want to rely on any file that reside in the /CuteSoft_Client/CuteEditor/Configuration/ folder. We understand that resources such as images and dialog scripts need to be present in certain folders, but we must be able to remove the configuration folder and do it 100% on the server.
  •  03-03-2010, 12:05 PM 59135 in reply to 59122

    Re: Build toolbars programatically without using config files

    MMCD:
    Going back to my original question regarding configuration files. Is there any way to use and configure this control 100% on the server without relying on any config files at all. By this, I mean we do not want to rely on any file that reside in the /CuteSoft_Client/CuteEditor/Configuration/ folder. We understand that resources such as images and dialog scripts need to be present in certain folders, but we must be able to remove the configuration folder and do it 100% on the server.
     
    Please wait a few minutes.  We are creating an example showing you how to do that.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  03-03-2010, 12:24 PM 59136 in reply to 59122

    Re: Build toolbars programatically without using config files

    MMCD:
    Going back to my original question regarding configuration files. Is there any way to use and configure this control 100% on the server without relying on any config files at all. By this, I mean we do not want to rely on any file that reside in the /CuteSoft_Client/CuteEditor/Configuration/ folder. We understand that resources such as images and dialog scripts need to be present in certain folders, but we must be able to remove the configuration folder and do it 100% on the server.
     
    Here is a simple example.
     
    Add the following code into the <appSettings> element of your application web.config file:
     
    <add key="CuteEditorProviderType" value="ProjectName.MyProvider,ProjectName" />
     
    C# code:
     
    1. public class MyProvider : CuteEditor.Impl.EditorProvider   
    2.     {   
    3.         public MyProvider(HttpContext context):base(context)   
    4.         {   
    5.         }   
    6.         public override CuteEditor.Impl.ConfigItem[] GetToolbarItems(CuteEditor.Editor editor, string type)   
    7.         {   
    8.             if(type=="toolbars")   
    9.             {   
    10.                 ArrayList items=new ArrayList();   
    11.                 CuteEditor.Impl.ConfigItem item;   
    12.   
    13.                 item=new CuteEditor.Impl.ConfigItem();   
    14.                 item.Type="g_start";   
    15.                 items.Add(item);   
    16.   
    17.                 item=new CuteEditor.Impl.ConfigItem();   
    18.                 item.Command="bold";   
    19.                 item.ImageName="bold";   
    20.                 items.Add(item);   
    21.   
    22.                 item=new CuteEditor.Impl.ConfigItem();   
    23.                 item.Type="g_end";   
    24.                 items.Add(item);   
    25.   
    26.                 return (CuteEditor.Impl.ConfigItem[])items.ToArray(typeof(CuteEditor.Impl.ConfigItem));   
    27.             }   
    28.             return base.GetToolbarItems (editor, type);   
    29.         }   
    30.   
    31.     }  

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML