File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ interface ContextMenuOption {
1717 label : string ;
1818 enabled ?: boolean ;
1919 accelerator ?: string ;
20+ optionType ?:
21+ | 'checkbox'
22+ | 'radio'
23+ | 'normal' ;
24+ checked ?: boolean ; // only for checkbox/radio type
2025}
2126
2227interface ContextMenuSubmenu {
@@ -63,12 +68,15 @@ function buildContextMenuItem(item: ContextMenuItem, callback: ContextMenuCallba
6368
6469function buildContextMenuOption ( option : ContextMenuOption , callback : ContextMenuCallback ) {
6570 return new Electron . MenuItem ( {
66- type : 'normal' ,
71+ type : option . optionType || 'normal' ,
6772 id : option . id ,
6873 label : option . label ,
6974 enabled : option . enabled ,
7075 click : callback ,
71- accelerator : option . accelerator
76+ accelerator : option . accelerator ,
77+ checked : ( option . optionType === 'checkbox' || option . optionType === 'radio' )
78+ ? ! ! option . checked
79+ : undefined
7280 } ) ;
7381}
7482
You can’t perform that action at this time.
0 commit comments