A web终端支持PageUp/PageDown翻页 #485

pull/494/head
vapao 2022-05-14 01:31:58 +08:00
parent 294e7e2bc9
commit 82696c8770
2 changed files with 10 additions and 1 deletions

View File

@ -20,6 +20,16 @@ function WebSSH(props) {
term.loadAddon(fitPlugin);
term.setOption('fontFamily', 'Source Code Pro, Courier New, Courier, Monaco, monospace, PingFang SC, Microsoft YaHei')
term.setOption('theme', {background: '#2b2b2b', foreground: '#A9B7C6'})
term.attachCustomKeyEventHandler((arg) => {
if (arg.code === 'PageUp' && arg.type === 'keydown') {
term.scrollPages(-1)
return false
} else if (arg.code === 'PageDown' && arg.type === 'keydown') {
term.scrollPages(1)
return false
}
return true
})
term.open(container.current);
term.write('WebSocket connecting ... ');
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';

View File

@ -213,7 +213,6 @@ function WebSSH(props) {
'/____// .___/ \\__,_/ \\__, / |__/|__/ \\___//_.___/ \\__/ \\___//_/ /_/ /_/ /_//_//_/ /_/ \\__,_//_/ \n' +
' /_/ /____/ \n'
console.log(sshMode)
return hasPermission('host.console.view|host.console.list') ? (
<div className={styles.container} onMouseUp={() => posX = 0} onMouseMove={handleMouseMove}>
<div className={styles.sider} style={{width}}>