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
Create dropdown menu component #16314
base: master
Are you sure you want to change the base?
Conversation
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.
Actionable comments posted: 1
Out of diff range and nitpick comments (6)
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenurootlistview.ts (6)
50-66
: Add documentation to theofConfig
method to explain its parameters and behavior.
71-95
: Add documentation to the_createMenu
method to clarify its purpose and the parameters it accepts.
98-139
: Add documentation to the_createMenuItems
method to describe its functionality and parameters.
145-181
: Add documentation to the_createMenuItemContentFromFactory
method to explain its behavior and parameters.
187-213
: Add documentation to the_registerMenuTree
method to detail its functionality and parameters.
218-229
: Add documentation to theregisterMenu
method to explain its behavior and parameters.
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenurootlistview.ts
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 3
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenurootlistview.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenurootlistview.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenurootlistview.ts
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 2
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.
Actionable comments posted: 3
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.
Actionable comments posted: 0
Out of diff range and nitpick comments (1)
packages/ckeditor5-ui/src/bindings/clickoutsidehandler.ts (1)
[!TIP]
Codebase VerificationSeveral files in the codebase still do not utilize the new
options
parameter inclickOutsideHandler
. It's important to review whether this parameter should be used in these instances or if its current usage is intentional.
packages/ckeditor5-ui/src/toolbar/block/blocktoolbar.ts
packages/ckeditor5-ui/src/menubar/utils.ts
packages/ckeditor5-ui/src/dropdown/menu/utils.ts
packages/ckeditor5-ui/src/dropdown/utils.ts
packages/ckeditor5-table/src/tableproperties/tablepropertiesui.ts
packages/ckeditor5-table/src/tablecellproperties/tablecellpropertiesui.ts
packages/ckeditor5-mention/src/mentionui.ts
packages/ckeditor5-link/src/linkui.ts
packages/ckeditor5-image/src/imagetextalternative/imagetextalternativeui.ts
packages/ckeditor5-image/src/imageresize/imagecustomresizeui.ts
Analysis chain
Line range hint
29-55
: LGTM! Ensure the newoptions
parameter integrates well with other parts of the system.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify integration of the `options` parameter in `clickOutsideHandler` with other parts of the system. # Test: Search for usages of `clickOutsideHandler` and check if `options` is being passed correctly. rg --type typescript $'clickOutsideHandler'Length of output: 77
Script:
#!/bin/bash # Description: Verify integration of the `options` parameter in `clickOutsideHandler` with other parts of the system. # Test: Search for usages of `clickOutsideHandler` and check if `options` is being passed correctly. rg --type ts 'clickOutsideHandler'Length of output: 2782
Script:
#!/bin/bash # Description: Extract the lines of code where `clickOutsideHandler` is called to check if the `options` parameter is being passed correctly. # Extract the relevant lines from each file where `clickOutsideHandler` is called. rg --type ts --context 2 'clickOutsideHandler\('Length of output: 4937
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.
Actionable comments posted: 4
Out of diff range and nitpick comments (5)
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenufilteredlistview.ts (3)
17-17
: Add a description for the TODO comment to clarify pending tasks or remove if not applicable.
21-23
: Add a description for the TODO comment to clarify pending tasks or remove if not applicable.
31-50
: Ensure proper documentation for the constructor and its parameters for better maintainability.packages/ckeditor5-ui/src/dropdown/menu/dropdownmenurootlistview.ts (2)
25-27
: Add a description for the TODO comment to clarify pending tasks or remove if not applicable.
29-48
: Ensure proper documentation for the constructor and its parameters for better maintainability.
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenufilteredlistview.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenurootlistview.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenurootlistview.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenurootlistview.ts
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 1
Out of diff range and nitpick comments (2)
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenulistfilteredview.ts (1)
17-23
: Complete the TODO comments with appropriate descriptions or remove them if they are no longer needed.packages/ckeditor5-ui/src/dropdown/menu/utils.ts (1)
45-64
: The implementation oftoggleMenusAndFocusItemsOnHover
correctly handles menu toggling on hover. However, consider resolving the TODO comment regarding whether to focus on hover, as this can affect user experience.
packages/ckeditor5-ui/src/dropdown/menu/dropdownmenulistfilteredview.ts
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 1
packages/ckeditor5-ui/src/dropdown/menu/utils/dropdownmenulookup.ts
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 0
Out of diff range and nitpick comments (1)
packages/ckeditor5-ui/src/dropdown/menu/search/createtreefromflattenmenuviews.ts (1)
18-74
: The functioncreateTreeFromFlattenMenuViews
is well-implemented with clear logic for constructing a tree from a flat list of menus. However, it heavily relies on non-null assertions (e.g.,menu.buttonView.label!
andmenu.panelView.children!.first
). It would be beneficial to add a comment clarifying that these values are expected to be non-null as per upstream guarantees.
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.
Actionable comments posted: 3
packages/ckeditor5-ui/src/dropdown/menu/search/tryremovedropdowntreechild.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/tryremovedropdowntreechild.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/tryremovedropdowntreechild.ts
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 1
packages/ckeditor5-ui/src/dropdown/menu/search/groupdropdowntreebyfirstfoundparent.ts
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 2
packages/ckeditor5-ui/src/dropdown/menu/definition/dropdownmenudefinitiontypings.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/definition/dropdownmenudefinitionparser.ts
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 12
packages/ckeditor5-ui/src/dropdown/menu/search/walkoverdropdownmenutreeitems.ts
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/walkoverdropdownmenutreeitems.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/createtreefromflattendropdownmenuslist.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/createtreefromflattendropdownmenuslist.ts
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 11
packages/ckeditor5-ui/src/dropdown/menu/search/createtreefromflattendropdownmenuslist.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/createtreefromflattendropdownmenuslist.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/createtreefromflattendropdownmenuslist.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/createtreefromflattendropdownmenuslist.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/createtreefromflattendropdownmenuslist.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/walkoverdropdownmenutreeitems.ts
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/walkoverdropdownmenutreeitems.ts
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/walkoverdropdownmenutreeitems.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/walkoverdropdownmenutreeitems.ts
Show resolved
Hide resolved
packages/ckeditor5-ui/src/dropdown/menu/search/walkoverdropdownmenutreeitems.ts
Show resolved
Hide resolved
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.
Actionable comments posted: 0
Out of diff range and nitpick comments (1)
packages/ckeditor5-ui/tests/dropdown/menu/search/filterdropdownmenutreebyregexp.js (1)
1-4
: Ensure the license header is up-to-date.Verify that the license header is current and matches the project's standard format.
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.
Actionable comments posted: 1
packages/ckeditor5-ui/tests/dropdown/menu/filterview/dropdownmenulistfoundlistview.js
Outdated
Show resolved
Hide resolved
Thanks for providing an overview of changes introduced by the PR. I am in the middle of the review but I have some questions about what you wrote.
Do we need this for any specific functionality right now? The two features that for sure will use the new dropdowns are Merge fields and AI assistant. Both features have a static list of categories and items. Much of what you wrote and explained is related to adding items dynamically. It wasn't in the scope of this component and maybe it can be simplified. One, because it's easier to review and close a PR when there's less code. Two, because we don't want to provide a public API too hastily. Three, because there's a high chance this code will be unified and/or refactored anyway in a few quarters. And four, because it might be beneficial in another area:
We have a real case for this, as we have reports from some users that they are looking to use as many as hundreds of merge fields. So, I am concerned about performance here. |
Nope. These methods simplify mocking of the data in the tests and basically are tiny in terms of implementation (it's rather an alias for internal method). What do you think about marking them as internal?
:o afaik menu is not designed to hold that amount of data, we have to discuss that |
@scofalik Lazy initialization, menu cache and found items limit added. It means that we can handle ~800 items without drastically reducing startup / navigation performance. There are few downsides:
|
Feature (ui): Create dropdown menu component. Closes #16311.
AI Integration
Commercial PR: https://github.com/cksource/ckeditor5-commercial/pull/6213
Screens
Example usage
Changes performed on menubar implementation
menus
property dynamically instead of storing it as array class member. It is possible to register already createdDropdownMenuView
instance that was created outside of menu. Such instance might have items added or deleted depending on external integration logic (for example, adding button menu entry).Example:
tree
getter that allows to traverse through whole menu that allows for lookup for specific menu entries in tests, filtering menu or creating another instance of dropdown menu with mapped definition.groups
menu attributes has been removed. Now it is possible to passListSeparatorView
manually.ck-body-wrapper
.Drawbacks
It is fixed by adding optional lazy initialization of menus.tree
/menus
getter calls might be expensive for huge menus (> 500 entries). It's not real case and at this moment there are no actions required to be performed in this scope.Scrolling in large sub-menus is missing.