fix(playground): Kirim menambah baris ke stdinQueue, bukan hanya history

This commit is contained in:
a2nr 2026-08-01 22:36:52 +00:00
parent a14eb70038
commit a92411fa45
1 changed files with 5 additions and 2 deletions

View File

@ -19,6 +19,9 @@
function sendInput() { function sendInput() {
const text = get(playgroundStore).consoleInput.trim(); const text = get(playgroundStore).consoleInput.trim();
if (!text) return; if (!text) return;
// Tambah ke antrean stdin (bukan hanya history)
playgroundStore.enqueueStdin(text);
// Tetap tampilkan di console history sebagai baris input
const line: ConsoleLine = { type: 'input', text, timestamp: Date.now() }; const line: ConsoleLine = { type: 'input', text, timestamp: Date.now() };
playgroundStore.appendConsole(line); playgroundStore.appendConsole(line);
playgroundStore.setConsoleInput(''); playgroundStore.setConsoleInput('');
@ -89,8 +92,8 @@
value={$playgroundStore.consoleInput} value={$playgroundStore.consoleInput}
oninput={(e) => playgroundStore.setConsoleInput(e.currentTarget.value)} oninput={(e) => playgroundStore.setConsoleInput(e.currentTarget.value)}
onkeydown={handleKeydown} onkeydown={handleKeydown}
placeholder="Input program (stdin) — dikirim saat Run…" placeholder="Ketik input, enter/Kirim untuk antre, lalu Run…"
/> />
<button class="console-send" onclick={sendInput}>Kirim</button> <button class="console-send" onclick={sendInput}>Kirim</button>
</div> </div>
{/if} {/if}