Skip to content
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

Merged
merged 29 commits into from
Dec 1, 2020
Merged

I/6146 multiline toolbar #8507

merged 29 commits into from
Dec 1, 2020

Conversation

pkwasnik
Copy link
Contributor

@pkwasnik pkwasnik commented Nov 23, 2020

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.

@pkwasnik pkwasnik changed the title I/6146 multiline toolbar WIP: I/6146 multiline toolbar Nov 23, 2020
@pkwasnik pkwasnik changed the title WIP: I/6146 multiline toolbar [WIP] I/6146 multiline toolbar Nov 23, 2020
@pkwasnik pkwasnik changed the title [WIP] I/6146 multiline toolbar WIP I/6146 multiline toolbar Nov 23, 2020
@pkwasnik
Copy link
Contributor Author

Hello @ckeditor/qa-team 👋, could you take a quick look at this feature?

@pkwasnik pkwasnik force-pushed the i/6146-multiline-toolbar branch from 4a77277 to 6aff552 Compare November 23, 2020 21:20
@pkwasnik pkwasnik changed the title WIP I/6146 multiline toolbar I/6146 multiline toolbar Nov 23, 2020
@Mgsy
Copy link
Member

Mgsy commented Nov 25, 2020

We've tested it and works fine 👍

@oleq oleq self-assigned this Nov 26, 2020
@oleq oleq self-requested a review November 26, 2020 12:55
Copy link
Member

@oleq oleq left a 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() )`
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.
Copy link
Member

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.

Copy link
Contributor Author

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).

docs/builds/guides/integration/configuration.md Outdated Show resolved Hide resolved
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:
Copy link
Member

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 (`|`).

Copy link
Member

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 .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change separator into "divider"?

Copy link
Member

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 '-'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/builds/guides/integration/configuration.md Outdated Show resolved Hide resolved
*
* @error line-separator-used-when-button-grouping-enabled
*/
logWarning( 'line-separator-used-when-button-grouping-enabled' );
Copy link
Member

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.

Copy link
Contributor Author

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`.
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

packages/ckeditor5-ui/tests/toolbar/toolbarview.js Outdated Show resolved Hide resolved
@@ -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,
Copy link
Member

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?

Copy link
Contributor Author

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

packages/ckeditor5-ui/tests/toolbar/toolbarview.js Outdated Show resolved Hide resolved
@pkwasnik pkwasnik requested review from oleq and godai78 November 27, 2020 16:40
@oleq oleq merged commit 70157ae into master Dec 1, 2020
@oleq oleq deleted the i/6146-multiline-toolbar branch December 1, 2020 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiline toolbar (wrapping toolbar)
5 participants