MCPcopy Index your code
hub / github.com/massCodeIO/massCode / createEditorMenuItems

Function createEditorMenuItems

src/main/menu/main.ts:528–611  ·  view source on GitHub ↗
(context: MainMenuContext)

Source from the content-addressed store, hash-verified

526}
527
528function createEditorMenuItems(context: MainMenuContext): MenuConfig[] {
529 const items: MenuConfig[] = []
530
531 if (context.editor.kind === 'code') {
532 items.push({
533 label: i18n.t('menu:editor.copySnippet'),
534 click: () => send('main-menu:copy-snippet'),
535 accelerator: 'CommandOrControl+Shift+C',
536 })
537 items.push({
538 label: i18n.t('menu:editor.format'),
539 accelerator: 'Shift+CommandOrControl+F',
540 click: () => send('main-menu:format'),
541 })
542 items.push({
543 label: i18n.t('menu:editor.previewCode'),
544 type: 'checkbox',
545 enabled: context.editor.canPreviewCode,
546 checked: context.editor.isCodePreviewShown,
547 click: () => send('main-menu:preview-code'),
548 accelerator: 'Alt+CommandOrControl+P',
549 })
550 items.push({
551 label: i18n.t('menu:editor.previewJson'),
552 type: 'checkbox',
553 enabled: context.editor.canPreviewJson,
554 checked: context.editor.isJsonPreviewShown,
555 click: () => send('main-menu:preview-json'),
556 accelerator: 'Alt+CommandOrControl+J',
557 })
558 }
559
560 if (context.editor.kind === 'notes') {
561 items.push({
562 label: i18n.t('menu:editor.copyNote'),
563 click: () => send('main-menu:copy-note'),
564 accelerator: 'CommandOrControl+Shift+C',
565 })
566 }
567
568 if (context.editor.kind === 'http') {
569 items.push({
570 label: i18n.t('menu:editor.sendRequest'),
571 enabled: context.editor.canSendRequest,
572 click: () => send('main-menu:send-http-request'),
573 accelerator: 'CommandOrControl+Enter',
574 })
575 }
576
577 const notesModeItems = createNotesEditorModeItems(context)
578 if (notesModeItems.length) {
579 if (items.length) {
580 items.push({ type: 'separator' })
581 }
582
583 items.push(...notesModeItems)
584 }
585

Callers 1

createMainMenuTemplateFunction · 0.85

Calls 2

sendFunction · 0.90

Tested by

no test coverage detected