Would love to see a possibility as CKEditor4 to have "/" as a toolbar item which breaks it to a new line when using the option "shouldNotGroupWhenFull"
If you'd like to see this feature implemented add 👍 reaction to this post.
Thanks for the feature request. I guess we're doing everything to avoid having multiline toolbars (e.g. by introducing toolbar grouping), but let's see how many people would still prefer this way of handling big number of buttons.
It's possible to create line breaks by:
<span class="break-line">.flex-basis:100%; height:0; margin:0; padding:0..ck-toolbar__items with flex-wrap: wrap.I've been looking at demos of "document presets" such as https://ckeditor.com/docs/ckeditor5/latest/features/export-pdf.html and the buttons don't fit there even despite the wide column.
I think we need to prioritize wrapping the toolbar finally.
Also, we changed the styling of the vertical separator which makes that simpler now.
The tricky bit here is how to implement the separator as the child of the toolbar collection in a way that the focus cycler will ignore it.
We also need to disable toolbar wrapping for such toolbars. It does not make sense to try to make both features compatible with each other.
/ in the toolbar, we disable grouping automatically.shouldNotGroupWhenFull: true must be specified in the toolbar configuration.'/' for toolbar break in the toolbar configuration.'|' for separators.'-' instead because it is clearly horizontal.module:core/editor/editorconfig~EditorConfig#toolbar needs to be updated.'/' looks like this:toolbar: {
items: {
'bold',
'italic',
'underline',
'strikethrough',
'/',
'alignment',
'|',
'numberedList',
'bulletedList',
}
}
'/' is the right direction (future-proof). For instance, we're going to implement proper button groups sooner or later. Would the following make sense?toolbar: {
items: {
{ name: 'basic styles', items: [ 'bold', 'italic', 'underline', 'strikethrough' ] },
'/',
{ name: 'other group', items: [ 'alignment', '|', 'numberedList', 'bulletedList' ] }
}
}

Even if we went back to the full-height separators and added some border to the line separator, this does not look great


ToolbarView to be smarter and disable automatic item grouping whenever the line break appears in the configuration.ToolbarView#fillFromConfig() can be called at any time (but after constructor() and render()) and only then the toolbar would know if it can enable auto-grouping or not depending on the presence of line breaks in the config.#items collection. Developers can use ToolbarView#fillFromConfig() but they may also fill the toolbar with items manually by adding to the #items collection. It could be that the third button added to the toolbar is a line break and the auto-grouping feature must be from now on disabled.InlineEditor (but the same applies to the ballon editor etc.) and it turns out all floating toolbars use the .ck-toolbar_floating class that disables flex-wrap. Without flex-wrap multi-line toolbars won't break at a specific point.flex-wrap is necessary for auto-grouping (enabled by default) to work, though. So here we've got a problem..ck-toolbar_floating class whenever a line break appears in ToolbarView#items but the class is added externally by editor UI implementations (like InlineEditorUIView) via extendTemplate() and ToolbarView does not know about it.isFloating to the ToolbarView constructor and allowing the toolbar to decide whether the CSS class is added.ck-toolbar_floating would be set only when constructorOptions.shouldGroupWhenFull === true and constructorOptions.isFloating === trueI went with
'/'for toolbar break in the toolbar configuration.
That's what CKE4 uses, so it may be a simpler upgrade path.
- (Idea) We could go with
'-'instead because it is clearly horizontal.
Makes sense too.
- (Feedback needed) Let's make sure
'/'is the right direction (future-proof). For instance, we're going to implement proper button groups sooner or later. Would the following make sense?
It worked for CKE4 (that had groups too), so it seems fine.
- I tried adding more features to the toolbar and IMO it looks better
Yeah, I think I agree that there needs to be a balance between a too empty toolbar and too wide. In the end, this will be the integrator's choice anyway as they will choose the included features, but we should have some reasonable defaults.
I don't have problems with extending the document build. The demo that we have on https://ckeditor.com/ckeditor-5/demo/#document has more features anyway. I'd run this by @wwalc as he'll have the most input.
(Problem) I wanted Â
ToolbarViewto be smarter and disable automatic item grouping whenever the line break appears in the configuration.
What if fillFromConfig() checked the current state of the toolbar once it is about to add the '-' item and log a warning? That's not going to catch all situations and it will not resolve them automatically, but will give the developer a cue in the most probable scenario.
- The only solution I see now is passing a property like
isFloatingto theToolbarViewconstructor and allowing the toolbar to decide whether the CSS class is added
Sounds reasonable.
ToolbarView#fillFromConfig() when the toolbar has item grouping enabled to let developers know why declarative breaks don't work.isFloating constructor option in the ToolbarView.extendTemplate() that add .ck-toolbar_floating to the constructor option API.ToolbarView smart enough to add the CSS class in the template only when constructorOptions.shouldGroupWhenFull === true and constructorOptions.isFloating === true to avoid situations when the declarative toolbar breaks don't work because of this CSS class.ckeditor5-uickeditor5-build-decoupled-document~ (removed during Nov 18th F2F talk)module:core/editor/editorconfig~EditorConfig#toolbar (how to create multi-line toolbars?)module:ui/toolbar/toolbarview~ToolbarOptions (what does isFloating do? how does it work together with shouldGroupWhenFull?)shouldGroupWhenFull to false automatically in the generated build's config.ckeditor5-build-decoupled-document; we're not going to update the default toolbar config/featureset until we collect some on-line builder stats.Pinged @wwalc for feedback. Let's gather it before we'll move forward to avoid surprises.
Food for thought: here's the document editor build in action on a 1280x800 laptop screenÂ


Another TODO: we need to support line breaks in https://ckeditor.com/ckeditor-5/online-builder/. It's not a blocker for the release, but should be resolved in a near future.
/ vs - I'd roll a dice, because / will be less confusing for users upgrading from CKEditor 4, while - seems to be more intuitive.BTW, @oleq what about #5586? Can we add it to the TODOs?
In paste from word/google and export to pdf we have only one/two extra buttons, so the multiline toolbar will look not so good. I propose just to remove those buttons to make it fit. I could also go the other way and add more buttons, but I am not sure if we have to show multiline in those demos. One line always looks better IMO.
VS
OR
About the separator: both are good, but my vote is slightly towards -. / looks too similar to |. When creating the config it is easier to see the difference when there is -.
TODO:
Follow up about "Toolbar configuration" guide: https://github.com/ckeditor/ckeditor5/issues/8513
EDIT: I've closed follow up, as I've included docs in this branch.
Can we address https://github.com/ckeditor/ckeditor5/issues/6146#issuecomment-732006953? This is the main reason why we're working on the multi-line toolbar.Â
Personally, I'm for a multiple-line declarative toolbar with as many features as possible to mimic the document build.Â
cc @Reinmar
when has this issue gone be solved? waiting for the next update of ckEditor5.
Follow-up for the docs: #8493
Follow-up for supporting line breaks in online builder: #8567
Follow-up for updating the document editor demo: cksource/bigbang-ckeditor.com#2217
Most helpful comment
TODOs
ToolbarView#fillFromConfig()when the toolbar has item grouping enabled to let developers know why declarative breaks don't work.isFloatingconstructor option in theToolbarView.extendTemplate()that add.ck-toolbar_floatingto the constructor option API.ToolbarViewsmart enough to add the CSS class in the template only whenconstructorOptions.shouldGroupWhenFull === trueandconstructorOptions.isFloating === trueto avoid situations when the declarative toolbar breaks don't work because of this CSS class.ckeditor5-uickeditor5-build-decoupled-document~ (removed during Nov 18th F2F talk)module:core/editor/editorconfig~EditorConfig#toolbar(how to create multi-line toolbars?)module:ui/toolbar/toolbarview~ToolbarOptions(what doesisFloatingdo? how does it work together withshouldGroupWhenFull?)shouldGroupWhenFulltofalseautomatically in the generated build's config.ckeditor5-build-decoupled-document; we're not going to update the default toolbar config/featureset until we collect some on-line builder stats.