Import-Befehl: autoRun statt onConfirm — Datei-Dialog oeffnet synchron in der Geste

This commit is contained in:
2026-07-05 14:48:37 +02:00
parent 4ef73c9198
commit c5b5ca600c
+10
View File
@@ -26,6 +26,16 @@ export const importCommand: Command = {
options: () => [], options: () => [],
init: () => ({ ...IDLE }), init: () => ({ ...IDLE }),
// Sofort-Befehl (wie Join/Split): `startCommand` ruft `autoRun` SYNCHRON im
// selben Aufruf-Stack wie die Enter-/Klick-Geste auf. Genau das braucht der
// Datei-Dialog — ein `<input type=file>.click()` öffnet den OS-Dialog nur
// innerhalb einer echten Nutzer-Geste; ein State-Update/async-Hop dazwischen
// (wie beim reinen onConfirm/onInput-Weg) lässt ihn verzögern oder ausbleiben.
autoRun: (): CommandResult => {
openDxfImport();
return { draft: null, done: true };
},
// Der Befehl hat keine Schritte: Start/Enter/Input öffnet den Dialog + endet. // Der Befehl hat keine Schritte: Start/Enter/Input öffnet den Dialog + endet.
onInput: () => open(), onInput: () => open(),
onMove: (state): [CommandState, CommandResult] => [state, { draft: null }], onMove: (state): [CommandState, CommandResult] => [state, { draft: null }],