-
Notifications
You must be signed in to change notification settings - Fork 18
t/344: Refactoring of the dropdown ecosystem #361
Conversation
OK I've updated the PR with the following changes:
Most changes are visible on fremework guide: fee7755...t/344#diff-1cd2b60b887d6d0735a58a4331b24806 Updated usage in features:
|
Some notes from the call:
|
Although, when I look at the bindings in |
src/button/buttoninterface.jsdoc
Outdated
* | ||
* document.body.append( view.element ); | ||
* | ||
* @extends module:ui/view~View |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
It's a copy-paste artifact.
src/button/buttoninterface.jsdoc
Outdated
/** | ||
* The button interface. | ||
* | ||
* @interface module:ui/button/buttoninterface~ButtonInterface |
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 already Plugin
and PluginInterface
because I wasn't able to name both without using the Interface
suffix.
*/ | ||
|
||
/** | ||
* 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - it should be "fired when the button is clicked".
|
||
buttonView.bind( 'isEnabled' ).to( dropdownView ); | ||
|
||
if ( buttonView instanceof DropdownButtonView ) { |
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.
This is ugly. Why is the createDropdown()
function responsible for that? What if I'd create another button view which implements the same interface as the dropdown button but is not an instance of DropdownButtonView
?
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.
We should delegate this logic out of here.
render() { | ||
super.render(); | ||
|
||
this.children.add( this.actionView ); |
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.
For the future: https://github.com/ckeditor/ckeditor5-utils/issues/221
OK, we're not going to use the word |
Internal: Aligned dropdowns usage to changed in the UI. See ckeditor/ckeditor5-ui#361.
Internal: Aligned dropdowns usage to changed in the UI. See ckeditor/ckeditor5-ui#361.
Internal: Aligned dropdowns usage to changed in the UI. See ckeditor/ckeditor5-ui#361.
OK, I closed this PR and branches in the utils, alignment, theme-lark and heading repos. I leave the rest to you, @jodator. Also, I reported ckeditor/ckeditor5#831 and plan to report issue about the |
Suggested merge commit message (convention)
Enhancement: Introduce
SplitButtonView
and new dropdowns helper methods. Closes ckeditor/ckeditor5#5434. Closes ckeditor/ckeditor5#5441.BREAKING CHANGE: Removed
DropdownModel
interface - use dropdown properties directly. See ckeditor/ckeditor5#5441.BREAKING CHANGE: Removed
createButtonDropdown()
andButtonDropdownView
. See ckeditor/ckeditor5#5441.BREAKING CHANGE: Removed
createListDropdown()
andListDropdownView
. See ckeditor/ckeditor5#5441.Changes in other repositories:
Merge commit message for related branches:
Additional information
So this is initial PR with SplitButton (ckeditor/ckeditor5#5434) and Dropdowns cleanup (ckeditor/ckeditor5#5441) - mostly to open some discussion on how to close ckeditor/ckeditor5#5441 as there are some things to consider here.
To quickly see how dropdowns are created now checkout Framework Guide Stub with two examples. This file is created mostly for PR but might be expanded if needed for guides.
To see how new dropdowns are used in features checkout:
Or checkout:
ckeditor5#t/ckeditor5-highlight/3
branch with propermgit.json
configuration (Sorry for branches names but that issue evolved a bit).As suggested I've tried to create minimal set of methods. What I like here is that button appearance is controlled by model.
Some things that might be improved
ui
packageaddDefaultBehavior()
which called three methods but I've removed to meke less methods. Below code is duplicated everywhere:Things that require fixes: