(context: MainMenuContext)
| 428 | } |
| 429 | |
| 430 | function createViewMenuItems(context: MainMenuContext): MenuConfig[] { |
| 431 | const items = createLayoutMenuItems(context) |
| 432 | const sortItems = createSortMenuItems(context) |
| 433 | |
| 434 | if (sortItems.length) { |
| 435 | if (items.length) { |
| 436 | items.push({ type: 'separator' }) |
| 437 | } |
| 438 | |
| 439 | items.push(...sortItems) |
| 440 | } |
| 441 | |
| 442 | if (context.view.canToggleCompactMode) { |
| 443 | if (items.length) { |
| 444 | items.push({ type: 'separator' }) |
| 445 | } |
| 446 | |
| 447 | items.push({ |
| 448 | label: i18n.t('menu:view.compactMode'), |
| 449 | type: 'checkbox', |
| 450 | checked: context.view.isCompactMode, |
| 451 | click: () => send('main-menu:toggle-compact-mode'), |
| 452 | }) |
| 453 | } |
| 454 | |
| 455 | if (context.view.canToggleMindmap || context.view.canTogglePresentation) { |
| 456 | if (items.length) { |
| 457 | items.push({ type: 'separator' }) |
| 458 | } |
| 459 | |
| 460 | items.push({ |
| 461 | label: i18n.t('menu:markdown.previewMindmap'), |
| 462 | type: 'checkbox', |
| 463 | enabled: context.view.canToggleMindmap, |
| 464 | checked: context.view.isMindmapShown, |
| 465 | click: () => send('main-menu:preview-mindmap'), |
| 466 | accelerator: 'CommandOrControl+Shift+I', |
| 467 | }) |
| 468 | items.push({ |
| 469 | label: i18n.t('menu:markdown.presentationMode'), |
| 470 | type: 'checkbox', |
| 471 | enabled: context.view.canTogglePresentation, |
| 472 | checked: context.view.isPresentationShown, |
| 473 | click: () => send('main-menu:presentation-mode'), |
| 474 | accelerator: 'CommandOrControl+Shift+P', |
| 475 | }) |
| 476 | } |
| 477 | |
| 478 | return items |
| 479 | } |
| 480 | |
| 481 | function createHistoryMenuItems(): MenuConfig[] { |
| 482 | return [ |
no test coverage detected