From 294e7e2bc967c354d902d7a13b8d5ddc251bec43 Mon Sep 17 00:00:00 2001 From: vapao Date: Sat, 14 May 2022 01:13:49 +0800 Subject: [PATCH] =?UTF-8?q?U=20=E6=89=B9=E9=87=8F=E6=89=A7=E8=A1=8C/?= =?UTF-8?q?=E6=9E=84=E5=BB=BA/=E5=8F=91=E5=B8=83=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E5=86=85=E6=94=AF=E6=8C=81Ctrl+c=E5=A4=8D=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_web/src/pages/deploy/repository/Console.js | 7 +++++++ spug_web/src/pages/deploy/request/OutView.js | 7 +++++++ spug_web/src/pages/exec/task/Output.js | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/spug_web/src/pages/deploy/repository/Console.js b/spug_web/src/pages/deploy/repository/Console.js index 1885801..40bb3cd 100644 --- a/spug_web/src/pages/deploy/repository/Console.js +++ b/spug_web/src/pages/deploy/repository/Console.js @@ -73,6 +73,13 @@ export default observer(function Console() { term.loadAddon(fitPlugin) term.setOption('fontFamily', 'Source Code Pro, Courier New, Courier, Monaco, monospace, PingFang SC, Microsoft YaHei') term.setOption('theme', {background: '#fafafa', foreground: '#000', selection: '#999'}) + term.attachCustomKeyEventHandler((arg) => { + if (arg.ctrlKey && arg.code === 'KeyC' && arg.type === 'keydown') { + document.execCommand('copy') + return false + } + return true + }) term.open(el.current) term.fit = () => fitPlugin.fit() fitPlugin.fit() diff --git a/spug_web/src/pages/deploy/request/OutView.js b/spug_web/src/pages/deploy/request/OutView.js index 277333c..a92a0e9 100644 --- a/spug_web/src/pages/deploy/request/OutView.js +++ b/spug_web/src/pages/deploy/request/OutView.js @@ -17,6 +17,13 @@ function OutView(props) { term.setOption('fontFamily', 'Source Code Pro, Courier New, Courier, Monaco, monospace, PingFang SC, Microsoft YaHei') term.loadAddon(fitPlugin) term.setOption('theme', {background: '#fff', foreground: '#000', selection: '#999'}) + term.attachCustomKeyEventHandler((arg) => { + if (arg.ctrlKey && arg.code === 'KeyC' && arg.type === 'keydown') { + document.execCommand('copy') + return false + } + return true + }) term.open(el.current) fitPlugin.fit() props.setTerm(term) diff --git a/spug_web/src/pages/exec/task/Output.js b/spug_web/src/pages/exec/task/Output.js index e4497f7..5f09d93 100644 --- a/spug_web/src/pages/exec/task/Output.js +++ b/spug_web/src/pages/exec/task/Output.js @@ -33,6 +33,13 @@ function OutView(props) { term.setOption('disableStdin', true) term.setOption('fontFamily', 'Source Code Pro, Courier New, Courier, Monaco, monospace, PingFang SC, Microsoft YaHei') term.setOption('theme', {background: '#2b2b2b', foreground: '#A9B7C6', cursor: '#2b2b2b'}) + term.attachCustomKeyEventHandler((arg) => { + if (arg.ctrlKey && arg.code === 'KeyC' && arg.type === 'keydown') { + document.execCommand('copy') + return false + } + return true + }) term.loadAddon(fitPlugin) term.open(el.current) fitPlugin.fit()