修改webide
This commit is contained in:
parent
0cd00eecba
commit
fbd360a949
15
.babelrc
15
.babelrc
|
@ -1,8 +1,13 @@
|
|||
{
|
||||
"presets": [
|
||||
"es2015",
|
||||
"react",
|
||||
"stage-2"
|
||||
// "presets": [
|
||||
// "es2015",
|
||||
// "react",
|
||||
// "stage-0"
|
||||
// ],
|
||||
"presets": [
|
||||
"env",
|
||||
"react",
|
||||
"stage-0"
|
||||
],
|
||||
"plugins": [[
|
||||
"transform-runtime",
|
||||
|
@ -12,5 +17,5 @@
|
|||
"regenerator": true,
|
||||
"moduleName": "babel-runtime"
|
||||
}
|
||||
]]
|
||||
],["transform-decorators-legacy"]]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -201,10 +201,12 @@
|
|||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-plugin-import": "^1.13.0",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.5",
|
||||
"babel-plugin-transform-runtime": "^6.23.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel-preset-stage-0": "^6.24.1",
|
||||
"babel-preset-stage-2": "^6.24.1",
|
||||
"compression-webpack-plugin": "^1.1.12",
|
||||
"concat": "^1.0.3",
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<meta name="theme-color" content="#000000">
|
||||
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
|
||||
<link href="https://gw.alipayobjects.com/os/lib/alipay/alex/2.0.15/bundle/alex.all.global.min.css" rel="stylesheet"/>
|
||||
<link href="https://gw.alipayobjects.com/os/lib/alipay/alex/2.0.16/bundle/alex.all.global.min.css" rel="stylesheet"/>
|
||||
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%css/iconfont.css">
|
||||
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%css/edu-purge.css">
|
||||
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%css/editormd.min.css">
|
||||
|
@ -31,7 +31,7 @@
|
|||
<script src="%PUBLIC_URL%js/editormd/editormd.min.js"></script>
|
||||
<script src="%PUBLIC_URL%js/codemirror/merge/merge.js"></script>
|
||||
<script src="https://gw.alipayobjects.com/os/lib/moment/2.29.4/moment.js"></script>
|
||||
<script src="https://gw.alipayobjects.com/os/lib/alipay/alex/2.0.15/bundle/alex.all.global.min.js"></script>
|
||||
<script src="https://gw.alipayobjects.com/os/lib/alipay/alex/2.0.16/bundle/alex.all.global.js"></script>
|
||||
<%= htmlWebpackPlugin.tags.bodyTags %>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@ module.exports = {
|
|||
"extension": {
|
||||
"publisher": "alex-ext-public",
|
||||
"name": "web-scm",
|
||||
"version": "0.0.9"
|
||||
"version": "0.0.10"
|
||||
},
|
||||
"packageJSON": {
|
||||
"name": "web-scm",
|
||||
"publisher": "alex-ext-public",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.10",
|
||||
"displayName": "web-scm",
|
||||
"description": "SCM for Web",
|
||||
"activationEvents": [
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
import { requireModule } from "alex";
|
||||
import { EditorEmptyComponent } from "./editorEmpty.view";
|
||||
import { EditorWelcomeComponent } from "./welcome.view";
|
||||
const CommonDI = requireModule("@opensumi/di");
|
||||
const CoreBrowser = requireModule("@opensumi/ide-core-browser");
|
||||
const Editor = requireModule("@opensumi/ide-editor");
|
||||
const Theme = requireModule("@opensumi/ide-theme");
|
||||
|
||||
const { Injectable, Autowired } = CommonDI;
|
||||
const { BrowserModule, Domain, ComponentContribution, getLanguageId , CommandContribution} = CoreBrowser;
|
||||
const { BrowserEditorContribution } = Editor;
|
||||
const { IIconService } = Theme;
|
||||
|
||||
const imageUrl =
|
||||
"https://www.gitlink.org.cn/images/avatars/LaboratorySetting/1nav?t=1638344455";
|
||||
|
||||
@Domain(BrowserEditorContribution, ComponentContribution, CommandContribution)
|
||||
export class WelcomeContribution {
|
||||
@Autowired(IIconService)
|
||||
iconService;
|
||||
|
||||
// 覆盖欢迎页
|
||||
registerEditorComponent(registry) {
|
||||
// 覆盖 alex 中的欢迎页
|
||||
registry.registerEditorComponent({
|
||||
uid: "welcome",
|
||||
component: EditorWelcomeComponent,
|
||||
renderMode: 3,
|
||||
});
|
||||
}
|
||||
|
||||
// 覆盖空白页
|
||||
registerComponent(registry) {
|
||||
registry.register("editor-empty", {
|
||||
id: "editor-empty",
|
||||
component: EditorEmptyComponent,
|
||||
});
|
||||
}
|
||||
// 覆盖资源图标
|
||||
registerResource(service) {
|
||||
service.registerResourceProvider({
|
||||
scheme: "welcome",
|
||||
provideResource: async (uri) => {
|
||||
const iconClass = this.iconService.fromIcon("", imageUrl, "background");
|
||||
return {
|
||||
uri,
|
||||
name: "欢迎使用",
|
||||
icon: `${iconClass} icon-background`,
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 注册获取语言命令 移除alex-app-plugin的同名命令
|
||||
registerCommands(commands) {
|
||||
commands.registerCommand(
|
||||
{ id: 'alex.env.language' },
|
||||
{
|
||||
execute: () => getLanguageId(),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class StartupModule extends BrowserModule {
|
||||
providers = [WelcomeContribution];
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
import { requireModule } from "alex";
|
||||
import { ToolBarRightBtn } from "./editorEmpty.view";
|
||||
const CommonDI = requireModule("@opensumi/di");
|
||||
const CoreBrowser = requireModule("@opensumi/ide-core-browser");
|
||||
const Editor = requireModule("@opensumi/ide-editor");
|
||||
const Theme = requireModule("@opensumi/ide-theme");
|
||||
|
||||
const { Injectable } = CommonDI;
|
||||
const { BrowserModule, Domain, MenuContribution , ToolBarActionContribution} = CoreBrowser;
|
||||
|
||||
// 注册 toobar 参考 https://github.com/opensumi/core/blob/main/packages/core-browser/__tests__/toolbar.test.ts
|
||||
@Domain(ToolBarActionContribution, MenuContribution)
|
||||
export class ToolbarContribution {
|
||||
registerToolbarActions(registry) {
|
||||
registry.addLocation('menu-right');
|
||||
registry.setDefaultLocation('menu-right');
|
||||
|
||||
registry.registerToolbarAction({
|
||||
description: '跳转标准版 Ant Codespaces',
|
||||
component: ToolBarRightBtn,
|
||||
id: 'toolbar-right-btn',
|
||||
weight: 1,
|
||||
preferredPosition: {
|
||||
location: 'menu-right',
|
||||
},
|
||||
neverCollapse: true,
|
||||
});
|
||||
}
|
||||
registerMenus(menus) {
|
||||
// 由于目前 toolbar 尚未处理插件自定义组件展示,因此先卸载掉toolbar的右键
|
||||
menus.unregisterMenuId('kt/toolbar/context');
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class ToobarModule extends BrowserModule {
|
||||
providers= [ToolbarContribution];
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
export const EditorEmptyComponent = () => {
|
||||
return <div>test empty page</div>;
|
||||
};
|
||||
|
||||
export const ToolBarRightBtn = () => {
|
||||
const clickFn = () => {
|
||||
console.log(1);
|
||||
};
|
||||
|
||||
return <button onClick={() => clickFn()}>跳转</button>;
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
import './welcome.view.less'
|
||||
export const EditorWelcomeComponent = () => {
|
||||
return (
|
||||
<div >
|
||||
test welcome page
|
||||
</div>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,4 @@
|
|||
.icon-background {
|
||||
width: 50px !important;
|
||||
background-color: #ccc !important;
|
||||
}
|
|
@ -18,12 +18,12 @@ export const activate = ({ commands }) => {
|
|||
);
|
||||
// scm 插件使用 英文 en-us
|
||||
// TODO alex内暴露命令
|
||||
commands.registerCommand(
|
||||
'alex.env.language',
|
||||
() => {
|
||||
return 'zh-cn'
|
||||
}
|
||||
),
|
||||
// commands.registerCommand(
|
||||
// 'alex.env.language',
|
||||
// () => {
|
||||
// return 'zh-cn'
|
||||
// }
|
||||
// ),
|
||||
commands.registerCommand(
|
||||
"code-service.replace-browser-url-hash",
|
||||
(hash) => {
|
||||
|
|
|
@ -27,6 +27,9 @@ import webSCM from './extensions/alex-ext-public.web-scm.js';
|
|||
import * as SCMPlugin from './plugins/web-scm.plugin';
|
||||
import * as AlexApp from './plugins/alex-app.plugin';
|
||||
|
||||
import { StartupModule } from './module/Startup.module'
|
||||
import { ToobarModule } from './module/ToolBar.module';
|
||||
|
||||
import './index.scss';
|
||||
|
||||
const CodeServiceModule = requireModule(
|
||||
|
@ -62,6 +65,9 @@ const layoutConfig = {
|
|||
[SlotLocation.extra]: {
|
||||
modules: ['breadcrumb-menu'],
|
||||
},
|
||||
[SlotLocation.action]: {
|
||||
modules: ['@opensumi/ide-toolbar-action'],
|
||||
},
|
||||
};
|
||||
|
||||
// const platformConfig = {
|
||||
|
@ -99,16 +105,17 @@ const WebIDE = ( props) => {
|
|||
hash: window.location.hash,
|
||||
gitlink: {
|
||||
// webpack 代理转发
|
||||
// 使用代理本地开发时 因为接口返回头像为地址为相对地址 内部做了拼接
|
||||
// gitlens插件的头像在本地开发会无法展示
|
||||
// endpoint: '/code-service',
|
||||
// endpoint:''
|
||||
origin: 'https://testforgeplus.trustie.net',
|
||||
endpoint: 'https://testforgeplus.trustie.net'
|
||||
// endpoint: 'https://testforgeplus.trustie.net'
|
||||
},
|
||||
}),
|
||||
CodeAPIModule,
|
||||
|
||||
|
||||
// StartupModule,
|
||||
StartupModule,
|
||||
ToobarModule,
|
||||
],
|
||||
extensionMetadata: [
|
||||
css,
|
||||
|
|
Loading…
Reference in New Issue