unsable code rework, doesnt run
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<script lang="ts">
|
||||
import type { User } from '$lib/stores/bash/bash';
|
||||
import { Terminal, type PrintData } from '$lib/stores/terminal/terminal';
|
||||
import { onMount } from 'svelte';
|
||||
import Input from './terminal/Input.svelte';
|
||||
import { initTerminal, isInitializing } from '$lib/stores/terminal/init.svelte';
|
||||
import { clear, print } from '$lib/stores/terminal/stdio';
|
||||
import { clear, print } from '$lib/stores/terminal/stdio/io';
|
||||
import type { User } from '$lib/stores/bash/etc/userData';
|
||||
|
||||
const clearTerminal = (): void => clear();
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
return ctx.measureText('M').width;
|
||||
}
|
||||
|
||||
function handleInput(event: KeyboardEvent) {
|
||||
function inputHandler(event: KeyboardEvent) {
|
||||
switch (event.key) {
|
||||
case 'Enter': {
|
||||
terminal.executeCommand(inputValue);
|
||||
@@ -73,7 +73,7 @@
|
||||
if (!e) return;
|
||||
printOutput(e, data);
|
||||
},
|
||||
clear: clear,
|
||||
clear: clearTerminal,
|
||||
getWidth: getWidth,
|
||||
getFontSize: getFontSize
|
||||
};
|
||||
@@ -97,7 +97,7 @@
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
terminal = await initTerminal(testUser, callbackInit);
|
||||
terminal = await initTerminal({ username: 'root', password: '123'}, callbackInit, 'en_US');
|
||||
updateTerminal();
|
||||
} catch (error) {
|
||||
console.error('onMount trycatch failed', error);
|
||||
@@ -105,7 +105,7 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<label for="input" onkeydowncapture={(e) => handleInput(e)} class="w-11/12">
|
||||
<label for="input" onkeydowncapture={(event) => inputHandler(event)} class="w-11/12">
|
||||
<div id="terminal" class="terminal-window shadow-() h-full w-full rounded-md shadow-bg">
|
||||
<div
|
||||
class="terminal-bar flex h-9 w-full flex-row items-center rounded-t-md bg-bg-dark text-center font-terminal text-sm font-bold text-primary-dark light:bg-bg-dark-light light:text-primary-light"
|
||||
|
||||
Reference in New Issue
Block a user