feat: 状态栏新增快速切换终端按钮

This commit is contained in:
purocean
2021-10-21 13:52:35 +08:00
parent e83146fffe
commit b6dc7b4fb8
3 changed files with 19 additions and 0 deletions
+1
View File
@@ -23,6 +23,7 @@ export default defineComponent({
presentation: '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="presentation" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="svg-inline--fa fa-presentation fa-w-18 fa-9x"><path fill="currentColor" d="M560 0H16C7.16 0 0 7.16 0 16v32c0 8.84 7.16 16 16 16h16v256c0 17.67 14.33 32 32 32h192v34.75l-75.31 75.31c-6.25 6.25-6.25 16.38 0 22.63l22.62 22.62c6.25 6.25 16.38 6.25 22.63 0L288 445.25l62.06 62.06c6.25 6.25 16.38 6.25 22.63 0l22.62-22.62c6.25-6.25 6.25-16.38 0-22.63L320 386.75V352h192c17.67 0 32-14.33 32-32V64h16c8.84 0 16-7.16 16-16V16c0-8.84-7.16-16-16-16zm-80 288H96V64h384v224z" class=""></path></svg>',
clipboard: '<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="clipboard" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" class="svg-inline--fa fa-clipboard fa-w-12"><path fill="currentColor" d="M336 64h-80c0-35.3-28.7-64-64-64s-64 28.7-64 64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM192 40c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm144 418c0 3.3-2.7 6-6 6H54c-3.3 0-6-2.7-6-6V118c0-3.3 2.7-6 6-6h42v36c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12v-36h42c3.3 0 6 2.7 6 6z" class=""></path></svg>',
'chevron-down': '<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="chevron-down" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="svg-inline--fa fa-chevron-down fa-w-14"><path fill="currentColor" d="M441.9 167.3l-19.8-19.8c-4.7-4.7-12.3-4.7-17 0L224 328.2 42.9 147.5c-4.7-4.7-12.3-4.7-17 0L6.1 167.3c-4.7 4.7-4.7 12.3 0 17l209.4 209.4c4.7 4.7 12.3 4.7 17 0l209.4-209.4c4.7-4.7 4.7-12.3 0-17z" class=""></path></svg>',
terminal: '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="terminal" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" class="svg-inline--fa fa-terminal fa-w-20"><path fill="currentColor" d="M257.981 272.971L63.638 467.314c-9.373 9.373-24.569 9.373-33.941 0L7.029 444.647c-9.357-9.357-9.375-24.522-.04-33.901L161.011 256 6.99 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L257.981 239.03c9.373 9.372 9.373 24.568 0 33.941zM640 456v-32c0-13.255-10.745-24-24-24H312c-13.255 0-24 10.745-24 24v32c0 13.255 10.745 24 24 24h304c13.255 0 24-10.745 24-24z" class=""></path></svg>',
}
const html = ref(icons[props.name!])
+2
View File
@@ -7,6 +7,7 @@ import statusBarTool from '@fe/plugins/status-bar-tool'
import statusBarHelp from '@fe/plugins/status-bar-help'
import statusBarRefresh from '@fe/plugins/status-bar-refresh'
import statusBarPresentation from '@fe/plugins/status-bar-presentation'
import statusBarTerminal from '@fe/plugins/status-bar-terminal'
import statusBarGet from '@fe/plugins/status-bar-get'
import editorPaste from '@fe/plugins/editor-paste'
import editorAttachment from '@fe/plugins/editor-attachment'
@@ -47,6 +48,7 @@ export default [
statusBarTool,
statusBarHelp,
statusBarRefresh,
statusBarTerminal,
statusBarPresentation,
statusBarGet,
transformImgOutLink,
@@ -0,0 +1,16 @@
import type { Plugin } from '@fe/context/plugin'
export default {
name: 'status-bar-terminal',
register: ctx => {
ctx.statusBar.tapMenus(menus => {
menus['status-bar-terminal'] = {
id: 'status-bar-terminal',
position: 'right',
tips: `切换终端 (${ctx.shortcut.getKeysLabel('layout.toggle-xterm')})`,
icon: 'terminal',
onClick: () => ctx.action.getActionHandler('layout.toggle-xterm')()
}
})
}
} as Plugin