ui.editor.ToolbarFactory

Classes


Public Protected Private

Global Functions

goog.ui.editor.ToolbarFactory.addFont(buttoncaptionvalue)
Adds a menu item to the given font menu button. The first font listed in the value argument is considered the font ID, so adding two items whose CSS style starts with the same font may lead to unpredictable results.
Arguments:
button : !goog.ui.Select
Font menu button.
caption : string
Caption to show for the font menu.
value : string
Value for the corresponding 'font-family' CSS style.
code »
goog.ui.editor.ToolbarFactory.addFontSize(buttoncaptionvalue)
Adds a menu item to the given font size menu button. The value argument must be a legacy HTML font size in the 0-7 range.
Arguments:
button : !goog.ui.Select
Font size menu button.
caption : string
Caption to show in the font size menu.
value : number
Value for the corresponding HTML font size.
code »
goog.ui.editor.ToolbarFactory.addFontSizes(button)
Bulk-adds font sizes to the given font size menu button. The argument must be an array of font size descriptor objects, each of which must have the following attributes:
  • caption - Caption to show in the font size menu (e.g. 'Huge')
  • value - Value for the corresponding HTML font size (e.g. 6)
Arguments:
button : !goog.ui.Select
Font size menu button.
: !Array.<{caption: string, value:numbe>
No description.
code »
goog.ui.editor.ToolbarFactory.addFonts(button)
Bulk-adds fonts to the given font menu button. The argument must be an array of font descriptor objects, each of which must have the following attributes:
  • caption - Caption to show in the font menu (e.g. 'Tahoma')
  • value - Value for the corresponding 'font-family' CSS style (e.g. 'Tahoma, Arial, sans-serif')
Arguments:
button : !goog.ui.Select
Font menu button.
: !Array.<{caption: string, value: strin>
No description.
code »
goog.ui.editor.ToolbarFactory.addFormatOption(buttoncaptiontag)
Adds a menu item to the given "Format block" menu button.
Arguments:
button : !goog.ui.Select
"Format block" menu button.
caption : string
Caption to show in the menu.
tag : goog.dom.TagName
Corresponding block format tag.
code »
goog.ui.editor.ToolbarFactory.addFormatOptions(button)
Bulk-adds format options to the given "Format block" menu button. The argument must be an array of format option descriptor objects, each of which must have the following attributes:
  • caption - Caption to show in the menu (e.g. 'Minor heading')
  • command - Corresponding goog.dom.TagName (e.g. 'H4')
Arguments:
button : !goog.ui.Select
"Format block" menu button.
: !Array.<{caption: string, command: goog.dom.TagNam>
No description.
code »
goog.ui.editor.ToolbarFactory.createContent_(captionopt_classNamesopt_domHelper) !Element
Creates a new DIV that wraps a button caption, optionally applying CSS class names to it. Used as a helper function in button factory methods.
Arguments:
caption : goog.ui.ControlContent
Button caption.
opt_classNames : string=
CSS class name(s) to apply to the DIV that wraps the caption (if any).
opt_domHelper : goog.dom.DomHelper=
DOM helper, used for DOM creation; defaults to the current document if unspecified.
Returns: !Element  DIV that wraps the caption.
code »
goog.ui.editor.ToolbarFactory.getLegacySizeFromPx(px) number
Converts a pixel font size specification into an equivalent legacy size. For example, font-size: 32px; is &lt;font size="6"&gt;, etc. If the given pixel size doesn't exactly match one of the legacy sizes, -1 is returned.
Arguments:
px : number
Pixel font size.
Returns: number  Equivalent legacy size spec in the 0-7 range, or -1 if none exists.
code »
goog.ui.editor.ToolbarFactory.getPrimaryFont(fontSpec) string
Takes a font spec (e.g. "Arial, Helvetica, sans-serif") and returns the primary font name, normalized to lowercase (e.g. "arial").
Arguments:
fontSpec : string
Font specification.
Returns: string  The primary font name, in lowercase.
code »
goog.ui.editor.ToolbarFactory.getPxFromLegacySize(fontSize) number
Converts a legacy font size specification into an equivalent pixel size. For example, &lt;font size="6"&gt; is font-size: 32px;, etc.
Arguments:
fontSize : number
Legacy font size spec in the 0-7 range.
Returns: number  Equivalent pixel size.
code »
goog.ui.editor.ToolbarFactory.makeButton(idtooltipcaptionopt_classNamesopt_rendereropt_domHelper) !goog.ui.Button
Creates a toolbar button with the given ID, tooltip, and caption. Applies any custom CSS class names to the button's caption element.
Arguments:
id : string
Button ID; must equal a goog.editor.Command for built-in buttons, anything else for custom buttons.
tooltip : string
Tooltip to be shown on hover.
caption : goog.ui.ControlContent
Button caption.
opt_classNames : string=
CSS class name(s) to apply to the caption element.
opt_renderer : goog.ui.ButtonRenderer=
Button renderer; defaults to goog.ui.ToolbarButtonRenderer if unspecified.
opt_domHelper : goog.dom.DomHelper=
DOM helper, used for DOM creation; defaults to the current document if unspecified.
Returns: !goog.ui.Button  A toolbar button.
code »
goog.ui.editor.ToolbarFactory.makeColorMenuButton(idtooltipcaptionopt_classNamesopt_rendereropt_domHelper) !goog.ui.ColorMenuButton
Creates a color menu button with the given ID, tooltip, and caption. Applies any custom CSS class names to the button's caption element. The button is created with a default color menu containing standard color palettes.
Arguments:
id : string
Button ID; must equal a goog.editor.Command for built-in toolbar buttons, but can be anything else for custom buttons.
tooltip : string
Tooltip to be shown on hover.
caption : goog.ui.ControlContent
Button caption.
opt_classNames : string=
CSS class name(s) to apply to the caption element.
opt_renderer : goog.ui.ColorMenuButtonRenderer=
Button renderer; defaults to goog.ui.ToolbarColorMenuButtonRenderer if unspecified.
opt_domHelper : goog.dom.DomHelper=
DOM helper, used for DOM creation; defaults to the current document if unspecified.
Returns: !goog.ui.ColorMenuButton  A color menu button.
code »
goog.ui.editor.ToolbarFactory.makeMenuButton(idtooltipcaptionopt_classNamesopt_rendereropt_domHelper) !goog.ui.MenuButton
Creates a menu button with the given ID, tooltip, and caption. Applies any custom CSS class names to the button's caption element. The button returned doesn't have an actual menu attached; use goog.ui.MenuButton#setMenu to attach a goog.ui.Menu to the button.
Arguments:
id : string
Button ID; must equal a goog.editor.Command for built-in buttons, anything else for custom buttons.
tooltip : string
Tooltip to be shown on hover.
caption : goog.ui.ControlContent
Button caption.
opt_classNames : string=
CSS class name(s) to apply to the caption element.
opt_renderer : goog.ui.ButtonRenderer=
Button renderer; defaults to goog.ui.ToolbarMenuButtonRenderer if unspecified.
opt_domHelper : goog.dom.DomHelper=
DOM helper, used for DOM creation; defaults to the current document if unspecified.
Returns: !goog.ui.MenuButton  A menu button.
code »
goog.ui.editor.ToolbarFactory.makeSelectButton(idtooltipcaptionopt_classNamesopt_rendereropt_domHelper) !goog.ui.Select
Creates a select button with the given ID, tooltip, and caption. Applies any custom CSS class names to the button's root element. The button returned doesn't have an actual menu attached; use goog.ui.Select#setMenu to attach a goog.ui.Menu containing goog.ui.Options to the select button.
Arguments:
id : string
Button ID; must equal a goog.editor.Command for built-in buttons, anything else for custom buttons.
tooltip : string
Tooltip to be shown on hover.
caption : goog.ui.ControlContent
Button caption; used as the default caption when nothing is selected.
opt_classNames : string=
CSS class name(s) to apply to the button's root element.
opt_renderer : goog.ui.MenuButtonRenderer=
Button renderer; defaults to goog.ui.ToolbarMenuButtonRenderer if unspecified.
opt_domHelper : goog.dom.DomHelper=
DOM helper, used for DOM creation; defaults to the current document if unspecified.
Returns: !goog.ui.Select  A select button.
code »
goog.ui.editor.ToolbarFactory.makeToggleButton(idtooltipcaptionopt_classNamesopt_rendereropt_domHelper) !goog.ui.Button
Creates a toggle button with the given ID, tooltip, and caption. Applies any custom CSS class names to the button's caption element. The button returned has checkbox-like toggle semantics.
Arguments:
id : string
Button ID; must equal a goog.editor.Command for built-in buttons, anything else for custom buttons.
tooltip : string
Tooltip to be shown on hover.
caption : goog.ui.ControlContent
Button caption.
opt_classNames : string=
CSS class name(s) to apply to the caption element.
opt_renderer : goog.ui.ButtonRenderer=
Button renderer; defaults to goog.ui.ToolbarButtonRenderer if unspecified.
opt_domHelper : goog.dom.DomHelper=
DOM helper, used for DOM creation; defaults to the current document if unspecified.
Returns: !goog.ui.Button  A toggle button.
code »
goog.ui.editor.ToolbarFactory.makeToolbar(itemselemopt_isRightToLeft) !goog.ui.Toolbar
Creates a goog.ui.Toolbar containing the specified set of toolbar buttons, and renders it into the given parent element. Each item in the items array must a goog.ui.Control.
Arguments:
items : !Array.<goog.ui.Control>
Toolbar items; each must be a goog.ui.Control.
elem : !Element
Toolbar parent element.
opt_isRightToLeft : boolean=
Whether the editor chrome is right-to-left; defaults to the directionality of the toolbar parent element.
Returns: !goog.ui.Toolbar  Editor toolbar, rendered into the given parent element.
code »

Global Properties

goog.ui.editor.ToolbarFactory.LEGACY_SIZE_TO_PX_MAP_ :
Map of legacy font sizes (0-7) to equivalent pixel sizes.
Code »

Package ui.editor

Package Reference