-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Custom Menubar Implementation #51422
Conversation
This is just so I can take a screenshot, so the buttons do not work at the moment.
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.
Some more code review feedback
@@ -87,6 +87,10 @@ | |||
color: inherit; | |||
} | |||
|
|||
.monaco-menu .monaco-action-bar.vertical .action-label.checked:after { |
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.
@sbatten is this used currently anywhere?
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.
@bpasero this adds the checkmark to items that have been checked in the menu, like auto save
src/vs/code/electron-main/app.ts
Outdated
@@ -487,9 +493,6 @@ export class CodeApplication { | |||
} | |||
} | |||
|
|||
// Install Menu | |||
appInstantiationService.createInstance(CodeMenu); |
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.
@sbatten is the functionality from vs/code/electron-main/menus.ts
moved over to menubar.ts
? then I think it would be safe to remove menu.ts
?
However I see that some things are not working yet, like the Accessibility help window, so maybe that is still work in progress?
@@ -1580,7 +1580,6 @@ export class EditorLayoutCenteredAction extends Action { | |||
} | |||
|
|||
public run(): TPromise<any> { | |||
|
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.
@sbatten unrelated change?
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.
@bpasero reverted
@@ -24,8 +24,128 @@ | |||
flex: 0 1 auto; | |||
overflow: hidden; | |||
white-space: nowrap; | |||
line-height: 22px; |
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.
@sbatten why? this impacts even macOS that does not use a custom menu
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.
@bpasero the value is inherited from the parent and the parent is being updated to handle zoom
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.
@sbatten I did another code review and pushed some polish to the branch. I think there is one thing to revisit before merging: the changes in ActionBar
have some issues:
- we are no longer using
builder.text
butbuilder.innerHTML
for the label. this increases the risk of someone injecting a HTML script into our DOM because we set it blindly as HTML. we need to continue to not trustIAction.label
as before imho Actionbar#push()
seems to do the mnemonic handling now. first of all, we should probably only do that if the action that is pushed hasisMenu: true
in the options. Second, there seems to be a map of mnemonics toIAction
but the lifecycle is not clear to me. Actions can come and go in the action bar but this map seems to just grow and never cleanup when an action is removed?
@bpasero Hi, there is already a documentation for this api? |
Adding custom menubar on windows with themable menus including context menus.