goog.ui.editor.ToolbarFactory
Namespace.addFont(button, caption, value)
Adds a menu item to the given font menu button. The first font listed in the {@code value} argument is considered the font ID, so adding two items whose CSS style starts with the same font may lead to unpredictable results.
button
{!goog.ui.Select
}
caption
{string
}
value
{string
}
.addFontSize(button, caption, value)
Adds a menu item to the given font size menu button. The {@code value} argument must be a legacy HTML font size in the 0-7 range.
button
{!goog.ui.Select
}
caption
{string
}
value
{number
}
.addFontSizes(button, sizes)
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:
button
{!goog.ui.Select
}
sizes
{!Array
.<{caption
: string
, value
:number
}>}
.addFonts(button, fonts)
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:
button
{!goog.ui.Select
}
fonts
{!Array
.<{caption
: string
, value
: string
}>}
.addFormatOption(button, caption, tag)
Adds a menu item to the given "Format block" menu button.
button
{!goog.ui.Select
}
caption
{string
}
tag
{goog.dom.TagName
}
.addFormatOptions(button, formats)
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:
button
{!goog.ui.Select
}
formats
{!Array
.<{caption
: string
, command
: goog.dom.TagName
}>}
.getLegacySizeFromPx(px)
Converts a pixel font size specification into an equivalent legacy size. For example, {@code font-size: 32px;} is {@code <font size="6">}, etc. If the given pixel size doesn't exactly match one of the legacy sizes, -1 is returned.
px
{number
}
number
}
.getPrimaryFont(fontSpec)
Takes a font spec (e.g. "Arial, Helvetica, sans-serif") and returns the primary font name, normalized to lowercase (e.g. "arial").
fontSpec
{string
}
string
}
.getPxFromLegacySize(fontSize)
Converts a legacy font size specification into an equivalent pixel size. For example, {@code <font size="6">} is {@code font-size: 32px;}, etc.
fontSize
{number
}
number
}
.makeButton(id, tooltip, caption, opt_classNames, opt_renderer, opt_domHelper)
Creates a toolbar button with the given ID, tooltip, and caption. Applies any custom CSS class names to the button's caption element.
id
{string
}
tooltip
{string
}
caption
{goog.ui.ControlContent
}
opt_classNames
{string
=}
opt_renderer
{goog.ui.ButtonRenderer
=}
opt_domHelper
{goog.dom.DomHelper
=}
goog.ui.Button
}
.makeColorMenuButton(id, tooltip, caption, opt_classNames, opt_renderer, opt_domHelper)
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.
id
{string
}
tooltip
{string
}
caption
{goog.ui.ControlContent
}
opt_classNames
{string
=}
opt_renderer
{goog.ui.ColorMenuButtonRenderer
=}
opt_domHelper
{goog.dom.DomHelper
=}
goog.ui.ColorMenuButton
}
.makeMenuButton(id, tooltip, caption, opt_classNames, opt_renderer, opt_domHelper)
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 {@link goog.ui.MenuButton#setMenu} to attach a {@link goog.ui.Menu} to the button.
id
{string
}
tooltip
{string
}
caption
{goog.ui.ControlContent
}
opt_classNames
{string
=}
opt_renderer
{goog.ui.ButtonRenderer
=}
opt_domHelper
{goog.dom.DomHelper
=}
goog.ui.MenuButton
}
.makeSelectButton(id, tooltip, caption, opt_classNames, opt_renderer, opt_domHelper)
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 {@link goog.ui.Select#setMenu} to attach a {@link goog.ui.Menu} containing {@link goog.ui.Option}s to the select button.
id
{string
}
tooltip
{string
}
caption
{goog.ui.ControlContent
}
opt_classNames
{string
=}
opt_renderer
{goog.ui.MenuButtonRenderer
=}
opt_domHelper
{goog.dom.DomHelper
=}
goog.ui.Select
}
.makeToggleButton(id, tooltip, caption, opt_classNames, opt_renderer, opt_domHelper)
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.
id
{string
}
tooltip
{string
}
caption
{goog.ui.ControlContent
}
opt_classNames
{string
=}
opt_renderer
{goog.ui.ButtonRenderer
=}
opt_domHelper
{goog.dom.DomHelper
=}
goog.ui.Button
}
.makeToolbar(items, elem, opt_isRightToLeft)
Creates a {@link goog.ui.Toolbar} containing the specified set of toolbar buttons, and renders it into the given parent element. Each item in the {@code items} array must a {@link goog.ui.Control}.
items
{!Array
.<goog.ui.Control
>}
elem
{!Element
}
opt_isRightToLeft
{boolean
=}
goog.ui.Toolbar
}