Skip to content

Commit 57597f1

Browse files
committed
feat(settings): add intitial service and model
1 parent ce1bff9 commit 57597f1

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
}

src/model/settings.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
import { injectable } from 'tsyringe';
2+
13
export interface ISettings {}
4+
@injectable()
5+
export class SettingModel implements ISettings {}

0 commit comments

Comments
 (0)