fix: macosx UI cleanup

This commit is contained in:
2026-02-19 22:50:21 +01:00
parent 7e593b587b
commit 0d66939eb7
8 changed files with 333 additions and 176 deletions

View File

@@ -2,6 +2,8 @@ export type AppMenuAction =
| 'newPost'
| 'importMedia'
| 'save'
| 'openInBrowser'
| 'openDataFolder'
| 'quit'
| 'undo'
| 'redo'
@@ -17,7 +19,14 @@ export type AppMenuAction =
| 'toggleSidebar'
| 'togglePanel'
| 'toggleDevTools'
| 'reload'
| 'forceReload'
| 'resetZoom'
| 'zoomIn'
| 'zoomOut'
| 'toggleFullScreen'
| 'publishSelected'
| 'previewPost'
| 'rebuildDatabase'
| 'reindexText'
| 'metadataDiff'
@@ -35,6 +44,8 @@ export interface AppMenuItemDefinition {
accelerator?: string;
separator?: boolean;
role?: AppMenuRole;
id?: string;
enabled?: boolean;
}
export interface AppMenuGroupDefinition {
@@ -42,14 +53,23 @@ export interface AppMenuGroupDefinition {
items: AppMenuItemDefinition[];
}
export const APP_MENU_ITEM_IDS = {
previewPost: 'blog.previewPost',
} as const;
export const APP_MENU_GROUPS: AppMenuGroupDefinition[] = [
{
label: 'File',
items: [
{ label: 'New Post', action: 'newPost', accelerator: 'CmdOrCtrl+N' },
{ label: 'Import Media...', action: 'importMedia', accelerator: 'CmdOrCtrl+I' },
{ label: '', action: 'file-separator-0', separator: true },
{ label: 'Save', action: 'save', accelerator: 'CmdOrCtrl+S' },
{ label: '', action: 'file-separator-1', separator: true },
{ label: 'Open in Browser', action: 'openInBrowser' },
{ label: '', action: 'file-separator-2', separator: true },
{ label: 'Open Data Folder', action: 'openDataFolder' },
{ label: '', action: 'file-separator-3', separator: true },
{ label: 'Quit', action: 'quit', accelerator: 'CmdOrCtrl+Q' },
],
},
@@ -78,14 +98,27 @@ export const APP_MENU_GROUPS: AppMenuGroupDefinition[] = [
{ label: 'Toggle Sidebar', action: 'toggleSidebar', accelerator: 'CmdOrCtrl+B' },
{ label: 'Toggle Panel', action: 'togglePanel', accelerator: 'CmdOrCtrl+J' },
{ label: 'Toggle Developer Tools', action: 'toggleDevTools', accelerator: 'CmdOrCtrl+Shift+I' },
{ label: '', action: 'view-separator-1', separator: true },
{ label: 'Reload', action: 'reload' },
{ label: 'Force Reload', action: 'forceReload' },
{ label: '', action: 'view-separator-2', separator: true },
{ label: 'Actual Size', action: 'resetZoom' },
{ label: 'Zoom In', action: 'zoomIn' },
{ label: 'Zoom Out', action: 'zoomOut' },
{ label: '', action: 'view-separator-3', separator: true },
{ label: 'Toggle Full Screen', action: 'toggleFullScreen' },
],
},
{
label: 'Blog',
items: [
{ label: 'Publish Selected', action: 'publishSelected', accelerator: 'CmdOrCtrl+Shift+P' },
{ label: '', action: 'blog-separator-1', separator: true },
{ label: 'Preview Post', action: 'previewPost', id: APP_MENU_ITEM_IDS.previewPost, enabled: false, accelerator: 'CmdOrCtrl+Shift+V' },
{ label: '', action: 'blog-separator-2', separator: true },
{ label: 'Rebuild Database from Files', action: 'rebuildDatabase' },
{ label: 'Reindex Search Text', action: 'reindexText' },
{ label: '', action: 'blog-separator-3', separator: true },
{ label: 'Metadata Diff Tool', action: 'metadataDiff' },
{ label: 'Generate Sitemap', action: 'generateSitemap' },
],
@@ -113,6 +146,7 @@ export const APP_MENU_ACTION_EVENT_MAP: Partial<Record<AppMenuAction, string>> =
toggleSidebar: 'menu:toggleSidebar',
togglePanel: 'menu:togglePanel',
toggleDevTools: 'menu:toggleDevTools',
previewPost: 'menu:previewPost',
publishSelected: 'menu:publishSelected',
rebuildDatabase: 'menu:rebuildDatabase',
reindexText: 'menu:reindexText',
@@ -131,4 +165,10 @@ export const APP_MENU_WEB_CONTENTS_ACTIONS: ReadonlySet<AppMenuAction> = new Set
'delete',
'selectAll',
'toggleDevTools',
'reload',
'forceReload',
'resetZoom',
'zoomIn',
'zoomOut',
'toggleFullScreen',
]);