-
Notifications
You must be signed in to change notification settings - Fork 404
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
feat: support icon menubar #2728
Conversation
ChatGPT Code Review: 代码功能:此次提交添加了一个新的 icon menubar 功能。通过在菜单栏上添加图标,可以快速执行一些常用的编辑命令。除了添加新功能之外,还通过使用
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2728 +/- ##
==========================================
- Coverage 57.72% 57.72% -0.01%
==========================================
Files 1327 1327
Lines 83563 83581 +18
Branches 17381 17378 -3
==========================================
+ Hits 48238 48246 +8
- Misses 32104 32114 +10
Partials 3221 3221
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
多一个 IconMenuBar 很奇怪,似乎应该是注册 Menu 的时候,如果该 MenuId 的类型是 icon,那就只展示 Icon? |
packages/startup/entry/sample-modules/menu-bar/menu-bar.view.tsx
Outdated
Show resolved
Hide resolved
要我看的话,不如做一个 MenuBarNg,既支持 icon,又支持 text 又支持 icon text,还支持 button,就像现在的 toolbar 一样。 |
他和现在的 MenuBar 是不一样的,你这样处理就破坏了原来的顶部菜单了(比如会造成有的是文字有的是 icon)。 这里需要单独抽一份 MenuId Context 出来去注册图标菜单,这个菜单项可以是已有的 MenuBar,也可以是用户自己新注册的 command |
packages/startup/entry/sample-modules/menu-bar/menu-bar.view.tsx
Outdated
Show resolved
Hide resolved
packages/startup/entry/sample-modules/menu-bar/menu-bar.view.tsx
Outdated
Show resolved
Hide resolved
文档已补充:opensumi/docs#118 |
Types
Background or solution
🤖 Generated by Copilot at 997db4c
getIcon
andgetExternalIcon
functions to get the icon class name for each command (link, link)IconMenubarContext
menu id (link, link)icon_menubar_container
class name to style the container element for the icon menubar component (link)IconMenuBar
that uses the menu service to create a menu object for the icon menubar context and passes it to theInlineActionBar
component with theisFlattenMenu
prop set totrue
(link, link)IconMenuBar
component and a commented out code that renders it in theMenuBarView
component in the sample module (link, link)useCallback
hook with theuseMemo
hook (link)verticalDivider
class name (link, link)isFlattenMenu
to theInlineActionBarProps
interface and use it to determine how to render the menu items as a single group or two groups (link, link)新增 iconMenubar 组件,集成方需要往 IconMenubarContext 注册菜单项(icon 字段必填),然后导入 IconMenuBar 即可
示例文档稍候补充
Changelog
🤖 Generated by Copilot at 997db4c
This pull request adds a new icon menubar feature to the core-browser and menu-bar packages, which allows displaying and executing common editor commands with icons in the menu bar. It also improves the performance and flexibility of the inline action bar component, which is used to render the menu items. It modifies several files in the core-browser, menu-bar, and startup packages to implement and test the new feature and its styles.