diff options
author | echo <91651232+exhq@users.noreply.github.com> | 2022-09-04 20:07:11 +0430 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-04 20:07:11 +0430 |
commit | 0b72acee1574d2a337e0e48d4f2c655d7b77aaf0 (patch) | |
tree | 992d856c12421168e60ec42760a768f2954c1f67 /src/jsMain/kotlin/moe/nea89 | |
parent | 484bc7c89948d4c52a1f04fa97a06016fa0b5b4a (diff) | |
download | neamoe-0b72acee1574d2a337e0e48d4f2c655d7b77aaf0.tar.gz neamoe-0b72acee1574d2a337e0e48d4f2c655d7b77aaf0.tar.bz2 neamoe-0b72acee1574d2a337e0e48d4f2c655d7b77aaf0.zip |
added paste support
Diffstat (limited to 'src/jsMain/kotlin/moe/nea89')
-rw-r--r-- | src/jsMain/kotlin/moe/nea89/website/KConsole.kt | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/jsMain/kotlin/moe/nea89/website/KConsole.kt b/src/jsMain/kotlin/moe/nea89/website/KConsole.kt index 3c5fad1..7cf7d6c 100644 --- a/src/jsMain/kotlin/moe/nea89/website/KConsole.kt +++ b/src/jsMain/kotlin/moe/nea89/website/KConsole.kt @@ -1,5 +1,6 @@ package moe.nea89.website +import kotlinx.browser.window import kotlinx.browser.document import kotlinx.dom.addClass import kotlinx.html.InputType @@ -178,7 +179,10 @@ class KConsole( } fun keydown(event: KeyboardEvent) { - if (event.altKey || event.ctrlKey || event.metaKey) return + if (event.altKey || event.metaKey) return + if (event.ctrlKey) { + handleControlDown(event); return + } if (event.isComposing) return if (state != ConsoleState.SHELLPROMPT) return if (justHandledInput) { @@ -209,3 +213,15 @@ class KConsole( scrollDown() } } +fun handleControlDown(event: KeyboardEvent){ + if (event.key == "v"){ + window.navigator.clipboard.readText().then{ + input += it + event.preventDefault() + rerender() + scrollDown() + } + + } + } +} |