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

Function createFileMenuItems

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

Source from the content-addressed store, hash-verified

300}
301
302function createFileMenuItems(context: MainMenuContext): MenuConfig[] {
303 const items: MenuConfig[] = []
304
305 if (context.file.primaryAction) {
306 items.push({
307 label: getPrimaryActionLabel(context.file.primaryAction),
308 accelerator: 'CommandOrControl+N',
309 click: createPrimaryActionClick(context.file.primaryAction),
310 })
311 }
312
313 if (context.file.canCreateFragment) {
314 items.push({
315 label: i18n.t('action.new.fragment'),
316 accelerator: 'CommandOrControl+T',
317 click: () => send('main-menu:new-fragment'),
318 })
319 }
320
321 if (context.file.canCreateTask) {
322 items.push({
323 label: i18n.t('action.new.task'),
324 accelerator: 'CommandOrControl+T',
325 click: () => send('main-menu:new-task'),
326 })
327 }
328
329 if (context.file.secondaryAction) {
330 items.push({
331 label: i18n.t('action.new.folder'),
332 accelerator: 'CommandOrControl+Shift+N',
333 click: () =>
334 send(
335 context.file.primaryAction === 'new-note'
336 ? 'main-menu:new-note-folder'
337 : 'main-menu:new-folder',
338 ),
339 })
340 }
341
342 return items
343}
344
345function getSidebarLayoutAccelerator(
346 targetLayout: MainMenuLayoutMode,

Callers 1

createMainMenuTemplateFunction · 0.85

Calls 3

sendFunction · 0.90
getPrimaryActionLabelFunction · 0.85
createPrimaryActionClickFunction · 0.85

Tested by

no test coverage detected