November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
[EditorPlugIn(DisplayName="My Submenu",
Usage=ToolUsage.ContextMenu,
SubMenuName="MySubMenu")]
public class MySubMenuContainer : ToolBase
{ }
3) Whether any given tool is available or not can be controlled both on the server side and client side. To use server side logic to decide if a tool should be available or not, let your tool implement the IConfigurableTool interface. Implement the "Available" method to return a boolean value based on custom logic.
Simple code sample:
bool IConfigurableTool.Available(HtmlEditor editor)
{
return CustomLogicForAvailabilityHere();
}
To enable/disable a tool based on client side logic, assign a call to some javascript function for ToolBase.ClientSideEnabled in your tool implementation. Normally you want to pass in the ID of the correct editor instance to the function, so you can check whether the user has any current text selections or similar in the editor.
Simple code sample snippet:
public class MyTool : ToolBase, IInitializableTool
{
void IInitializableTool.Initialize(HtmlEditor editor)
{
ClientSideEnabled = String.Format("MyJavaScriptFunctionHere('{0}')", editor.ClientID);
// Other code to initialize your tool...
}
}
4) Yes, you are free to add your own tools to any of the submenus. You simply specify the "MenuName" attribute of your EditorPlugInAttribute to the name of the submenu you want the tool to appear in. I am currently not sure if/where that information is available, but the names of the built-in submenus are:
- SelectMenu
- InsertMenu
- TableMenu
- FormatParagraphMenu
Good luck with your editor plug-ins!