diff --git a/src/windows/WelcomeWindow.tsx b/src/windows/WelcomeWindow.tsx
index 170c84c..18bdd67 100644
--- a/src/windows/WelcomeWindow.tsx
+++ b/src/windows/WelcomeWindow.tsx
@@ -6,6 +6,7 @@ import { clearRecentFiles, getRecentFiles, removeRecentFile } from '../utils/rec
interface WelcomeWindowProps {
onOpenFile: (path: string) => Promise | void;
onOpenUserGuide: () => void;
+ onNewFromClipboard: () => Promise | void;
}
interface VersionInfo {
@@ -49,7 +50,11 @@ function formatOpenedAt(ts: number): string {
return date.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' });
}
-export function WelcomeWindow({ onOpenFile, onOpenUserGuide }: WelcomeWindowProps) {
+export function WelcomeWindow({
+ onOpenFile,
+ onOpenUserGuide,
+ onNewFromClipboard,
+}: WelcomeWindowProps) {
const [recents, setRecents] = useState(() => getRecentFiles());
const [version, setVersion] = useState(null);
@@ -113,6 +118,15 @@ export function WelcomeWindow({ onOpenFile, onOpenUserGuide }: WelcomeWindowProp
onOpenUserGuide();
}, [onOpenUserGuide]);
+ const handleNewFromClipboard = useCallback(async () => {
+ try {
+ await onNewFromClipboard();
+ refreshRecents();
+ } catch (error) {
+ console.error('Welcome: failed to create file from clipboard:', error);
+ }
+ }, [onNewFromClipboard, refreshRecents]);
+
// Respond to File > Open (Cmd+O) native menu event when the Welcome window
// is the focused window. Reuses the same dialog-driven code path as the
// in-window Open button.
@@ -160,6 +174,16 @@ export function WelcomeWindow({ onOpenFile, onOpenUserGuide }: WelcomeWindowProp
>
Open File...
+