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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(editor): make the build log + dialog output copyable (selectable + Copy)
esengine167f0e6acd7d
diff --git a/desktop/src/components/BuildDialog.tsx b/desktop/src/components/BuildDialog.tsxindex ac7098a52..9a82aeea3 100644--- a/desktop/src/components/BuildDialog.tsx+++ b/desktop/src/components/BuildDialog.tsx@@ -11,7 +11,7 @@* / Playable) are live.*/import { useState, useSyncExternalStore } from 'react';-import { Loader2, FolderOpen, CheckCircle2, AlertCircle, Boxes, Info } from 'lucide-react';+import { Loader2, FolderOpen, CheckCircle2, AlertCircle, Boxes, Info, Copy } from 'lucide-react';import { Modal } from '@/components/Modal';import { ProjectStore } from '@/project/ProjectStore';import { useEditorStore } from '@/store/editorStore';@@ -145,6 +145,13 @@ export function BuildDialog() {}};+ const copyLog = () => {+ const lines = [...log];+ if (result?.errors?.length) lines.push(...result.errors.map((e) => `ERROR: ${e}`));+ if (result?.warnings?.length) lines.push(...result.warnings.map((w) => `warning: ${w}`));+ void navigator.clipboard?.writeText(lines.join('\n'));+ };+const footer = (<><button type="button" className="btn-soft" onClick={close} disabled={running}>@@ -225,7 +232,7 @@ export function BuildDialog() {{def.prereq && (<div className="build__prereq">- <Info size={13} /> <span>{def.prereq}</span>+ <Info size={13} /> <span className="selectable">{def.prereq}</span></div>)}@@ -241,25 +248,30 @@ export function BuildDialog() {</span>)}{log.length > 0 && (- <ol className="build__log">- {log.map((line, i) => <li key={i}>{line}</li>)}- </ol>+ <div className="build__logwrap">+ <button type="button" className="build__copy" title="Copy log" onClick={copyLog}>+ <Copy size={11} /> Copy+ </button>+ <ol className="build__log selectable">+ {log.map((line, i) => <li key={i}>{line}</li>)}+ </ol>+ </div>)}{phase === 'done' && result && (<>- <span className="build__status-line">+ <span className="build__status-line selectable"><CheckCircle2 size={14} /> Packaged {result.included} assets{result.bytes ? ` · ${mb(result.bytes)}` : ''} → {result.outDir}</span>- <div className="build__next">{def.next(result.outDir)}</div>+ <div className="build__next selectable">{def.next(result.outDir)}</div></>)}{phase === 'error' && result && (- <span className="build__status-line">+ <span className="build__status-line selectable"><AlertCircle size={14} /> {result.errors[0] ?? 'Package failed'}</span>)}{result && result.warnings.length > 0 && (- <div className="build__warn">{result.warnings.length} warning(s): {result.warnings[0]}</div>+ <div className="build__warn selectable">{result.warnings.length} warning(s): {result.warnings[0]}</div>)}</div>)}diff --git a/desktop/src/theme/global.css b/desktop/src/theme/global.cssindex f60d1285c..d3e3ee0d8 100644--- a/desktop/src/theme/global.css+++ b/desktop/src/theme/global.css@@ -26,6 +26,11 @@ body {cursor: default;}+/* Opt a region back into text selection / copy — the shell is user-select:none,+ so logs, errors, file paths, and shell commands must mark themselves copyable.+ The canonical way to do it (vs ad-hoc per-element user-select rules). */+.selectable, .selectable * { user-select: text; cursor: text; }+#root {display: flex;flex-direction: column;diff --git a/desktop/src/theme/menus.css b/desktop/src/theme/menus.cssindex 3d40aa487..78858e0df 100644--- a/desktop/src/theme/menus.css+++ b/desktop/src/theme/menus.css@@ -144,3 +144,6 @@.build__log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 116px; overflow-y: auto; font-family: var(--mono); font-size: var(--fs-2xs); color: var(--text-mute); }.build__log li::before { content: '\203A '; color: var(--text-dim); }.build__log li:last-child { color: var(--text-dim); }+.build__logwrap { position: relative; }+.build__copy { position: absolute; top: 0; right: 0; display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; font-size: var(--fs-2xs); color: var(--text-mute); background: var(--srf-4); border: 1px solid var(--border-line); border-radius: var(--r-xs); cursor: pointer; transition: color var(--t-fast); }+.build__copy:hover { color: var(--text); }