8
0

button.jsdoc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /**
  2. * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  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. * @observable
  27. * @member {Boolean} #keystroke
  28. */
  29. /**
  30. * (Optional) Tooltip of the button, i.e. displayed when hovering the button with the mouse cursor.
  31. *
  32. * * If defined as a `Boolean` (e.g. `true`), then combination of `label` and `keystroke` will be set as a tooltip.
  33. * * If defined as a `String`, tooltip will equal the exact text of that `String`.
  34. * * If defined as a `Function`, `label` and `keystroke` will be passed to that function, which is to return
  35. * a string with the tooltip text.
  36. *
  37. * const view = new ButtonView( locale );
  38. * view.tooltip = ( label, keystroke ) => `A tooltip for ${ label } and ${ keystroke }.`
  39. *
  40. * @observable
  41. * @default false
  42. * @member {Boolean|String|Function} #tooltip
  43. */
  44. /**
  45. * (Optional) The position of the tooltip. See {@link module:ui/tooltip/tooltipview~TooltipView#position}
  46. * to learn more about the available position values.
  47. *
  48. * **Note:** It makes sense only when the {@link #tooltip `tooltip` attribute} is defined.
  49. *
  50. * @observable
  51. * @default 's'
  52. * @member {'s'|'n'} #tooltipPosition
  53. */
  54. /**
  55. * The HTML type of the button. Default `button`.
  56. *
  57. * @observable
  58. * @member {'button'|'submit'|'reset'|'menu'} #type
  59. */
  60. /**
  61. * Controls whether the button view is "on". It makes sense when a feature it represents
  62. * is currently active, e.g. a bold button is "on" when the selection is in the bold text.
  63. *
  64. * To disable the button, use {@link #isEnabled} instead.
  65. *
  66. * @observable
  67. * @default true
  68. * @member {Boolean} #isOn
  69. */
  70. /**
  71. * Controls whether the button view is enabled, i.e. it can be clicked and execute an action.
  72. *
  73. * To change the "on" state of the button, use {@link #isOn} instead.
  74. *
  75. * @observable
  76. * @default true
  77. * @member {Boolean} #isEnabled
  78. */
  79. /**
  80. * Controls whether the button view is visible. Visible by default, buttons are hidden
  81. * using a CSS class.
  82. *
  83. * @observable
  84. * @default true
  85. * @member {Boolean} #isVisible
  86. */
  87. /**
  88. * (Optional) Controls whether the label of the button is hidden (e.g. an icon–only button).
  89. *
  90. * @observable
  91. * @default false
  92. * @member {Boolean} #withText
  93. */
  94. /**
  95. * (Optional) An XML {@link module:ui/icon/iconview~IconView#content content} of the icon.
  96. * When defined, an `iconView` should be added to the button.
  97. *
  98. * @observable
  99. * @member {String} #icon
  100. */
  101. /**
  102. * (Optional) Controls the `tabindex` HTML attribute of the button. By default, the button is focusable
  103. * but does not included in the <kbd>Tab</kbd> order.
  104. *
  105. * @observable
  106. * @default -1
  107. * @member {String} #tabindex
  108. */
  109. /**
  110. * (Optional) The additional CSS class set on the button.
  111. *
  112. * @observable
  113. * @member {String} #class
  114. */
  115. /**
  116. * (Optional) The value of the `style` attribute of the label.
  117. *
  118. * @observable
  119. * @member {String} #labelStyle
  120. */
  121. /**
  122. * Fired when the button view is clicked. It won't be fired when the button {@link #isEnabled}
  123. * is `false`.
  124. *
  125. * @event execute
  126. */