button.jsdoc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /**
  2. * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /**
  6. * @module ui/button/button
  7. */
  8. /**
  9. * The button interface. Implemented by, among others, {@link module:ui/button/buttonview~ButtonView},
  10. * {@link module:ui/dropdown/button/splitbuttonview~SplitButtonView} and
  11. * {@link module:ui/dropdown/button/dropdownbuttonview~DropdownButtonView}.
  12. *
  13. * @interface module:ui/button/button~Button
  14. */
  15. /**
  16. * The label of the button view visible to the user when {@link #withText} is `true`.
  17. * It can also be used to create a {@link #tooltip}.
  18. *
  19. * @observable
  20. * @member {String} #label
  21. */
  22. /**
  23. * (Optional) The keystroke associated with the button, i.e. <kbd>CTRL+B</kbd>,
  24. * in the string format compatible with {@link module:utils/keyboard}.
  25. *
  26. * **Note**: Use {@link module:ui/button/button~Button#withKeystroke} if you want to display
  27. * the keystroke information next to the {@link module:ui/button/button~Button#label label}.
  28. *
  29. * @observable
  30. * @member {Boolean} #keystroke
  31. */
  32. /**
  33. * (Optional) Tooltip of the button, i.e. displayed when hovering the button with the mouse cursor.
  34. *
  35. * * If defined as a `Boolean` (e.g. `true`), then combination of `label` and `keystroke` will be set as a tooltip.
  36. * * If defined as a `String`, tooltip will equal the exact text of that `String`.
  37. * * If defined as a `Function`, `label` and `keystroke` will be passed to that function, which is to return
  38. * a string with the tooltip text.
  39. *
  40. * const view = new ButtonView( locale );
  41. * view.tooltip = ( label, keystroke ) => `A tooltip for ${ label } and ${ keystroke }.`
  42. *
  43. * @observable
  44. * @default false
  45. * @member {Boolean|String|Function} #tooltip
  46. */
  47. /**
  48. * (Optional) The position of the tooltip. See {@link module:ui/tooltip/tooltipview~TooltipView#position}
  49. * to learn more about the available position values.
  50. *
  51. * **Note:** It makes sense only when the {@link #tooltip `tooltip` attribute} is defined.
  52. *
  53. * @observable
  54. * @default 's'
  55. * @member {'s'|'n'} #tooltipPosition
  56. */
  57. /**
  58. * The HTML type of the button. Default `button`.
  59. *
  60. * @observable
  61. * @member {'button'|'submit'|'reset'|'menu'} #type
  62. */
  63. /**
  64. * Controls whether the button view is "on". It makes sense when a feature it represents
  65. * is currently active, e.g. a bold button is "on" when the selection is in the bold text.
  66. *
  67. * To disable the button, use {@link #isEnabled} instead.
  68. *
  69. * @observable
  70. * @default true
  71. * @member {Boolean} #isOn
  72. */
  73. /**
  74. * Controls whether the button view is enabled, i.e. it can be clicked and execute an action.
  75. *
  76. * To change the "on" state of the button, use {@link #isOn} instead.
  77. *
  78. * @observable
  79. * @default true
  80. * @member {Boolean} #isEnabled
  81. */
  82. /**
  83. * Controls whether the button view is visible. Visible by default, buttons are hidden
  84. * using a CSS class.
  85. *
  86. * @observable
  87. * @default true
  88. * @member {Boolean} #isVisible
  89. */
  90. /**
  91. * Controls whether the button view is a toggle button (two–state) for assistive technologies.
  92. *
  93. * @observable
  94. * @default false
  95. * @member {Boolean} #isToggleable
  96. */
  97. /**
  98. * (Optional) Controls whether the label of the button is hidden (e.g. an icon–only button).
  99. *
  100. * @observable
  101. * @default false
  102. * @member {Boolean} #withText
  103. */
  104. /**
  105. * (Optional) Controls whether the keystroke of the button is displayed next to its
  106. * {@link module:ui/button/button~Button#label label}.
  107. *
  108. * **Note**: This property requires a {@link module:ui/button/button~Button#keystroke keystroke}
  109. * to be defined in the first place.
  110. *
  111. * @observable
  112. * @default false
  113. * @member {Boolean} #withKeystroke
  114. */
  115. /**
  116. * (Optional) An XML {@link module:ui/icon/iconview~IconView#content content} of the icon.
  117. * When defined, an `iconView` should be added to the button.
  118. *
  119. * @observable
  120. * @member {String} #icon
  121. */
  122. /**
  123. * (Optional) Controls the `tabindex` HTML attribute of the button. By default, the button is focusable
  124. * but does not included in the <kbd>Tab</kbd> order.
  125. *
  126. * @observable
  127. * @default -1
  128. * @member {String} #tabindex
  129. */
  130. /**
  131. * (Optional) The additional CSS class set on the button.
  132. *
  133. * @observable
  134. * @member {String} #class
  135. */
  136. /**
  137. * (Optional) The value of the `style` attribute of the label.
  138. *
  139. * @observable
  140. * @member {String} #labelStyle
  141. */
  142. /**
  143. * Fired when the button view is clicked. It won't be fired when the button {@link #isEnabled}
  144. * is `false`.
  145. *
  146. * @event execute
  147. */