show input in console

This commit is contained in:
Reimar 2025-10-13 13:44:27 +02:00
parent fbc53fe448
commit 8dc9bfbf7a
3 changed files with 15 additions and 1 deletions

View File

@ -35,6 +35,8 @@ export class ConsoleInput {
const code = this.inputElem.value; const code = this.inputElem.value;
this.inputElem.value = ""; this.inputElem.value = "";
this.console.addInput(code);
this.history.push(code); this.history.push(code);
this.historyIndex = this.history.length; this.historyIndex = this.history.length;

View File

@ -41,7 +41,6 @@ export class PlaygroundConsole {
const argString = typeof arg === "function" ? `function ${arg.name}()` : `${arg}`; const argString = typeof arg === "function" ? `function ${arg.name}()` : `${arg}`;
const value = document.createElement("span"); const value = document.createElement("span");
value.className = entryType;
value.textContent = argString; value.textContent = argString;
value.dataset.type = this.#getTypeName(arg); value.dataset.type = this.#getTypeName(arg);
parent.appendChild(value); parent.appendChild(value);
@ -103,6 +102,10 @@ export class PlaygroundConsole {
} }
} }
addInput() {
this.#addEntry("input", "", this.elem, ...arguments);
}
log() { log() {
this.#addEntry("log", "", this.elem, ...arguments); this.#addEntry("log", "", this.elem, ...arguments);
} }

View File

@ -150,6 +150,15 @@ div#buttons button {
background-color: #413d07; background-color: #413d07;
} }
#console .input:before {
content: "> ";
}
#console .input {
color: #bdbdbd;
font-style: italic;
}
#console .info, #console .info,
#console .debug, #console .debug,
#console .prototype, #console .prototype,