-
-
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
There should be only one widget toolbar #4595
Comments
|
@oleq Screencast will be better: When I click on image both toolbars returns Edit: The behavior is such that one of them "wins" - here table toolbar. The image toolbar is shown on editor blur. |
This is similar to #852 but the reason is different. Anyway, do you think we could display the innermost toolbar only at this moment (the one attached to the element deepest in the tree)? |
@oleq Well I think that it should work this way but currently there is no information back to the widget toolbar logic that indicates to which element the toolbar attaches. It is only Right now I see that the table toolbar could have the logic updated as table feature might expect that toolbar could be shown in certain scenarios. But this will cause other problems - like when image toolbar is disabled and table feature could show a toolbar when image toolbar is not available. PropositionWe could add some additional mechanism to elect the best toolbar to be shown besides returning The first thing I can think of is returning the view element rather then Let's say we have two toolbars (image and table) and selection is on image in table cell. Current behavior:
Proposed:
|
@jodator I came back to this topic and I noticed that you fixed the issue in ckeditor/ckeditor5-table@56adacf (at least for tables and images) but it looks like a hack (checking if some widget is selected inside) and not very generic at all. I'll try to propose something better. |
@oleq yep, I had to do something there as we do not have a generic solution :( |
Fix: Ensured only the widget toolbar attached to the view element which is deepest in the view tree will show up. Code and documentation refactoring in the `WidgetToolbarRepository`. Closes #60. BREAKING CHANGE: The `visibleWhen()` function, a property of an object passed into `WidgetToolbarRepository.register()`, has been renamed to `getRelatedElement()` and must return an editing `View` element the toolbar should be attached to (instead of `Boolean`).
Other: Aligned to the new `WidgetToolbarRepository` API. Replaced the `isMediaWidgetSelected()` utility with `getSelectedMediaViewWidget()`. Renamed `getSelectedMediaElement()` to `getSelectedMediaModelWidget()`. (see ckeditor/ckeditor5-widget#60). BREAKING CHANGE: The `isMediaWidgetSelected()` utility has been replaced by `getSelectedMediaViewWidget()` and returns an editing `View` element instead of `Boolean`. BREAKING CHANGE: The `getSelectedMediaElement()` utility has been renamed to `getSelectedMediaModelWidget()`.
Other: Aligned to the new `WidgetToolbarRepository` API. Replaced the `isTableWidgetSelected()` utility with `getSelectedTableWidget()`. Replaced `isTableContentSelected()` with `getTableWidgetAncestor()` (see ckeditor/ckeditor5-widget#60). BREAKING CHANGE: The `isTableWidgetSelected()` utility has been replaced by `getSelectedTableWidget()` and returns an editing `View` element instead of `Boolean`. BREAKING CHANGE: The `isTableContentSelected()` utility has been replaced by `getTableWidgetAncestor()` and returns an editing `View` element instead of `Boolean`.
Other: Aligned to the new `WidgetToolbarRepository` API. Replaced the `isImageWidgetSelected()` utility with `getSelectedImageWidget()` (see ckeditor/ckeditor5-widget#60). BREAKING CHANGE: The `isImageWidgetSelected()` utility has been replaced by `getSelectedImageWidget()` and returns an editing `View` element instead of `Boolean`.
Right now widget toolbar allows multiple toolbars to be "shown" at once. It goes through all registerd toolbars and shows each one that returns true for
visibleWhen
check. After enabling images in tables we allow widget inception but checks might be simplistic.As an example: table & image
This can be check by table feature easily (I'm adding additional check if other widget is not selected already) but I think that we might think about another approach for such scenarios - ie electing only one toolbar to be shown (first/last registered, priorities?).
The text was updated successfully, but these errors were encountered: