From 82696c8770485474bb3c19c751ac0463db7698f1 Mon Sep 17 00:00:00 2001 From: vapao Date: Sat, 14 May 2022 01:31:58 +0800 Subject: [PATCH] =?UTF-8?q?A=20web=E7=BB=88=E7=AB=AF=E6=94=AF=E6=8C=81Page?= =?UTF-8?q?Up/PageDown=E7=BF=BB=E9=A1=B5=20#485?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_web/src/pages/ssh/Terminal.js | 10 ++++++++++ spug_web/src/pages/ssh/index.js | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/spug_web/src/pages/ssh/Terminal.js b/spug_web/src/pages/ssh/Terminal.js index 64aee49..539e349 100644 --- a/spug_web/src/pages/ssh/Terminal.js +++ b/spug_web/src/pages/ssh/Terminal.js @@ -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:'; diff --git a/spug_web/src/pages/ssh/index.js b/spug_web/src/pages/ssh/index.js index 91f7ac4..cb92aaa 100644 --- a/spug_web/src/pages/ssh/index.js +++ b/spug_web/src/pages/ssh/index.js @@ -213,7 +213,6 @@ function WebSSH(props) { '/____// .___/ \\__,_/ \\__, / |__/|__/ \\___//_.___/ \\__/ \\___//_/ /_/ /_/ /_//_//_/ /_/ \\__,_//_/ \n' + ' /_/ /____/ \n' - console.log(sshMode) return hasPermission('host.console.view|host.console.list') ? (
posX = 0} onMouseMove={handleMouseMove}>