auto-scroll console

This commit is contained in:
Reimar 2025-10-13 19:18:05 +02:00
parent 0d683f1538
commit 2b6f9a65d8
No known key found for this signature in database
GPG Key ID: 93549FA07F0AE268
2 changed files with 14 additions and 7 deletions

View File

@ -102,32 +102,38 @@ export class PlaygroundConsole {
}
}
#addTopLevelEntry(entryType, ...args) {
this.#addEntry(entryType, "", this.elem, ...args);
this.elem.scrollTop = this.elem.scrollHeight;
}
addInput() {
this.#addEntry("input", "", this.elem, ...arguments);
this.#addTopLevelEntry("input", ...arguments);
}
log() {
this.#addEntry("log", "", this.elem, ...arguments);
this.#addTopLevelEntry("log", ...arguments);
}
dir() {
this.#addEntry("dir", "", this.elem, ...arguments);
this.#addTopLevelEntry("dir", ...arguments);
}
debug() {
this.#addEntry("debug", "", this.elem, ...arguments);
this.#addTopLevelEntry("debug", ...arguments);
}
info() {
this.#addEntry("info", "", this.elem, ...arguments);
this.#addTopLevelEntry("info", ...arguments);
}
warn() {
this.#addEntry("warn", "", this.elem, ...arguments);
this.#addTopLevelEntry("warn", ...arguments);
}
error() {
this.#addEntry("error", "", this.elem, ...arguments);
this.#addTopLevelEntry("error", ...arguments);
}
clear() {

View File

@ -108,6 +108,7 @@ div#buttons button {
display: flex;
flex-direction: column;
gap: 5px;
scroll-behavior: smooth;
}
#console pre {