Adds a menu to the editor's toolbar, if a toolbar exists.
.addMenu(/* Object */ menuDefinition)
A hash of values that define the new menu. The valid values are:
label — The text label of the menu.
showLabel — When false, the menu label will not be displayed. Instead, it will be used as a tooltip. The default value is true.
iconClass — An optional CSS class that defines the menu's icon. Note that when showLabel is false, an icon class must be specified for the menu.
menuItems — An array of menu item definitions. These are the selections that will shown when the menu is invoked. Each menu item definition is a hash containing:
editor = new ESDWeb(null, 'editorNode'); /* set editor properties here */ editor.startup();
In code that runs after the editor is started:
editor.addMenu({ label: 'Custom Menu', showLabel: false, iconClass: 'customMenuIconClass', menuItems: [ { label: 'Print', showLabel: true, onClick: printDiagram }, { label: 'Unit of Measurement', showLabel: true, menuItems: [ { label: 'Meters', showLabel: true, onClick: function () { editor.set('uom', 'meters'); } }, { label: 'Feet and Inches', showLabel: true, onClick: function () { editor.set('uom', 'feetAndInches'); } }, { label: 'Feet and Tenths', showLabel: true, onClick: function () { editor.set('uom', 'feetAndTenths'); } } ] }, { label: 'Download Diagram File...', showLabel: true, onClick: downloadDiagramFile } ] });