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()