From 8dc9bfbf7a6087e8e00517f2f12679f0fc2220ad Mon Sep 17 00:00:00 2001 From: Reimar Date: Mon, 13 Oct 2025 13:44:27 +0200 Subject: [PATCH] show input in console --- src/console_input.js | 2 ++ src/playground_console.js | 5 ++++- style.css | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/console_input.js b/src/console_input.js index 5ab088e..c1df548 100644 --- a/src/console_input.js +++ b/src/console_input.js @@ -35,6 +35,8 @@ export class ConsoleInput { const code = this.inputElem.value; this.inputElem.value = ""; + this.console.addInput(code); + this.history.push(code); this.historyIndex = this.history.length; diff --git a/src/playground_console.js b/src/playground_console.js index 8a0714e..3d7bbdd 100644 --- a/src/playground_console.js +++ b/src/playground_console.js @@ -41,7 +41,6 @@ export class PlaygroundConsole { const argString = typeof arg === "function" ? `function ${arg.name}()` : `${arg}`; const value = document.createElement("span"); - value.className = entryType; value.textContent = argString; value.dataset.type = this.#getTypeName(arg); parent.appendChild(value); @@ -103,6 +102,10 @@ export class PlaygroundConsole { } } + addInput() { + this.#addEntry("input", "", this.elem, ...arguments); + } + log() { this.#addEntry("log", "", this.elem, ...arguments); } diff --git a/style.css b/style.css index 6cdcb6c..fef7e1f 100644 --- a/style.css +++ b/style.css @@ -150,6 +150,15 @@ div#buttons button { background-color: #413d07; } +#console .input:before { + content: "> "; +} + +#console .input { + color: #bdbdbd; + font-style: italic; +} + #console .info, #console .debug, #console .prototype,