-
Notifications
You must be signed in to change notification settings - Fork 18
t/344: Refactoring of the dropdown ecosystem #361
Changes from 74 commits
cdbc350
7de6eb4
3e62922
537fbe6
f4fe2e8
7804863
575b2a9
488d050
4a291b9
08fa387
2c96b24
dbc7a70
0394490
e1cc15c
102e5c7
ba2a0ee
79ec879
63642cf
b70ffca
80c7258
5cf51a5
9236088
16f14ed
7bf2edb
53a9fdc
a8b8f2f
0d33dc2
481630c
67251f9
ba41ff8
7b109be
aee02ee
420de05
b787981
d03791a
1b93679
88217ed
4ee81bf
b39b544
358c022
335e5cb
3d21766
26d94b6
e942460
f446a4a
acca5f4
2e2815f
30e1e9b
bcd04c5
2e7ab21
fec44e7
82b46f3
a0e8743
e5251ed
e3139aa
8161c10
23e0d16
093e735
2264fcf
caefc2c
2841422
383524c
39449f7
f1beae8
b071836
f92a96b
3e0d7a8
6a08edc
33783eb
a0308c3
1413c2e
41e1bbe
2b0291d
8344775
faa800b
110f4f8
a908e03
07925bb
7c0e6c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
/** | ||
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/** | ||
* @module ui/button/buttoninterface | ||
*/ | ||
|
||
/** | ||
* The button interface. | ||
* | ||
* @interface module:ui/button/buttoninterface~ButtonInterface | ||
*/ | ||
|
||
/** | ||
* The button view class. | ||
* | ||
* const view = new ButtonView(); | ||
* | ||
* view.set( { | ||
* label: 'A button', | ||
* keystroke: 'Ctrl+B', | ||
* tooltip: true, | ||
* withText: true | ||
* } ); | ||
* | ||
* view.render(); | ||
* | ||
* document.body.append( view.element ); | ||
* | ||
* @extends module:ui/view~View | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is this? ;) Is it an interface, is it a class or is it a plain? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a copy-paste artifact. |
||
*/ | ||
|
||
/** | ||
* The label of the button view visible to the user when {@link #withText} is `true`. | ||
* It can also be used to create a {@link #tooltip}. | ||
* | ||
* @observable | ||
* @member {String} #label | ||
*/ | ||
|
||
/** | ||
* (Optional) The keystroke associated with the button, i.e. <kbd>CTRL+B</kbd>, | ||
* in the string format compatible with {@link module:utils/keyboard}. | ||
* | ||
* @observable | ||
* @member {Boolean} #keystroke | ||
*/ | ||
|
||
/** | ||
* (Optional) Tooltip of the button, i.e. displayed when hovering the button with the mouse cursor. | ||
* | ||
* * If defined as a `Boolean` (e.g. `true`), then combination of `label` and `keystroke` will be set as a tooltip. | ||
* * If defined as a `String`, tooltip will equal the exact text of that `String`. | ||
* * If defined as a `Function`, `label` and `keystroke` will be passed to that function, which is to return | ||
* a string with the tooltip text. | ||
* | ||
* const view = new ButtonView( locale ); | ||
* view.tooltip = ( label, keystroke ) => `A tooltip for ${ label } and ${ keystroke }.` | ||
* | ||
* @observable | ||
* @default false | ||
* @member {Boolean|String|Function} #tooltip | ||
*/ | ||
|
||
/** | ||
* (Optional) The position of the tooltip. See {@link module:ui/tooltip/tooltipview~TooltipView#position} | ||
* to learn more about the available position values. | ||
* | ||
* **Note:** It makes sense only when the {@link #tooltip `tooltip` attribute} is defined. | ||
* | ||
* @observable | ||
* @default 's' | ||
* @member {'s'|'n'} #position | ||
*/ | ||
|
||
/** | ||
* The HTML type of the button. Default `button`. | ||
* | ||
* @observable | ||
* @member {'button'|'submit'|'reset'|'menu'} #type | ||
*/ | ||
|
||
/** | ||
* Controls whether the button view is "on". It makes sense when a feature it represents | ||
* is currently active, e.g. a bold button is "on" when the selection is in the bold text. | ||
* | ||
* To disable the button, use {@link #isEnabled} instead. | ||
* | ||
* @observable | ||
* @member {Boolean} #isOn | ||
*/ | ||
|
||
/** | ||
* Controls whether the button view is enabled, i.e. it can be clicked and execute an action. | ||
* | ||
* To change the "on" state of the button, use {@link #isOn} instead. | ||
* | ||
* @observable | ||
* @member {Boolean} #isEnabled | ||
*/ | ||
|
||
/** | ||
* Controls whether the button view is visible. Visible by default, buttons are hidden | ||
* using a CSS class. | ||
* | ||
* @observable | ||
* @member {Boolean} #isVisible | ||
*/ | ||
|
||
/** | ||
* (Optional) Controls whether the label of the button is hidden (e.g. an icon–only button). | ||
* | ||
* @observable | ||
* @member {Boolean} #withText | ||
*/ | ||
|
||
/** | ||
* (Optional) An XML {@link module:ui/icon/iconview~IconView#content content} of the icon. | ||
* When defined, an `iconView` should be added to the button. | ||
* | ||
* @observable | ||
* @member {String} #icon | ||
*/ | ||
|
||
/** | ||
* (Optional) Controls the `tabindex` HTML attribute of the button. By default, the button is focusable | ||
* but does not included in the <kbd>Tab</kbd> order. | ||
* | ||
* @observable | ||
* @default -1 | ||
* @member {String} #tabindex | ||
*/ | ||
/** | ||
* Fired when the button view is clicked. It won't be fired when the button {@link #isEnabled} | ||
* is `false`. | ||
* | ||
* @event execute | ||
*/ |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/** | ||
* @module ui/dropdown/button/dropdownbuttoninterface | ||
*/ | ||
|
||
/** | ||
* The dropdown button interface. | ||
* | ||
* @interface module:ui/dropdown/button/dropdownbuttoninterface~DropdownButtonInterface | ||
* @extends module:ui/button/buttoninterface~ButtonInterface | ||
*/ | ||
|
||
/** | ||
* Fired when the arrow view is clicked. It won't be fired when the button {@link #isEnabled} is `false`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this describe the split button? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah - it should be "fired when the button is clicked". |
||
* | ||
* @event open | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like using the word
Interface
in names of interfaces but sometimes it's just super hard to find a way around this. There's alreadyPlugin
andPluginInterface
because I wasn't able to name both without using theInterface
suffix.