U 批量执行/构建/发布输出内支持Ctrl+c复制

pull/494/head
vapao 2022-05-14 01:13:49 +08:00
parent f11f7984ce
commit 294e7e2bc9
3 changed files with 21 additions and 0 deletions

View File

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

View File

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

View File

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