Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(editor): make Help/dev menu actions real commands; About is themed

yhh4345d6a60908
diff --git a/desktop/src/commands/editorCommands.ts b/desktop/src/commands/editorCommands.ts
index f88d1f4d6..1e7783e83 100644
--- a/desktop/src/commands/editorCommands.ts
+++ b/desktop/src/commands/editorCommands.ts
@@ -29,6 +29,7 @@ import { useEditorMode } from '@/store/editorModeStore';
import { useEditorStore } from '@/store/editorStore';
import { useSelection } from '@/store/selectionStore';
import { Toasts } from '@/store/Toasts';
+import { confirm } from '@/components/confirm';
import { t } from '@/i18n';
import type { ToolMode } from '@/types';
@@ -485,3 +486,51 @@ commands.register({
isEnabled: () => !!ProjectStore.getSnapshot(),
run: () => void ProjectStore.resaveAllPrefabs(),
});
+commands.register({
+ id: 'project.extractSchemas',
+ label: t('menu.extractSchemas'),
+ category: t('cat.file'),
+ isEnabled: () => !!ProjectStore.getSnapshot(),
+ // Extracts user component schemas AND reloads them into the editor.
+ run: () => void ProjectStore.refreshUserSchemas()
+ .then(() => Toasts.push(t('toast.extractedSchemas'), 'success'))
+ .catch(() => Toasts.push(t('toast.extractFailed'), 'error')),
+});
+
+// — Help — (registered so they reach the Command Palette + rebinding, not just the menu)
+commands.register({
+ id: 'help.about',
+ label: t('menu.about'),
+ category: t('cat.help'),
+ // A themed acknowledge dialog, not window.alert (blocking + unthemed).
+ run: () => void window.estella?.getVersion?.()
+ .then((v) => confirm({ title: t('menu.about'), info: true, body: `Estella Editor${v ? ` · ${v}` : ''}\n${t('menu.aboutTagline')}` }))
+ .catch(() => void confirm({ title: t('menu.about'), info: true, body: 'Estella Editor' })),
+});
+commands.register({
+ id: 'help.checkUpdates',
+ label: t('menu.checkUpdates'),
+ category: t('cat.help'),
+ run: () => void window.estella?.app?.checkUpdates?.().then((release) => {
+ if (release) {
+ Toasts.push(t('toast.updateAvailable', { version: release.version }), 'info', 0, {
+ label: t('ui.download'),
+ run: () => window.open(release.url),
+ });
+ } else {
+ Toasts.push(t('toast.upToDate'), 'success');
+ }
+ }),
+});
+commands.register({
+ id: 'help.openLogs',
+ label: t('menu.openLogs'),
+ category: t('cat.help'),
+ run: () => void window.estella?.app?.openLogs?.(),
+});
+commands.register({
+ id: 'help.shortcuts',
+ label: t('menu.keyboardShortcuts'),
+ category: t('cat.help'),
+ run: () => editor().openSettings('shortcuts'),
+});
diff --git a/desktop/src/components/ConfirmDialog.tsx b/desktop/src/components/ConfirmDialog.tsx
index f5509cebb..a519c6cb9 100644
--- a/desktop/src/components/ConfirmDialog.tsx
+++ b/desktop/src/components/ConfirmDialog.tsx
@@ -16,6 +16,7 @@ export function ConfirmDialog({
body,
confirmLabel = t('ui.ok'),
danger,
+ info,
onConfirm,
onCancel,
}: {
@@ -24,6 +25,8 @@ export function ConfirmDialog({
confirmLabel?: string;
/** Destructive action — the confirm button wears the error fill. */
danger?: boolean;
+ /** Acknowledge-only — a single OK button, no Cancel. */
+ info?: boolean;
onConfirm: () => void;
onCancel: () => void;
}) {
@@ -38,7 +41,7 @@ export function ConfirmDialog({
width={420}
footer={
<>
- <Button onClick={onCancel}>{t('ui.cancel')}</Button>
+ {!info && <Button onClick={onCancel}>{t('ui.cancel')}</Button>}
<Button ref={btn} variant={danger ? 'danger' : 'primary'} onClick={onConfirm}>
{confirmLabel}
</Button>
diff --git a/desktop/src/components/ConfirmHost.tsx b/desktop/src/components/ConfirmHost.tsx
index 44a10e5ae..1b232362a 100644
--- a/desktop/src/components/ConfirmHost.tsx
+++ b/desktop/src/components/ConfirmHost.tsx
@@ -21,6 +21,7 @@ export function ConfirmHost() {
body={cur.body}
confirmLabel={cur.confirmLabel ?? t('ui.ok')}
danger={cur.danger}
+ info={cur.info}
onConfirm={() => ConfirmService.settle(cur.id, true)}
onCancel={() => ConfirmService.settle(cur.id, false)}
/>
diff --git a/desktop/src/components/confirm.ts b/desktop/src/components/confirm.ts
index e5dbd671e..ca29433da 100644
--- a/desktop/src/components/confirm.ts
+++ b/desktop/src/components/confirm.ts
@@ -20,6 +20,8 @@ export interface ConfirmOptions {
confirmLabel?: string;
/** Destructive action — the confirm button wears the error fill. */
danger?: boolean;
+ /** Acknowledge-only (About, notices): a single OK button, no Cancel. */
+ info?: boolean;
}
export interface PendingConfirm extends ConfirmOptions {
diff --git a/desktop/src/i18n/messages/commands.ts b/desktop/src/i18n/messages/commands.ts
index a8fd548dc..2170c103e 100644
--- a/desktop/src/i18n/messages/commands.ts
+++ b/desktop/src/i18n/messages/commands.ts
@@ -80,6 +80,7 @@ export const commandMessages = defineMessages({
'cat.play': { en: 'Play', zh: '运行' },
'cat.build': { en: 'Build', zh: '构建' },
'cat.general': { en: 'General', zh: '通用' },
+ 'cat.help': { en: 'Help', zh: '帮助' },
// — Editor modes (viewport toolbar) + their companion panels —
'mode.scene': { en: 'Scene', zh: '场景' },
diff --git a/desktop/src/layout/MenuBar.tsx b/desktop/src/layout/MenuBar.tsx
index a0bad4e49..216b7f30f 100644
--- a/desktop/src/layout/MenuBar.tsx
+++ b/desktop/src/layout/MenuBar.tsx
@@ -10,10 +10,8 @@ import { WindowControls } from '@/layout/WindowControls';
import { DirtyDot } from '@/components/DirtyDot';
import { resetLayout } from '@/layout/DockLayout';
import { confirmDiscard } from '@/project/discardGuard';
-import { useEditorStore } from '@/store/editorStore';
import { ProjectStore } from '@/project/ProjectStore';
import { EditorHistory } from '@/engine/EditorHistory';
-import { Toasts } from '@/store/Toasts';
import { MenuItems, handleMenuListKey, type MenuItem } from '@/components/Menu';
import { commands, formatKeybinding } from '@/commands';
import { t } from '@/i18n';
@@ -148,15 +146,7 @@ export function MenuBar() {
cmdItem('project.export'),
{ sep: true },
cmdItem('build.scripts'),
- {
- label: t('menu.extractSchemas'),
- // refreshUserSchemas extracts AND reloads into the editor (so the
- // inspector updates), unlike a bare extract that only writes the file.
- onClick: () => void ProjectStore.refreshUserSchemas()
- .then(() => Toasts.push(t('toast.extractedSchemas'), 'success'))
- .catch(() => Toasts.push(t('toast.extractFailed'), 'error')),
- disabled: !project,
- },
+ cmdItem('project.extractSchemas'),
],
},
{
@@ -174,36 +164,13 @@ export function MenuBar() {
{
title: t('menu.help'),
items: [
- {
- label: t('menu.about'),
- onClick: () => void window.estella?.getVersion?.()
- .then((v) => window.alert(`Estella Editor${v ? ' · ' + v : ''}\n${t('menu.aboutTagline')}`))
- .catch(() => window.alert('Estella Editor')),
- },
- {
- label: t('menu.checkUpdates'),
- onClick: () => void window.estella?.app?.checkUpdates?.().then((release) => {
- if (release) {
- Toasts.push(t('toast.updateAvailable', { version: release.version }), 'info', 0, {
- label: t('ui.download'),
- run: () => window.open(release.url),
- });
- } else {
- Toasts.push(t('toast.upToDate'), 'success');
- }
- }),
- },
+ cmdItem('help.about'),
+ cmdItem('help.checkUpdates'),
{ sep: true },
cmdItem('palette.open'),
- {
- label: t('menu.keyboardShortcuts'),
- onClick: () => useEditorStore.getState().openSettings('shortcuts'),
- },
+ cmdItem('help.shortcuts'),
{ sep: true },
- {
- label: t('menu.openLogs'),
- onClick: () => void window.estella?.app?.openLogs?.(),
- },
+ cmdItem('help.openLogs'),
],
},
];