-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the toolbar dropdown that groups other buttons #5428
Comments
I've fiddled a bit with dropdowns in Google Docs and: They have two major types of such dropdowns buttons:
Ad. 1.
Examples: Ad. 2.
Examples As I can see we could go with similar approach and implement both as:
As for questions:
For me it's direct child of dropdown view (at least option 1 that groups buttons).
There's already an issue for this with details in here. The proposed way of grouping buttons to split button could be straightforward when:
I think that in MVP taking an alignment and header buttons grouping we should implement So the
|
@oleq I'd made some prototype that binds I'd go with this solution (grouping buttonViews not models) to enable such configurations later on: toolbar: [
{
type: 'dropdown',
items: [ 'alignLeft', 'alignRight', 'alignCenter' ]
}
] as I understand this this would take toolbar items ( ps.: I haven't done much in terms of CSS/styling - I've just put some buttons as panel view children - so the alignment is as is. |
This might be a kinda related topic https://github.com/ckeditor/ckeditor5-ui/issues/124. |
Another POC of using ButtonViews: Adding 'alignments' toolbar component: // This might be later refactored as toolbar config
componentFactory.add( 'alignments', locale => {
const buttons = styles.map( style => {
componentFactory.create( AlignmentEditing.commandName( style ) );
} );
return createButtonDropdown( buttons, locale );
} );
// then use:
ClassicEditor
.create( document.querySelector( '#editor' ), {
plugins: [ ArticlePluginSet, Alignment ],
toolbar: [ 'alignments' ] // or only buttons
} ) Button behavior: Disabled state on image caption: |
I agree 👍. PlanFirst stageLet's focus on option1 first. We need it ASAP for alignment. TBH, it boils down to this old issue. Issue to resolve here:
Second stageThen let's extend it for headers. So developers can choose from:
Third stageOption 2 will be needed by marker/highlight feature, so let's postpone it a little bit. ConfigurabilityTo KISS and speed up the development, in MVP, there will be no such thing as toolbar: [
{
type: 'dropdown',
items: [ 'alignLeft', 'alignRight', 'alignCenter' ]
}
] because it means more work with the toolbar configuration and config: {
toolbar: [ 'headingsDropdown', 'bold', 'italic', 'custombutton' ]
} or config: {
toolbar: [ 'headingX', 'headingY', 'headingZ', 'bold', 'italic', 'custombutton' ]
} or config: {
toolbar: [ 'headingsCompactDropdown', 'bold', 'italic', 'custombutton' ]
} |
The demo above I've created with a new creature: Also I think that The So in other words:
Yes it's different component (current dropdown list feature). |
@oleq: my dev Also a case for |
Feature: Initial implementation of the `ButtonDropdownView`. Closes #333. Also: * Allowed vertical layout of the `ToolbarView` thanks to the `#isVertical` attribute. * Implemented `ToolbarView#className` attribute. * Implemented `DropdownView#isEnabled` attribute along with the CSS class binding.
Feature: Implemented styles for the ButtonDropdown (see: ckeditor/ckeditor5-ui#333). Fixed spacing issues with toolbar items wrapped to the new line. Closes ckeditor/ckeditor5#682. Also: * Various improvements to visual styles of the dropdowns. * Migrated toolbar to CSS `flex`. * Allowed vertical toolbars.
The component should look more or less like this:
DropdownView
?A follow–up of https://github.com/ckeditor/ckeditor5-alignment/issues/2.
The text was updated successfully, but these errors were encountered: