问题
The documentation is not very clear on this.
name - String - Button name to add.
settings - Object - Settings object with title, cmd etc.
"etc"? Really? Where can I see the rest of the possible attributes?
回答1:
autofocus: True if the control should be focused when renderedborder: Border box values example: 1 1 1 1classes: Space separated list of classes to adddisabled: Is the control disabled by defaulthidden: Is the control hidden by defaulticon: Icon to use for buttonimage: Image to use for iconmargin: Margin box values example: 1 1 1 1minHeight: Minimal height for the controlminWidth: Minimal width for the controlname: Name of the control instancepadding: Padding box values example: 1 1 1 1role: WAI-ARIA role to use for controlsize: Size of the button small|medium|largestyle: Style CSS properties to addtext: Text to display inside widgettooltip: Tooltip text to display when hovering
For a full list of all the settings and methods see the TinyMCE documentation page
回答2:
What you would like to know is what settings may fit into the settings object (tinymce 3). Here it is:
title --> title
label --> label
scope --> scope
onclick --> function to be called onclick
menu_button --> flag, defines if the button is a menu button
cmd --> tinymce command to get executed onClick
ui --> paramter for the tinymce command cmd
value --> value for the tinymce command cmd
Those settings get assigned in the function createButton of the class ControlManager.
回答3:
Having had the same issue trying to find the addButton docs in V4 I found the link, just in case anybody needs it.
tinymce.ui.Button
Hope it helps someone!
来源:https://stackoverflow.com/questions/14399267/what-are-all-the-possible-settings-attributes-in-tinymces-addbutton-function