52

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?

Community
  • 1
  • 1
mae
  • 14,947
  • 8
  • 32
  • 47
  • 6
    Yea, i can't believe how ugly the tinyMCE documentation is... im here for the same thing... when i saw the "etc" there after 2 possible setting options i laughed so hard. – msqar Jun 18 '15 at 19:28
  • I thought I was the only one thinking this. The TinyMCE API documentation is absolutely atrocious. – SUM1 May 23 '20 at 23:51

3 Answers3

40
  • autofocus: True if the control should be focused when rendered
  • border: Border box values example: 1 1 1 1
  • classes: Space separated list of classes to add
  • disabled: Is the control disabled by default
  • hidden: Is the control hidden by default
  • icon: Icon to use for button
  • image: Image to use for icon
  • margin: Margin box values example: 1 1 1 1
  • minHeight: Minimal height for the control
  • minWidth: Minimal width for the control
  • name: Name of the control instance
  • padding: Padding box values example: 1 1 1 1
  • role: WAI-ARIA role to use for control
  • size: Size of the button small|medium|large
  • style: Style CSS properties to add
  • text: Text to display inside widget
  • tooltip: Tooltip text to display when hovering

For a full list of all the settings and methods see the TinyMCE documentation page

Jason
  • 2,503
  • 3
  • 38
  • 46
18

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.

Thariama
  • 50,002
  • 13
  • 138
  • 166
6

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!

MikeT
  • 51,415
  • 16
  • 49
  • 68
Andy
  • 333
  • 4
  • 10
  • It is not enough simply point to an external link. Your post should explain the answer possibly with an example and point to an external resource for more details. – warunapww Aug 18 '16 at 05:54
  • 1
    Thank you! The only comment to has the actual link to the documentation for the settings object! – David Domingo Oct 26 '16 at 08:48
  • @Andy in that case read https://stackoverflow.com/help/how-to-answer :-) – warunapww Jun 29 '18 at 18:31