| 19 | const checkIsOpenInEditorEnabled = (win) => executeJavaScript(win, 'window.isOpenInEditorEnabled()') |
| 20 | |
| 21 | const changeMenuItems = (menus) => { |
| 22 | const rootMenuItems = Menu.getApplicationMenu().items |
| 23 | Object.entries(menus).forEach(([key, subMenu]) => { |
| 24 | const rootMenuItem = rootMenuItems.find(({ label }) => label === key) |
| 25 | if (!rootMenuItem || !rootMenuItem.submenu) return |
| 26 | |
| 27 | Object.entries(subMenu).forEach(([subKey, menuSet]) => { |
| 28 | const menuItem = rootMenuItem.submenu.items.find( |
| 29 | ({ label }) => label === subKey, |
| 30 | ) |
| 31 | if (!menuItem) return |
| 32 | |
| 33 | Object.assign(menuItem, menuSet) |
| 34 | }) |
| 35 | }) |
| 36 | } |
| 37 | |
| 38 | const invokeDevMethod = (win, name) => executeJavaScript( |
| 39 | win, |