|
| 1 | +import { activityBarService, IActivityBarItem } from 'mo'; |
| 2 | +import * as monaco from 'monaco-editor'; |
| 3 | +import { editorService } from 'mo'; |
| 4 | +import { IEditorGroup } from 'mo/model'; |
| 5 | + |
| 6 | +function clickColorTheme(e) { |
| 7 | + // const editorState = editorService.getState(); |
| 8 | + console.log('globalSettings: clickColorTheme:', e); |
| 9 | +} |
| 10 | + |
| 11 | +function clickCommandPalette(e) { |
| 12 | + const editorState = editorService.getState(); |
| 13 | + const editorGroup = editorState.current as IEditorGroup<monaco.editor.IStandaloneCodeEditor>; |
| 14 | + if (editorGroup) { |
| 15 | + editorGroup.editorInstance?.trigger( |
| 16 | + 'anyString', |
| 17 | + 'editor.action.quickCommand', |
| 18 | + null |
| 19 | + ); |
| 20 | + } |
| 21 | + console.log('globalSettings: clickCommandPalette:', monaco); |
| 22 | +} |
| 23 | + |
| 24 | +function clickSettings(e) { |
| 25 | + console.log('globalSettings: clickSettings:', e); |
| 26 | +} |
| 27 | + |
| 28 | +export function initGlobalActivityBars() { |
| 29 | + const globalSettings: IActivityBarItem = { |
| 30 | + id: 'global-settings', |
| 31 | + name: 'Settings', |
| 32 | + iconName: 'codicon-settings-gear', |
| 33 | + type: 'global', |
| 34 | + contextMenu: [ |
| 35 | + { |
| 36 | + id: 'CommandPalette', |
| 37 | + name: 'Command Palette...', |
| 38 | + onClick: clickCommandPalette, |
| 39 | + }, |
| 40 | + { |
| 41 | + id: 'Settings', |
| 42 | + name: 'Settings', |
| 43 | + onClick: clickSettings, |
| 44 | + }, |
| 45 | + { |
| 46 | + id: 'ColorTheme', |
| 47 | + name: 'Color Theme', |
| 48 | + onClick: clickColorTheme, |
| 49 | + }, |
| 50 | + ], |
| 51 | + }; |
| 52 | + |
| 53 | + const globalUserAccount: IActivityBarItem = { |
| 54 | + id: 'global-Account', |
| 55 | + name: 'Account', |
| 56 | + iconName: 'codicon-account', |
| 57 | + type: 'global', |
| 58 | + }; |
| 59 | + |
| 60 | + activityBarService.push(globalUserAccount); |
| 61 | + activityBarService.push(globalSettings); |
| 62 | +} |
0 commit comments