@opensumi/ide-core-browser 2.24.6-rc-1685671765.0 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/application/application.service.d.ts +1 -0
- package/lib/application/application.service.d.ts.map +1 -1
- package/lib/application/application.service.js +10 -0
- package/lib/application/application.service.js.map +1 -1
- package/lib/bootstrap/app.d.ts.map +1 -1
- package/lib/bootstrap/app.js +10 -0
- package/lib/bootstrap/app.js.map +1 -1
- package/lib/bootstrap/inner-providers-electron.d.ts +3 -0
- package/lib/bootstrap/inner-providers-electron.d.ts.map +1 -0
- package/lib/bootstrap/inner-providers-electron.js +33 -0
- package/lib/bootstrap/inner-providers-electron.js.map +1 -0
- package/lib/bootstrap/inner-providers.d.ts.map +1 -1
- package/lib/bootstrap/inner-providers.js +11 -26
- package/lib/bootstrap/inner-providers.js.map +1 -1
- package/lib/common/common.command.d.ts.map +1 -1
- package/lib/common/common.command.js +1 -0
- package/lib/common/common.command.js.map +1 -1
- package/lib/common/common.contribution.d.ts.map +1 -1
- package/lib/common/common.contribution.js +0 -91
- package/lib/common/common.contribution.js.map +1 -1
- package/lib/common/common.module.d.ts +7 -5
- package/lib/common/common.module.d.ts.map +1 -1
- package/lib/common/common.module.js +5 -0
- package/lib/common/common.module.js.map +1 -1
- package/lib/common/electron.contribution.d.ts +6 -0
- package/lib/common/electron.contribution.d.ts.map +1 -0
- package/lib/common/electron.contribution.js +88 -0
- package/lib/common/electron.contribution.js.map +1 -0
- package/lib/common/web.contribution.d.ts +5 -0
- package/lib/common/web.contribution.d.ts.map +1 -0
- package/lib/common/web.contribution.js +37 -0
- package/lib/common/web.contribution.js.map +1 -0
- package/lib/components/actions/index.d.ts +1 -0
- package/lib/components/actions/index.d.ts.map +1 -1
- package/lib/components/actions/index.js +15 -8
- package/lib/components/actions/index.js.map +1 -1
- package/lib/components/actions/styles.module.less +5 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/menu/next/menu.interface.d.ts +4 -0
- package/lib/menu/next/menu.interface.d.ts.map +1 -1
- package/lib/menu/next/menu.interface.js +12 -1
- package/lib/menu/next/menu.interface.js.map +1 -1
- package/lib/opener/opener-electron.contribution.d.ts +7 -0
- package/lib/opener/opener-electron.contribution.d.ts.map +1 -0
- package/lib/opener/opener-electron.contribution.js +33 -0
- package/lib/opener/opener-electron.contribution.js.map +1 -0
- package/lib/opener/opener.contribution.d.ts.map +1 -1
- package/lib/opener/opener.contribution.js +0 -10
- package/lib/opener/opener.contribution.js.map +1 -1
- package/lib/preferences/early-preferences.d.ts.map +1 -1
- package/lib/preferences/early-preferences.js +6 -1
- package/lib/preferences/early-preferences.js.map +1 -1
- package/lib/static-resource/index.d.ts +8 -0
- package/lib/static-resource/index.d.ts.map +1 -0
- package/lib/static-resource/index.js +30 -0
- package/lib/static-resource/index.js.map +1 -0
- package/lib/static-resource/static.definition.d.ts +60 -0
- package/lib/static-resource/static.definition.d.ts.map +1 -0
- package/lib/static-resource/static.definition.js +24 -0
- package/lib/static-resource/static.definition.js.map +1 -0
- package/lib/static-resource/static.service.d.ts +11 -0
- package/lib/static-resource/static.service.d.ts.map +1 -0
- package/lib/static-resource/static.service.js +40 -0
- package/lib/static-resource/static.service.js.map +1 -0
- package/lib/utils/env.d.ts +2 -2
- package/lib/utils/env.js +2 -2
- package/lib/utils/schema.d.ts +3 -0
- package/lib/utils/schema.d.ts.map +1 -0
- package/lib/utils/schema.js +14 -0
- package/lib/utils/schema.js.map +1 -0
- package/package.json +5 -5
- package/src/application/application.service.ts +10 -0
- package/src/bootstrap/app.ts +12 -0
- package/src/bootstrap/inner-providers-electron.ts +48 -0
- package/src/bootstrap/inner-providers.ts +10 -44
- package/src/common/common.command.ts +1 -0
- package/src/common/common.contribution.ts +0 -91
- package/src/common/common.module.ts +9 -2
- package/src/common/electron.contribution.ts +82 -0
- package/src/common/web.contribution.ts +32 -0
- package/src/components/actions/index.tsx +41 -22
- package/src/components/actions/styles.module.less +5 -0
- package/src/index.ts +2 -0
- package/src/menu/next/menu.interface.ts +12 -0
- package/src/opener/opener-electron.contribution.ts +26 -0
- package/src/opener/opener.contribution.ts +0 -11
- package/src/preferences/early-preferences.ts +8 -3
- package/src/static-resource/index.ts +24 -0
- package/src/static-resource/static.definition.ts +70 -0
- package/src/static-resource/static.service.ts +37 -0
- package/src/utils/env.ts +2 -2
- package/src/utils/schema.ts +11 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"early-preferences.js","sourceRoot":"","sources":["../../src/preferences/early-preferences.ts"],"names":[],"mappings":";;;AAAA,+DAAoG;AAIpG,+DAA2D;AAC3D,yDAAqD;AASrD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAuC,CAAC;AAEjE,SAAgB,kCAAkC,CAAI,IAAY,EAAE,QAAwC;IAC1G,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACvB,OAAO,CAAC,cAAc;KACvB;IACD,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAChC,CAAC;AALD,gFAKC;AAED,SAAgB,6BAA6B,CAAC,IAAY;IACxD,IAAI,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,QAAQ,EAAE;QACb,qBAAqB;QACrB,MAAM,QAAQ,GAAG,wCAAkB,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC9D,IAAI,QAAQ,EAAE;YACZ,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SAC/C;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAVD,sEAUC;AAED,SAAgB,oBAAoB;IAClC,OAAO,qBAAqB,+CAAiC,CAAC,KAAe,CAAC;AAChF,CAAC;AAFD,oDAEC;AAED,SAAgB,wBAAwB;IACtC,OAAO,qBAAqB,6CAAgC,CAAC,KAAe,CAAC;AAC/E,CAAC;AAFD,4DAEC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,kBAAiC;IACvE,4DAA4D;IAC5D,MAAM,0BAA0B,GAAG,kBAAkB,IAAI,kBAAkB,qDAA4B,CAAC;IACxG,
|
|
1
|
+
{"version":3,"file":"early-preferences.js","sourceRoot":"","sources":["../../src/preferences/early-preferences.ts"],"names":[],"mappings":";;;AAAA,+DAAoG;AAIpG,+DAA2D;AAC3D,yDAAqD;AASrD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAuC,CAAC;AAEjE,SAAgB,kCAAkC,CAAI,IAAY,EAAE,QAAwC;IAC1G,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACvB,OAAO,CAAC,cAAc;KACvB;IACD,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAChC,CAAC;AALD,gFAKC;AAED,SAAgB,6BAA6B,CAAC,IAAY;IACxD,IAAI,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,QAAQ,EAAE;QACb,qBAAqB;QACrB,MAAM,QAAQ,GAAG,wCAAkB,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC9D,IAAI,QAAQ,EAAE;YACZ,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SAC/C;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAVD,sEAUC;AAED,SAAgB,oBAAoB;IAClC,OAAO,qBAAqB,+CAAiC,CAAC,KAAe,CAAC;AAChF,CAAC;AAFD,oDAEC;AAED,SAAgB,wBAAwB;IACtC,OAAO,qBAAqB,6CAAgC,CAAC,KAAe,CAAC;AAC/E,CAAC;AAFD,4DAEC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,kBAAiC;IACvE,4DAA4D;IAC5D,MAAM,0BAA0B,GAAG,kBAAkB,IAAI,kBAAkB,qDAA4B,CAAC;IACxG,MAAM,sBAAsB,GAAG,qBAAqB,qDAAoC,CAAC;IAEzF,mBAAmB;IACnB,IAAI,sBAAsB,CAAC,KAAK,IAAI,sBAAsB,CAAC,KAAK,GAAG,kCAAe,CAAC,OAAO,EAAE;QAC1F,OAAO,sBAAsB,CAAC,KAAK,CAAC;KACrC;IAED,OAAO,0BAA0B,IAAI,sBAAsB,CAAC,KAAK,IAAI,IAAA,+BAAa,GAAE,CAAC;AACvF,CAAC;AAXD,0DAWC;AAED,oBAAoB;AACpB,SAAgB,4BAA4B,CAAC,GAAW,EAAE,eAAwB;IAChF,SAAS,cAAc,CAAC,KAAsB;QAC5C,IAAI,KAAK,KAAK,kCAAe,CAAC,SAAS,EAAE;YACvC,OAAO,eAAe,CAAC;SACxB;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,kCAAkC,CAAS,GAAG,EAAE;QAC9C,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YACpB,IAAI,KAAK,IAAI,kCAAe,CAAC,MAAM,EAAE;gBACnC,wCAAwC;gBACxC,OAAO;aACR;YAED,IAAI,CAAC,eAAe,IAAI,KAAK,GAAG,kCAAe,CAAC,OAAO,EAAE;gBACvD,4BAA4B;gBAC5B,OAAO;aACR;YAED,IAAK,MAAc,CAAC,YAAY,EAAE;gBAChC,IAAI,KAAK,KAAK,SAAS,EAAE;oBACvB,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;iBAChE;qBAAM;oBACL,YAAY,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;iBAC5D;aACF;QACH,CAAC;QACD,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;YACb,IAAK,MAAc,CAAC,YAAY,EAAE;gBAChC,OAAO,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC,IAAI,SAAS,CAAC;aAC7E;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAjCD,oEAiCC;AAED,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,MAAuB,EACvB,UAA4B;;IAE5B,MAAM,MAAM,GAAG,UAAU;QACvB,CAAC,CAAC,kCAAe,CAAC,iBAAiB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,UAAU,CAAC;QACpE,CAAC,CAAC,kCAAe,CAAC,iBAAiB,EAAE,CAAC;IACxC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,MAAM,KAAK,GAAG,MAAA,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,0CAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QACxD,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,OAAO;gBACL,KAAK;gBACL,KAAK;aACN,CAAC;SACH;KACF;IACD,OAAO;QACL,KAAK,EAAE,MAAM,IAAI,MAAM,CAAC,OAAO;QAC/B,KAAK,EAAE,kCAAe,CAAC,OAAO;KAC/B,CAAC;AACJ,CAAC;AArBD,sDAqBC;AAED,SAAgB,uBAAuB;IACrC,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;AACzC,CAAC;AAFD,0DAEC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClientAppContribution } from '../common/common.define';
|
|
2
|
+
export * from './static.definition';
|
|
3
|
+
export declare class StaticResourceClientAppContribution implements ClientAppContribution {
|
|
4
|
+
private readonly staticResourceService;
|
|
5
|
+
private readonly contributions;
|
|
6
|
+
initialize(): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/static-resource/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,cAAc,qBAAqB,CAAC;AAEpC,qBACa,mCAAoC,YAAW,qBAAqB;IAE/E,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAwB;IAG9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmD;IAEjF,UAAU;CAKX"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StaticResourceClientAppContribution = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@opensumi/di");
|
|
6
|
+
const contribution_provider_1 = require("@opensumi/ide-core-common/lib/contribution-provider");
|
|
7
|
+
const index_1 = require("@opensumi/ide-core-common/lib/di-helper/index");
|
|
8
|
+
const common_define_1 = require("../common/common.define");
|
|
9
|
+
const static_definition_1 = require("./static.definition");
|
|
10
|
+
tslib_1.__exportStar(require("./static.definition"), exports);
|
|
11
|
+
let StaticResourceClientAppContribution = class StaticResourceClientAppContribution {
|
|
12
|
+
initialize() {
|
|
13
|
+
for (const contribution of this.contributions.getContributions()) {
|
|
14
|
+
contribution.registerStaticResolver(this.staticResourceService);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, di_1.Autowired)(),
|
|
20
|
+
tslib_1.__metadata("design:type", static_definition_1.StaticResourceService)
|
|
21
|
+
], StaticResourceClientAppContribution.prototype, "staticResourceService", void 0);
|
|
22
|
+
tslib_1.__decorate([
|
|
23
|
+
(0, di_1.Autowired)(static_definition_1.StaticResourceContribution),
|
|
24
|
+
tslib_1.__metadata("design:type", Object)
|
|
25
|
+
], StaticResourceClientAppContribution.prototype, "contributions", void 0);
|
|
26
|
+
StaticResourceClientAppContribution = tslib_1.__decorate([
|
|
27
|
+
(0, index_1.Domain)(common_define_1.ClientAppContribution)
|
|
28
|
+
], StaticResourceClientAppContribution);
|
|
29
|
+
exports.StaticResourceClientAppContribution = StaticResourceClientAppContribution;
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/static-resource/index.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AACzC,+FAA2F;AAC3F,yEAAuE;AAEvE,2DAAgE;AAEhE,2DAAwF;AAExF,8DAAoC;AAG7B,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IAO9C,UAAU;QACR,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE,EAAE;YAChE,YAAY,CAAC,sBAAsB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACjE;IACH,CAAC;CACF,CAAA;AAXC;IAAC,IAAA,cAAS,GAAE;sCAC4B,yCAAqB;kFAAC;AAE9D;IAAC,IAAA,cAAS,EAAC,8CAA0B,CAAC;;0EAC2C;AALtE,mCAAmC;IAD/C,IAAA,cAAM,EAAC,qCAAqB,CAAC;GACjB,mCAAmC,CAY/C;AAZY,kFAAmC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IDisposable, URI } from '@opensumi/ide-core-common';
|
|
2
|
+
/**
|
|
3
|
+
* @class StaticResourceService 静态资源转换服务
|
|
4
|
+
* @description
|
|
5
|
+
* 对于一些静态资源的展示,如图片,插件中的资源等等,在IDE中往往会以类似File协议的uri进行描述。
|
|
6
|
+
*
|
|
7
|
+
* 在WebIDE环境,我们无法将它直接挂载在对应的html标签或者css中。
|
|
8
|
+
* 因此在使用之前,需要将这些资源的URI转换为浏览器可以访问的资源。
|
|
9
|
+
*
|
|
10
|
+
* 在Electron中,由于File协议能直接访问,一般来说无需注册资源地址转换。
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class StaticResourceService {
|
|
13
|
+
/**
|
|
14
|
+
* 注册一个静态资源转换方式的提供方
|
|
15
|
+
* @param provider
|
|
16
|
+
*/
|
|
17
|
+
abstract registerStaticResourceProvider(provider: IStaticResourceProvider): IDisposable;
|
|
18
|
+
/**
|
|
19
|
+
* 将URI资源转换为静态资源
|
|
20
|
+
* 通常比如在WebIDE场景, 会将插件的file://路径,转换为某个静态服务的uri进行访问
|
|
21
|
+
* @param uri 待转换的uri
|
|
22
|
+
* @returns 转换后的uri
|
|
23
|
+
*/
|
|
24
|
+
abstract resolveStaticResource(uri: URI): URI;
|
|
25
|
+
/**
|
|
26
|
+
* 被转换后的uri将会拥有哪些host,
|
|
27
|
+
* 用于webview的cspResource字段,
|
|
28
|
+
* webview需要能够知道什么样的资源是可以被访问的。
|
|
29
|
+
*
|
|
30
|
+
* 例: ['http://127.0.0.1:8000']
|
|
31
|
+
*/
|
|
32
|
+
readonly resourceRoots: Set<string>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @interface 提供静态资源转换方式的提供方
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export interface IStaticResourceProvider {
|
|
39
|
+
/**
|
|
40
|
+
* 能够处理的scheme,单个scheme只能有一个StaticResourceProvider, 先来的会被后来的覆盖
|
|
41
|
+
*/
|
|
42
|
+
scheme: string;
|
|
43
|
+
/**
|
|
44
|
+
* 定义如何处理uri的转换
|
|
45
|
+
* @param uri 待转换的uri
|
|
46
|
+
*/
|
|
47
|
+
resolveStaticResource(uri: URI): URI;
|
|
48
|
+
/**
|
|
49
|
+
* resolve后提供的外部资源的host路径, 会传入StaticResourceService的resourceRoots中
|
|
50
|
+
*
|
|
51
|
+
* 例: ['http://0.0.0.0:8000']
|
|
52
|
+
*/
|
|
53
|
+
roots?: string[];
|
|
54
|
+
}
|
|
55
|
+
export declare const StaticResourceContribution: unique symbol;
|
|
56
|
+
export declare const StaticResourceContributionProvider: unique symbol;
|
|
57
|
+
export interface StaticResourceContribution {
|
|
58
|
+
registerStaticResolver(service: StaticResourceService): void;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=static.definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.definition.d.ts","sourceRoot":"","sources":["../../src/static-resource/static.definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAE7D;;;;;;;;;GASG;AACH,8BACsB,qBAAqB;IACzC;;;OAGG;aACa,8BAA8B,CAAC,QAAQ,EAAE,uBAAuB,GAAG,WAAW;IAE9F;;;;;OAKG;aACa,qBAAqB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG;IAEpD;;;;;;OAMG;IACH,SAAgB,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,qBAAqB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC;IAErC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,eAAO,MAAM,0BAA0B,eAAuC,CAAC;AAE/E,eAAO,MAAM,kCAAkC,eAA+C,CAAC;AAE/F,MAAM,WAAW,0BAA0B;IACzC,sBAAsB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAC9D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StaticResourceContributionProvider = exports.StaticResourceContribution = exports.StaticResourceService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@opensumi/di");
|
|
6
|
+
/**
|
|
7
|
+
* @class StaticResourceService 静态资源转换服务
|
|
8
|
+
* @description
|
|
9
|
+
* 对于一些静态资源的展示,如图片,插件中的资源等等,在IDE中往往会以类似File协议的uri进行描述。
|
|
10
|
+
*
|
|
11
|
+
* 在WebIDE环境,我们无法将它直接挂载在对应的html标签或者css中。
|
|
12
|
+
* 因此在使用之前,需要将这些资源的URI转换为浏览器可以访问的资源。
|
|
13
|
+
*
|
|
14
|
+
* 在Electron中,由于File协议能直接访问,一般来说无需注册资源地址转换。
|
|
15
|
+
*/
|
|
16
|
+
let StaticResourceService = class StaticResourceService {
|
|
17
|
+
};
|
|
18
|
+
StaticResourceService = tslib_1.__decorate([
|
|
19
|
+
(0, di_1.Injectable)()
|
|
20
|
+
], StaticResourceService);
|
|
21
|
+
exports.StaticResourceService = StaticResourceService;
|
|
22
|
+
exports.StaticResourceContribution = Symbol('StaticResourceContribution');
|
|
23
|
+
exports.StaticResourceContributionProvider = Symbol('StaticResourceContributionProvider');
|
|
24
|
+
//# sourceMappingURL=static.definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.definition.js","sourceRoot":"","sources":["../../src/static-resource/static.definition.ts"],"names":[],"mappings":";;;;AAAA,qCAA0C;AAG1C;;;;;;;;;GASG;AAEI,IAAe,qBAAqB,GAApC,MAAe,qBAAqB;CAuB1C,CAAA;AAvBqB,qBAAqB;IAD1C,IAAA,eAAU,GAAE;GACS,qBAAqB,CAuB1C;AAvBqB,sDAAqB;AAiD9B,QAAA,0BAA0B,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAElE,QAAA,kCAAkC,GAAG,MAAM,CAAC,oCAAoC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { URI } from '@opensumi/ide-core-common';
|
|
2
|
+
import { StaticResourceService, IStaticResourceProvider } from './static.definition';
|
|
3
|
+
export declare class StaticResourceServiceImpl implements StaticResourceService {
|
|
4
|
+
private providers;
|
|
5
|
+
readonly resourceRoots: Set<string>;
|
|
6
|
+
registerStaticResourceProvider(provider: IStaticResourceProvider): {
|
|
7
|
+
dispose: () => void;
|
|
8
|
+
};
|
|
9
|
+
resolveStaticResource(uri: URI): URI;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=static.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.service.d.ts","sourceRoot":"","sources":["../../src/static-resource/static.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAErF,qBACa,yBAA0B,YAAW,qBAAqB;IACrE,OAAO,CAAC,SAAS,CAA8C;IAE/D,SAAgB,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAa;IAEhD,8BAA8B,CAAC,QAAQ,EAAE,uBAAuB;;;IAgBhE,qBAAqB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG;CAS5C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StaticResourceServiceImpl = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@opensumi/di");
|
|
6
|
+
let StaticResourceServiceImpl = class StaticResourceServiceImpl {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.providers = new Map();
|
|
9
|
+
this.resourceRoots = new Set();
|
|
10
|
+
}
|
|
11
|
+
registerStaticResourceProvider(provider) {
|
|
12
|
+
this.providers.set(provider.scheme, provider);
|
|
13
|
+
if (provider.roots) {
|
|
14
|
+
provider.roots.forEach((root) => {
|
|
15
|
+
this.resourceRoots.add(root);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
dispose: () => {
|
|
20
|
+
if (this.providers.get(provider.scheme) === provider) {
|
|
21
|
+
this.providers.delete(provider.scheme);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
resolveStaticResource(uri) {
|
|
27
|
+
if (!this.providers.has(uri.scheme)) {
|
|
28
|
+
return uri;
|
|
29
|
+
}
|
|
30
|
+
const url = this.providers.get(uri.scheme).resolveStaticResource(uri);
|
|
31
|
+
// vscode-url path的 = 会被转码,先手动跳过转码
|
|
32
|
+
url.toString = url.toString.bind(url, true);
|
|
33
|
+
return url;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
StaticResourceServiceImpl = tslib_1.__decorate([
|
|
37
|
+
(0, di_1.Injectable)()
|
|
38
|
+
], StaticResourceServiceImpl);
|
|
39
|
+
exports.StaticResourceServiceImpl = StaticResourceServiceImpl;
|
|
40
|
+
//# sourceMappingURL=static.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.service.js","sourceRoot":"","sources":["../../src/static-resource/static.service.ts"],"names":[],"mappings":";;;;AAAA,qCAA0C;AAMnC,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAA/B;QACG,cAAS,GAAG,IAAI,GAAG,EAAmC,CAAC;QAE/C,kBAAa,GAAgB,IAAI,GAAG,EAAE,CAAC;IA2BzD,CAAC;IAzBQ,8BAA8B,CAAC,QAAiC;QACrE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC9C,IAAI,QAAQ,CAAC,KAAK,EAAE;YAClB,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC9B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;SACJ;QACD,OAAO;YACL,OAAO,EAAE,GAAG,EAAE;gBACZ,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE;oBACpD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;iBACxC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IAEM,qBAAqB,CAAC,GAAQ;QACnC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YACnC,OAAO,GAAG,CAAC;SACZ;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;QACvE,kCAAkC;QAClC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AA9BY,yBAAyB;IADrC,IAAA,eAAU,GAAE;GACA,yBAAyB,CA8BrC;AA9BY,8DAAyB"}
|
package/lib/utils/env.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare function getElectronEnv(): any;
|
|
2
2
|
/**
|
|
3
|
-
* @deprecated useNativeTopMenu will
|
|
3
|
+
* @deprecated useNativeTopMenu will be removed in v2.26, please use appConfig#isElectronRenderer instead.
|
|
4
4
|
*/
|
|
5
5
|
export declare function useNativeTopMenu(): boolean;
|
|
6
6
|
/**
|
|
7
|
-
* @deprecated useNativeContextMenu will
|
|
7
|
+
* @deprecated useNativeContextMenu will be removed in v2.26, please use appConfig#isElectronRenderer instead.
|
|
8
8
|
*/
|
|
9
9
|
export declare function useNativeContextMenu(): boolean;
|
|
10
10
|
//# sourceMappingURL=env.d.ts.map
|
package/lib/utils/env.js
CHANGED
|
@@ -7,7 +7,7 @@ function getElectronEnv() {
|
|
|
7
7
|
}
|
|
8
8
|
exports.getElectronEnv = getElectronEnv;
|
|
9
9
|
/**
|
|
10
|
-
* @deprecated useNativeTopMenu will
|
|
10
|
+
* @deprecated useNativeTopMenu will be removed in v2.26, please use appConfig#isElectronRenderer instead.
|
|
11
11
|
*/
|
|
12
12
|
function useNativeTopMenu() {
|
|
13
13
|
if ((0, ide_core_common_1.isElectronRenderer)()) {
|
|
@@ -22,7 +22,7 @@ function useNativeTopMenu() {
|
|
|
22
22
|
}
|
|
23
23
|
exports.useNativeTopMenu = useNativeTopMenu;
|
|
24
24
|
/**
|
|
25
|
-
* @deprecated useNativeContextMenu will
|
|
25
|
+
* @deprecated useNativeContextMenu will be removed in v2.26, please use appConfig#isElectronRenderer instead.
|
|
26
26
|
*/
|
|
27
27
|
function useNativeContextMenu() {
|
|
28
28
|
if ((0, ide_core_common_1.isElectronRenderer)()) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG/B,eAAO,MAAM,UAAU,QAAO,GAAG,GAAG,SAOnC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.acquireAjv = void 0;
|
|
4
|
+
let _ajv;
|
|
5
|
+
const acquireAjv = () => {
|
|
6
|
+
if (!_ajv) {
|
|
7
|
+
const Ajv = require('ajv');
|
|
8
|
+
_ajv = new Ajv();
|
|
9
|
+
return _ajv;
|
|
10
|
+
}
|
|
11
|
+
return _ajv;
|
|
12
|
+
};
|
|
13
|
+
exports.acquireAjv = acquireAjv;
|
|
14
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/utils/schema.ts"],"names":[],"mappings":";;;AAEA,IAAI,IAAI,CAAC;AACF,MAAM,UAAU,GAAG,GAAoB,EAAE;IAC9C,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3B,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAPW,QAAA,UAAU,cAOrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/ide-core-browser",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.0",
|
|
4
4
|
"description": "@opensumi/ide-core-browser",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"build": "tsc --build ../../configs/ts/references/tsconfig.core-browser.json"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@opensumi/ide-components": "2.
|
|
22
|
-
"@opensumi/ide-connection": "2.
|
|
23
|
-
"@opensumi/ide-core-common": "2.
|
|
21
|
+
"@opensumi/ide-components": "2.25.0",
|
|
22
|
+
"@opensumi/ide-connection": "2.25.0",
|
|
23
|
+
"@opensumi/ide-core-common": "2.25.0",
|
|
24
24
|
"@opensumi/vscode-debugprotocol": "1.49.0-beta.1",
|
|
25
25
|
"@vscode/codicons": "0.0.27",
|
|
26
26
|
"ajv": "^6.10.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"react": ">=16.8.6"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "be3a49a97b6bdc4dba2699421f49404f86fc177b"
|
|
54
54
|
}
|
|
@@ -62,4 +62,14 @@ export class ApplicationService implements IApplicationService {
|
|
|
62
62
|
return wsChannel.clientId;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
get windowId(): string | number {
|
|
67
|
+
if (this.appConfig.isElectronRenderer) {
|
|
68
|
+
return electronEnv.currentWindowId;
|
|
69
|
+
} else {
|
|
70
|
+
// web 场景先用 clientId
|
|
71
|
+
const channelHandler = this.injector.get(WSChannelHandler);
|
|
72
|
+
return channelHandler.clientId;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
65
75
|
}
|
package/src/bootstrap/app.ts
CHANGED
|
@@ -73,6 +73,7 @@ import { IClientAppOpts, IconInfo, IconMap, IPreferences, LayoutConfig, ModuleCo
|
|
|
73
73
|
import { renderClientApp, IAppRenderer } from './app.view';
|
|
74
74
|
import { createClientConnection2, bindConnectionService } from './connection';
|
|
75
75
|
import { injectInnerProviders } from './inner-providers';
|
|
76
|
+
import { injectElectronInnerProviders } from './inner-providers-electron';
|
|
76
77
|
|
|
77
78
|
// 添加resize observer polyfill
|
|
78
79
|
if (typeof (window as any).ResizeObserver === 'undefined') {
|
|
@@ -278,6 +279,9 @@ export class ClientApp implements IClientApp, IDisposable {
|
|
|
278
279
|
this.injector.addProviders({ token: IClientApp, useValue: this });
|
|
279
280
|
this.injector.addProviders({ token: AppConfig, useValue: this.config });
|
|
280
281
|
injectInnerProviders(this.injector);
|
|
282
|
+
if (this.config.isElectronRenderer) {
|
|
283
|
+
injectElectronInnerProviders(this.injector);
|
|
284
|
+
}
|
|
281
285
|
}
|
|
282
286
|
|
|
283
287
|
private initFields() {
|
|
@@ -300,6 +304,14 @@ export class ClientApp implements IClientApp, IDisposable {
|
|
|
300
304
|
this.injector.addProviders(...instance.providers);
|
|
301
305
|
}
|
|
302
306
|
|
|
307
|
+
if (this.config.isElectronRenderer && instance.electronProviders) {
|
|
308
|
+
this.injector.addProviders(...instance.electronProviders);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (!this.config.isElectronRenderer && instance.webProviders) {
|
|
312
|
+
this.injector.addProviders(...instance.webProviders);
|
|
313
|
+
}
|
|
314
|
+
|
|
303
315
|
if (instance.preferences) {
|
|
304
316
|
instance.preferences(this.injector);
|
|
305
317
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Injector } from '@opensumi/di';
|
|
2
|
+
import { IElectronMainMenuService } from '@opensumi/ide-core-common';
|
|
3
|
+
import {
|
|
4
|
+
IElectronMainUIService,
|
|
5
|
+
IElectronMainLifeCycleService,
|
|
6
|
+
IElectronURLService,
|
|
7
|
+
} from '@opensumi/ide-core-common/lib/electron';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
ElectronMenuBarService,
|
|
11
|
+
IElectronMenuFactory,
|
|
12
|
+
IElectronMenuBarService,
|
|
13
|
+
ElectronMenuFactory,
|
|
14
|
+
} from '../menu/next/renderer/ctxmenu/electron';
|
|
15
|
+
import { AppConfig } from '../react-providers/config-provider';
|
|
16
|
+
import { createElectronMainApi } from '../utils/electron';
|
|
17
|
+
|
|
18
|
+
export function injectElectronInnerProviders(injector: Injector) {
|
|
19
|
+
const appConfig: AppConfig = injector.get(AppConfig);
|
|
20
|
+
|
|
21
|
+
// Add special API services for Electron, mainly services that make calls to `Electron Main` process.
|
|
22
|
+
injector.addProviders(
|
|
23
|
+
{
|
|
24
|
+
token: IElectronMainMenuService,
|
|
25
|
+
useValue: createElectronMainApi(IElectronMainMenuService, appConfig.devtools),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
token: IElectronMainUIService,
|
|
29
|
+
useValue: createElectronMainApi(IElectronMainUIService, appConfig.devtools),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
token: IElectronMainLifeCycleService,
|
|
33
|
+
useValue: createElectronMainApi(IElectronMainLifeCycleService, appConfig.devtools),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
token: IElectronURLService,
|
|
37
|
+
useValue: createElectronMainApi(IElectronURLService, appConfig.devtools),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
token: IElectronMenuFactory,
|
|
41
|
+
useClass: ElectronMenuFactory,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
token: IElectronMenuBarService,
|
|
45
|
+
useClass: ElectronMenuBarService,
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
createContributionProvider,
|
|
9
9
|
CommandServiceImpl,
|
|
10
10
|
CommandRegistry,
|
|
11
|
-
IElectronMainMenuService,
|
|
12
11
|
ReporterMetadata,
|
|
13
12
|
IReporter,
|
|
14
13
|
IReporterService,
|
|
@@ -26,11 +25,6 @@ import {
|
|
|
26
25
|
AppLifeCycleServiceToken,
|
|
27
26
|
IExtensionsSchemaService,
|
|
28
27
|
} from '@opensumi/ide-core-common';
|
|
29
|
-
import {
|
|
30
|
-
IElectronMainUIService,
|
|
31
|
-
IElectronMainLifeCycleService,
|
|
32
|
-
IElectronURLService,
|
|
33
|
-
} from '@opensumi/ide-core-common/lib/electron';
|
|
34
28
|
import {
|
|
35
29
|
HashCalculateServiceImpl,
|
|
36
30
|
IHashCalculateService,
|
|
@@ -63,13 +57,7 @@ import {
|
|
|
63
57
|
} from '../menu/next';
|
|
64
58
|
import { ICtxMenuRenderer } from '../menu/next/renderer/ctxmenu/base';
|
|
65
59
|
import { BrowserCtxMenuRenderer } from '../menu/next/renderer/ctxmenu/browser';
|
|
66
|
-
import {
|
|
67
|
-
ElectronCtxMenuRenderer,
|
|
68
|
-
ElectronMenuBarService,
|
|
69
|
-
IElectronMenuFactory,
|
|
70
|
-
IElectronMenuBarService,
|
|
71
|
-
ElectronMenuFactory,
|
|
72
|
-
} from '../menu/next/renderer/ctxmenu/electron';
|
|
60
|
+
import { ElectronCtxMenuRenderer } from '../menu/next/renderer/ctxmenu/electron';
|
|
73
61
|
import { ToolbarActionService, IToolbarActionService } from '../menu/next/toolbar-action.service';
|
|
74
62
|
import { IOpenerService } from '../opener';
|
|
75
63
|
import { OpenerService } from '../opener/opener.service';
|
|
@@ -81,10 +69,12 @@ import { SlotRendererContribution } from '../react-providers/slot';
|
|
|
81
69
|
import { CredentialsService, ICredentialsService, CryptoService, ICryptoService } from '../services';
|
|
82
70
|
import { IClipboardService, BrowserClipboardService } from '../services/clipboard.service';
|
|
83
71
|
import { IExternalUriService, ExternalUriService } from '../services/external-uri.service';
|
|
72
|
+
import { StaticResourceClientAppContribution } from '../static-resource/index';
|
|
73
|
+
import { StaticResourceContribution, StaticResourceService } from '../static-resource/static.definition';
|
|
74
|
+
import { StaticResourceServiceImpl } from '../static-resource/static.service';
|
|
84
75
|
import { IToolbarPopoverRegistry, IToolbarRegistry, ToolBarActionContribution } from '../toolbar';
|
|
85
76
|
import { ToolbarPopoverRegistry } from '../toolbar/toolbar.popover.registry';
|
|
86
77
|
import { NextToolbarRegistryImpl, ToolbarClientAppContribution } from '../toolbar/toolbar.registry';
|
|
87
|
-
import { createElectronMainApi } from '../utils/electron';
|
|
88
78
|
import { VariableRegistry, VariableRegistryImpl, VariableContribution } from '../variable';
|
|
89
79
|
import { IWindowService } from '../window';
|
|
90
80
|
import { WindowService } from '../window/window.service';
|
|
@@ -104,6 +94,7 @@ export function injectInnerProviders(injector: Injector) {
|
|
|
104
94
|
createContributionProvider(injector, VariableContribution);
|
|
105
95
|
createContributionProvider(injector, TabBarToolbarContribution);
|
|
106
96
|
createContributionProvider(injector, ToolBarActionContribution);
|
|
97
|
+
createContributionProvider(injector, StaticResourceContribution);
|
|
107
98
|
|
|
108
99
|
const appConfig: AppConfig = injector.get(AppConfig);
|
|
109
100
|
|
|
@@ -262,36 +253,11 @@ export function injectInnerProviders(injector: Injector) {
|
|
|
262
253
|
token: AppLifeCycleServiceToken,
|
|
263
254
|
useClass: AppLifeCycleService,
|
|
264
255
|
},
|
|
256
|
+
{
|
|
257
|
+
token: StaticResourceService,
|
|
258
|
+
useClass: StaticResourceServiceImpl,
|
|
259
|
+
},
|
|
260
|
+
StaticResourceClientAppContribution,
|
|
265
261
|
];
|
|
266
262
|
injector.addProviders(...providers);
|
|
267
|
-
|
|
268
|
-
// Add special API services for Electron, mainly services that make calls to `Electron Main` process.
|
|
269
|
-
if (appConfig.isElectronRenderer) {
|
|
270
|
-
injector.addProviders(
|
|
271
|
-
{
|
|
272
|
-
token: IElectronMainMenuService,
|
|
273
|
-
useValue: createElectronMainApi(IElectronMainMenuService, appConfig.devtools),
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
token: IElectronMainUIService,
|
|
277
|
-
useValue: createElectronMainApi(IElectronMainUIService, appConfig.devtools),
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
token: IElectronMainLifeCycleService,
|
|
281
|
-
useValue: createElectronMainApi(IElectronMainLifeCycleService, appConfig.devtools),
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
token: IElectronURLService,
|
|
285
|
-
useValue: createElectronMainApi(IElectronURLService, appConfig.devtools),
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
token: IElectronMenuFactory,
|
|
289
|
-
useClass: ElectronMenuFactory,
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
token: IElectronMenuBarService,
|
|
293
|
-
useClass: ElectronMenuBarService,
|
|
294
|
-
},
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
263
|
}
|
|
@@ -103,13 +103,6 @@ export class ClientCommonContribution
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
registerMenus(menus: IMenuRegistry): void {
|
|
106
|
-
// 注册 Menubar
|
|
107
|
-
if (this.appConfig.isElectronRenderer) {
|
|
108
|
-
menus.registerMenubarItem(MenuId.MenubarAppMenu, {
|
|
109
|
-
label: localize('app.name', this.appConfig.appName),
|
|
110
|
-
order: 0,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
106
|
menus.registerMenubarItem(MenuId.MenubarFileMenu, { label: localize('menu-bar.title.file'), order: 1 });
|
|
114
107
|
menus.registerMenubarItem(MenuId.MenubarEditMenu, { label: localize('menu-bar.title.edit'), order: 2 });
|
|
115
108
|
menus.registerMenubarItem(MenuId.MenubarSelectionMenu, { label: localize('menu-bar.title.selection'), order: 3 });
|
|
@@ -232,90 +225,6 @@ export class ClientCommonContribution
|
|
|
232
225
|
group: '1_terminal',
|
|
233
226
|
},
|
|
234
227
|
]);
|
|
235
|
-
|
|
236
|
-
// Edit 菜单
|
|
237
|
-
if (this.appConfig.isElectronRenderer) {
|
|
238
|
-
menus.registerMenuItems(MenuId.MenubarEditMenu, [
|
|
239
|
-
{
|
|
240
|
-
command: {
|
|
241
|
-
id: 'electron.undo',
|
|
242
|
-
label: localize('editor.undo'),
|
|
243
|
-
},
|
|
244
|
-
nativeRole: 'undo',
|
|
245
|
-
group: '1_undo',
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
command: {
|
|
249
|
-
id: 'electron.redo',
|
|
250
|
-
label: localize('editor.redo'),
|
|
251
|
-
},
|
|
252
|
-
group: '1_undo',
|
|
253
|
-
nativeRole: 'redo',
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
command: {
|
|
257
|
-
label: localize('edit.cut'),
|
|
258
|
-
id: 'electron.cut',
|
|
259
|
-
},
|
|
260
|
-
nativeRole: 'cut',
|
|
261
|
-
group: '2_clipboard',
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
command: {
|
|
265
|
-
label: localize('edit.copy'),
|
|
266
|
-
id: 'electron.copy',
|
|
267
|
-
},
|
|
268
|
-
nativeRole: 'copy',
|
|
269
|
-
group: '2_clipboard',
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
command: {
|
|
273
|
-
label: localize('edit.paste'),
|
|
274
|
-
id: 'electron.paste',
|
|
275
|
-
},
|
|
276
|
-
nativeRole: 'paste',
|
|
277
|
-
group: '2_clipboard',
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
command: {
|
|
281
|
-
label: localize('edit.selectAll'),
|
|
282
|
-
id: 'electron.selectAll',
|
|
283
|
-
},
|
|
284
|
-
nativeRole: 'selectAll',
|
|
285
|
-
group: '2_clipboard',
|
|
286
|
-
},
|
|
287
|
-
]);
|
|
288
|
-
menus.registerMenuItems(MenuId.MenubarAppMenu, [
|
|
289
|
-
{
|
|
290
|
-
command: {
|
|
291
|
-
id: 'electron.quit',
|
|
292
|
-
label: localize('app.quit'),
|
|
293
|
-
},
|
|
294
|
-
nativeRole: 'quit',
|
|
295
|
-
group: '4_quit',
|
|
296
|
-
},
|
|
297
|
-
]);
|
|
298
|
-
} else {
|
|
299
|
-
menus.registerMenuItems(MenuId.MenubarEditMenu, [
|
|
300
|
-
{
|
|
301
|
-
command: EDITOR_COMMANDS.REDO.id,
|
|
302
|
-
group: '1_undo',
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
command: EDITOR_COMMANDS.UNDO.id,
|
|
306
|
-
group: '1_undo',
|
|
307
|
-
},
|
|
308
|
-
]);
|
|
309
|
-
// 帮助菜单
|
|
310
|
-
menus.registerMenuItem(MenuId.MenubarHelpMenu, {
|
|
311
|
-
command: {
|
|
312
|
-
id: COMMON_COMMANDS.ABOUT_COMMAND.id,
|
|
313
|
-
label: COMMON_COMMANDS.ABOUT_COMMAND.label!,
|
|
314
|
-
},
|
|
315
|
-
nativeRole: 'about',
|
|
316
|
-
group: '0_about',
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
228
|
}
|
|
320
229
|
|
|
321
230
|
registerKeybindings(keybindings: KeybindingRegistry): void {
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { Injectable } from '@opensumi/di';
|
|
1
|
+
import { Injectable, Provider } from '@opensumi/di';
|
|
2
2
|
import { CommonServerPath, CryptoServicePath, KeytarServicePath } from '@opensumi/ide-core-common';
|
|
3
3
|
|
|
4
4
|
import { AuthenticationContribution } from '../authentication/authentication.contribution';
|
|
5
5
|
import { BrowserModule } from '../browser-module';
|
|
6
6
|
import { HashCalculateContribution } from '../hash-calculate/hash-calculate.contribution';
|
|
7
7
|
import { OpenerContribution } from '../opener';
|
|
8
|
+
import { ElectronOpenerContributionClient } from '../opener/opener-electron.contribution';
|
|
8
9
|
import { DefaultOpenerContribution, OpenerContributionClient } from '../opener/opener.contribution';
|
|
9
10
|
|
|
10
11
|
import { ClientCommonContribution } from './common.contribution';
|
|
12
|
+
import { ClientElectronCommonContribution } from './electron.contribution';
|
|
13
|
+
import { ClientWebCommonContribution } from './web.contribution';
|
|
11
14
|
|
|
12
15
|
@Injectable()
|
|
13
16
|
export class ClientCommonModule extends BrowserModule {
|
|
@@ -18,7 +21,11 @@ export class ClientCommonModule extends BrowserModule {
|
|
|
18
21
|
OpenerContributionClient,
|
|
19
22
|
AuthenticationContribution,
|
|
20
23
|
HashCalculateContribution,
|
|
21
|
-
];
|
|
24
|
+
] as Provider[];
|
|
25
|
+
|
|
26
|
+
electronProviders = [ClientElectronCommonContribution, ElectronOpenerContributionClient];
|
|
27
|
+
webProviders = [ClientWebCommonContribution];
|
|
28
|
+
|
|
22
29
|
backServices = [
|
|
23
30
|
{
|
|
24
31
|
servicePath: CommonServerPath,
|