-
-
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
I/6146 multiline toolbar #8507
I/6146 multiline toolbar #8507
Conversation
…coupled document editor build.
…re used. Disable the flex wrapping only when shouldGroupWhenFull and isFloating toolbar options are enabled.
Hello @ckeditor/qa-team 👋, could you take a quick look at this feature? |
4a77277
to
6aff552
Compare
We've tested it and works fine 👍 |
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.
The PR looks good. I added some comments mostly concerning the docs.
@godai78, can you double-check this?
@wwalc We're waiting for your feedback regarding
Let's go with declarative multi-line toolbar for the document editor build. I will recheck what features could land there taking this occasion that we will have more space there.
from #6146 (comment). If you want to do this asynchronously, let us know to not block this PR 🙏
} | ||
``` | ||
|
||
* **`items`** – An array of toolbar item names. The components (buttons, dropdowns, etc.) which can be used as toolbar items are defined in `editor.ui.componentFactory` and can be listed using the following snippet: `Array.from( editor.ui.componentFactory.names() )` |
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 know this is a straight copy from https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/api/module_core_editor_editorconfig-EditorConfig.html#member-toolbar but mentioning componentFactory
(which is a pretty low-level API) here in the guide for people who see the editor for the first time may not be the best idea.
OTOH I don't know how we could avoid mentioning it. We don't have any guide for the component factory but it is used in the "Creating a simple plugin" guide so maybe at least link there?
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.
Maybe listing all items somewhere in the guide docs and linking there instead of mentioning about componentFactory?
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 would be nice if we had a dedicated "toolbar guide" that was called for somewhere in the issues. List items, configuration and options. Maybe I should take it on next iteration.
Useful when a page with which the editor is being integrated has some other sticky or fixed elements | ||
(e.g. the top menu). Thanks to setting the toolbar offset the toolbar will not be positioned underneath or above the page's UI. | ||
|
||
* **`shouldNotGroupWhenFull`** – When set `true`, the toolbar will stop grouping items and let them wrap to the next line when there is not enough space to display them in a single row. |
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 mention here that grouping is enabled by default.
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.
Ok. By the way, I am considering if it will be more clear if the name will be groupWhenFull
? (ofc. enabled by default).
There are also two ways of arranging buttons in multiple lines. Both require the extended format. | ||
|
||
1. Set `shouldNotGroupWhenFull` to true, so items will wrap automatically. | ||
2. Follow 1st point and set the breaking point explicitly using `'-'` separator: |
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 would not use the word "separator" here. It can be confused with the items group separator (`|`).
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 would also rephrase "Follow 1st point..." cc @godai78 .
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.
Change separator into "divider"?
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.
Or stay with
and set the breaking point explicitly using
'-'
.
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.
done
* | ||
* @error line-separator-used-when-button-grouping-enabled | ||
*/ | ||
logWarning( 'line-separator-used-when-button-grouping-enabled' ); |
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.
Maybe let's log config
along with this error. There could be multiple editors with different toolbar configs on the same page and for this error to be useful we should give developers some context.
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.
done
@@ -884,6 +911,13 @@ class DynamicGrouping { | |||
* @member {Boolean} module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull | |||
*/ | |||
|
|||
/** | |||
* To allow declarative toolbar breaks for floating toolbars it should be set to `true`. |
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 not exactly what this option is for. This should be more like:
This option should be enabled for toolbars in absolutely positioned containers without width restrictions to to enable automatic {@link module:ui/toolbar/toolbarview~ToolbarView#items} grouping.
When this option is set to `true`, items will stop wrapping to the next line and together with {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull} this will allow grouping them when there is not enough space in a single row.
+ this options should be mentioned in module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull
.
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.
corrected
@@ -118,6 +119,17 @@ describe( 'ToolbarView', () => { | |||
expect( view.itemsView.element.classList.contains( 'ck-toolbar__items' ) ).to.true; | |||
} ); | |||
|
|||
it( 'should include ck-toolbar_floating class if there are shouldGroupWhenFull and isFloating options set to true', () => { | |||
const viewWithOptions = new ToolbarView( locale, { | |||
shouldGroupWhenFull: true, |
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 if shouldGroupWhenFull
is false
? Would this work?
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've added more tests about it
Co-authored-by: Aleksander Nowodzinski <[email protected]>
Co-authored-by: Aleksander Nowodzinski <[email protected]>
Co-authored-by: Aleksander Nowodzinski <[email protected]>
Co-authored-by: Aleksander Nowodzinski <[email protected]>
Co-authored-by: Aleksander Nowodzinski <[email protected]>
Co-authored-by: Aleksander Nowodzinski <[email protected]>
…or5 into i/6146-multiline-toolbar
…or5 into i/6146-multiline-toolbar
Suggested merge commit message (convention)
Feature (ui, toolbar): Multiline toolbar. Closes #6146.
Additional information
For example – encountered issues, assumptions you had to make, other affected tickets, etc.