autoscroll
This commit is contained in:
parent
94b64c29b1
commit
6a7f10f8d5
|
|
@ -1,7 +1,7 @@
|
||||||
:root {
|
:root {
|
||||||
--cli-spacing-vertical: 5px;
|
--cli-spacing-vertical: 5px;
|
||||||
--cli-spacing-horizontal: 5px;
|
--cli-spacing-horizontal: 5px;
|
||||||
--cli-margin: 10px 0 0 25px;
|
--cli-margin: 5px 0 0 25px;
|
||||||
--cli-font-size: 20px;
|
--cli-font-size: 20px;
|
||||||
--cli-height: 30px;
|
--cli-height: 30px;
|
||||||
--cli-status-width: 8px;
|
--cli-status-width: 8px;
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#command-prompt {
|
#command-prompt {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#command-textbox {
|
#command-textbox {
|
||||||
|
|
@ -75,11 +75,17 @@
|
||||||
/* The scrollback shows your previous inputs and outputs. */
|
/* The scrollback shows your previous inputs and outputs. */
|
||||||
|
|
||||||
#scrollback {
|
#scrollback {
|
||||||
|
overflow-y: auto;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
max-height: 95vh;
|
||||||
font-size: var(--cli-font-size);
|
font-size: var(--cli-font-size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[data-mode="cinema"] #scrollback {
|
||||||
|
max-height: 505px;
|
||||||
|
}
|
||||||
|
|
||||||
#scrollback li {
|
#scrollback li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import { scrollback } from "./dom.js"
|
import { scrollback } from "./dom.js"
|
||||||
import { resize } from "./resize.js"
|
import { resize } from "./resize.js"
|
||||||
|
import { autoScroll } from "./scrollback.js"
|
||||||
|
|
||||||
export const commands: string[] = []
|
export const commands: string[] = []
|
||||||
|
|
||||||
|
|
@ -13,6 +14,7 @@ export const browserCommands: Record<string, () => any> = {
|
||||||
mode: () => {
|
mode: () => {
|
||||||
document.body.dataset.mode = document.body.dataset.mode === "tall" ? "cinema" : "tall"
|
document.body.dataset.mode = document.body.dataset.mode === "tall" ? "cinema" : "tall"
|
||||||
resize()
|
resize()
|
||||||
|
autoScroll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,11 @@ export function addOutput(id: string, output: string) {
|
||||||
item.dataset.id = id
|
item.dataset.id = id
|
||||||
|
|
||||||
scrollback.append(item)
|
scrollback.append(item)
|
||||||
|
autoScroll()
|
||||||
|
}
|
||||||
|
|
||||||
|
export function autoScroll() {
|
||||||
|
setTimeout(() => {
|
||||||
|
requestAnimationFrame(() => scrollback.scrollTop = scrollback.scrollHeight)
|
||||||
|
}, 10)
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user