@opensumi/ide-file-scheme 3.1.3-next-1719216888.0 → 3.1.3-next-1719220003.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/browser/external.view.d.ts.map +1 -1
- package/lib/browser/external.view.js +4 -25
- package/lib/browser/external.view.js.map +1 -1
- package/lib/browser/file-scheme.contribution.d.ts.map +1 -1
- package/lib/browser/file-scheme.contribution.js +22 -33
- package/lib/browser/file-scheme.contribution.js.map +1 -1
- package/lib/browser/prevent.view.d.ts +0 -9
- package/lib/browser/prevent.view.d.ts.map +1 -1
- package/lib/browser/prevent.view.js +5 -15
- package/lib/browser/prevent.view.js.map +1 -1
- package/lib/browser/style.module.less +5 -36
- package/package.json +10 -10
- package/src/browser/external.view.tsx +11 -35
- package/src/browser/file-scheme.contribution.ts +25 -36
- package/src/browser/prevent.view.tsx +6 -36
- package/src/browser/style.module.less +5 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.view.d.ts","sourceRoot":"","sources":["../../src/browser/external.view.tsx"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"external.view.d.ts","sourceRoot":"","sources":["../../src/browser/external.view.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAIxE,eAAO,MAAM,qBAAqB,EAAE,oBAAoB,CAAC,IAAI,CAa5D,CAAC"}
|
|
@@ -6,35 +6,14 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const di_1 = require("@opensumi/di");
|
|
7
7
|
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
8
8
|
const electron_1 = require("@opensumi/ide-core-common/lib/electron");
|
|
9
|
-
const
|
|
10
|
-
const prevent_view_1 = require("./prevent.view");
|
|
9
|
+
const style_module_less_1 = tslib_1.__importDefault(require("./style.module.less"));
|
|
11
10
|
const BinaryEditorComponent = (props) => {
|
|
12
11
|
const srcPath = props.resource.uri.codeUri.fsPath;
|
|
13
12
|
const injector = (0, ide_core_browser_1.useInjectable)(di_1.INJECTOR_TOKEN);
|
|
14
13
|
const appConfig = (0, ide_core_browser_1.useInjectable)(ide_core_browser_1.AppConfig);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const current = editorService.currentResource;
|
|
19
|
-
if (!current) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
current.metadata = Object.assign(Object.assign({}, current.metadata), { skipPreventBinary: true });
|
|
23
|
-
eventBus.fire(new browser_1.ResourceOpenTypeChangedEvent(current.uri));
|
|
24
|
-
};
|
|
25
|
-
const actions = [
|
|
26
|
-
{
|
|
27
|
-
label: (0, ide_core_browser_1.localize)('editor.file.prevent.stillOpen'),
|
|
28
|
-
onClick: () => handleClick(),
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
if (appConfig.isElectronRenderer) {
|
|
32
|
-
actions.push({
|
|
33
|
-
label: (0, ide_core_browser_1.localize)('editor.openExternal'),
|
|
34
|
-
onClick: () => injector.get(electron_1.IElectronMainUIService).openPath(srcPath),
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return react_1.default.createElement(prevent_view_1.PreventComponent, { description: (0, ide_core_browser_1.localize)('editor.cannotOpenBinary'), actions: actions });
|
|
14
|
+
return (react_1.default.createElement("div", { className: style_module_less_1.default.external },
|
|
15
|
+
(0, ide_core_browser_1.localize)('editor.cannotOpenBinary'),
|
|
16
|
+
appConfig.isElectronRenderer ? (react_1.default.createElement("a", { onClick: () => injector.get(electron_1.IElectronMainUIService).openPath(srcPath) }, (0, ide_core_browser_1.localize)('editor.openExternal'))) : null));
|
|
38
17
|
};
|
|
39
18
|
exports.BinaryEditorComponent = BinaryEditorComponent;
|
|
40
19
|
//# sourceMappingURL=external.view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.view.js","sourceRoot":"","sources":["../../src/browser/external.view.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,qCAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"external.view.js","sourceRoot":"","sources":["../../src/browser/external.view.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,qCAAwD;AACxD,iEAAgF;AAChF,qEAAgF;AAGhF,oFAAyC;AAElC,MAAM,qBAAqB,GAA+B,CAAC,KAAK,EAAE,EAAE;IACzE,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;IAClD,MAAM,QAAQ,GAAa,IAAA,gCAAa,EAAC,mBAAc,CAAC,CAAC;IACzD,MAAM,SAAS,GAAc,IAAA,gCAAa,EAAC,4BAAS,CAAC,CAAC;IAEtD,OAAO,CACL,uCAAK,SAAS,EAAE,2BAAM,CAAC,QAAQ;QAC5B,IAAA,2BAAQ,EAAC,yBAAyB,CAAC;QACnC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAC9B,qCAAG,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,iCAAsB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAG,IAAA,2BAAQ,EAAC,qBAAqB,CAAC,CAAK,CAChH,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,qBAAqB,yBAahC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-scheme.contribution.d.ts","sourceRoot":"","sources":["../../src/browser/file-scheme.contribution.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EAEvB,mCAAmC,EACpC,MAAM,kCAAkC,CAAC;AAqB1C,qBACa,oCAAqC,YAAW,yBAAyB;IAEpF,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAA6B;IAGxE,OAAO,C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IAU1E,uBAAuB,CAAC,uBAAuB,EAAE,uBAAuB;YA4F1D,WAAW;YAYX,eAAe;CAQ9B"}
|
|
@@ -94,45 +94,34 @@ let FileSystemEditorComponentContribution = class FileSystemEditorComponentContr
|
|
|
94
94
|
});
|
|
95
95
|
editorComponentRegistry.registerEditorComponentResolver((scheme) => (scheme === ide_core_browser_1.Schemes.file || this.fileServiceClient.handlesScheme(scheme) ? 10 : -1), async (resource, results) => {
|
|
96
96
|
const type = await this.getFileType(resource.uri.toString());
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
if (type === 'image') {
|
|
98
|
+
results.push({
|
|
99
|
+
type: browser_1.EditorOpenType.component,
|
|
100
|
+
componentId: IMAGE_PREVIEW_COMPONENT_ID,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (type === 'video') {
|
|
104
|
+
results.push({
|
|
105
|
+
type: browser_1.EditorOpenType.component,
|
|
106
|
+
componentId: VIDEO_PREVIEW_COMPONENT_ID,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (type === 'text') {
|
|
110
|
+
const { metadata, uri } = resource;
|
|
111
|
+
const stat = await this.fileServiceClient.getFileStat(uri.toString());
|
|
112
|
+
await this.preference.ready;
|
|
113
|
+
const maxSize = this.preference.get('editor.largeFile') || 4 * 1024 * 1024 * 1024;
|
|
114
|
+
if (stat && (stat.size || 0) > maxSize && !(metadata || {}).noPrevent) {
|
|
99
115
|
results.push({
|
|
100
116
|
type: browser_1.EditorOpenType.component,
|
|
101
|
-
componentId:
|
|
117
|
+
componentId: LARGE_FILE_PREVENT_COMPONENT_ID,
|
|
102
118
|
});
|
|
103
|
-
break;
|
|
104
119
|
}
|
|
105
|
-
|
|
120
|
+
else {
|
|
106
121
|
results.push({
|
|
107
|
-
type: browser_1.EditorOpenType.
|
|
108
|
-
|
|
122
|
+
type: browser_1.EditorOpenType.code,
|
|
123
|
+
title: (0, ide_core_browser_1.localize)('editorOpenType.code'),
|
|
109
124
|
});
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
case 'binary':
|
|
113
|
-
case 'text': {
|
|
114
|
-
const { metadata: _metadata, uri } = resource;
|
|
115
|
-
const metadata = _metadata || {};
|
|
116
|
-
// 二进制文件不支持打开
|
|
117
|
-
if (type === 'binary' && !metadata.skipPreventBinary) {
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
const stat = await this.fileServiceClient.getFileStat(uri.toString());
|
|
121
|
-
await this.preference.ready;
|
|
122
|
-
const maxSize = this.preference.getValid('editor.largeFile', 4 * 1024 * 1024 * 1024);
|
|
123
|
-
if (stat && (stat.size || 0) > maxSize && !metadata.skipPreventTooLarge) {
|
|
124
|
-
results.push({
|
|
125
|
-
type: browser_1.EditorOpenType.component,
|
|
126
|
-
componentId: LARGE_FILE_PREVENT_COMPONENT_ID,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
results.push({
|
|
131
|
-
type: browser_1.EditorOpenType.code,
|
|
132
|
-
title: (0, ide_core_browser_1.localize)('editorOpenType.code'),
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
break;
|
|
136
125
|
}
|
|
137
126
|
}
|
|
138
127
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-scheme.contribution.js","sourceRoot":"","sources":["../../src/browser/file-scheme.contribution.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AACzC,iEAAuG;AACvG,sEAAkF;AAElF,8DAK0C;AAC1C,0FAG4D;AAC5D,kEAA2E;AAE3E,mDAAwD;AACxD,yCAIoB;AACpB,iDAAkD;AAClD,iDAA4D;AAE5D,MAAM,0BAA0B,GAAG,eAAe,CAAC;AACnD,MAAM,0BAA0B,GAAG,eAAe,CAAC;AACnD,MAAM,0BAA0B,GAAG,eAAe,CAAC;AACnD,MAAM,+BAA+B,GAAG,oBAAoB,CAAC;AAGtD,IAAM,oCAAoC,GAA1C,MAAM,oCAAoC;IAgB/C,gB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AE;gBACzC,mCAAmC;gBACnC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;aACtC;iBAAM;gBACL,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;aAC/D;SACF;QACD,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,GAAW;QACvC,IAAI;YACF,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;SACtD;QAAC,OAAO,GAAG,EAAE;YACZ,2BAA2B;YAC3B,OAAO,MAAM,CAAC;SACf;IACH,CAAC;CACF,CAAA;AAhIC;IAAC,IAAA,cAAS,EAAC,2BAAkB,CAAC;;gFACyB;AAEvD;IAAC,IAAA,cAAS,EAAC,oCAAiB,CAAC;;yEACkB;AALpC,qCAAqC;IADjD,IAAA,yBAAM,EAAC,mCAAyB,CAAC;;GACrB,qCAAqC,CAiIjD;AAjIY,sFAAqC"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface PreventComponentProps {
|
|
3
|
-
description: string;
|
|
4
|
-
actions: {
|
|
5
|
-
label: string;
|
|
6
|
-
onClick: () => void;
|
|
7
|
-
}[];
|
|
8
|
-
}
|
|
9
|
-
export declare const PreventComponent: React.FC<PreventComponentProps>;
|
|
10
2
|
export declare const LargeFilePrevent: () => React.JSX.Element;
|
|
11
|
-
export {};
|
|
12
3
|
//# sourceMappingURL=prevent.view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prevent.view.d.ts","sourceRoot":"","sources":["../../src/browser/prevent.view.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prevent.view.d.ts","sourceRoot":"","sources":["../../src/browser/prevent.view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,eAAO,MAAM,gBAAgB,yBAqB5B,CAAC"}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LargeFilePrevent =
|
|
3
|
+
exports.LargeFilePrevent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
6
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
6
|
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
8
|
-
const components_1 = require("@opensumi/ide-core-browser/lib/components");
|
|
9
7
|
const ide_editor_1 = require("@opensumi/ide-editor");
|
|
10
8
|
const types_1 = require("@opensumi/ide-editor/lib/browser/types");
|
|
11
9
|
const style_module_less_1 = tslib_1.__importDefault(require("./style.module.less"));
|
|
12
|
-
const PreventComponent = (props) => (react_1.default.createElement("div", { className: style_module_less_1.default['error-page'] },
|
|
13
|
-
react_1.default.createElement("div", { className: (0, classnames_1.default)(style_module_less_1.default.icon, (0, ide_core_browser_1.getExternalIcon)('warning')) }),
|
|
14
|
-
react_1.default.createElement("div", { className: style_module_less_1.default['description'] }, props.description),
|
|
15
|
-
react_1.default.createElement("div", { className: style_module_less_1.default['actions-wrapper'] }, props.actions.map((action, index) => (react_1.default.createElement(components_1.Button, { key: index, onClick: () => action.onClick(), className: style_module_less_1.default['action-button'] }, action.label))))));
|
|
16
|
-
exports.PreventComponent = PreventComponent;
|
|
17
10
|
const LargeFilePrevent = () => {
|
|
18
11
|
const editorService = (0, ide_core_browser_1.useInjectable)(ide_editor_1.WorkbenchEditorService);
|
|
19
12
|
const eventBus = (0, ide_core_browser_1.useInjectable)(ide_core_browser_1.IEventBus);
|
|
@@ -22,15 +15,12 @@ const LargeFilePrevent = () => {
|
|
|
22
15
|
if (!current) {
|
|
23
16
|
return;
|
|
24
17
|
}
|
|
25
|
-
current.metadata =
|
|
18
|
+
current.metadata = { noPrevent: true };
|
|
26
19
|
eventBus.fire(new types_1.ResourceOpenTypeChangedEvent(current.uri));
|
|
27
20
|
};
|
|
28
|
-
return (react_1.default.createElement(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
onClick: () => handleClick(),
|
|
32
|
-
},
|
|
33
|
-
] }));
|
|
21
|
+
return (react_1.default.createElement("div", { className: style_module_less_1.default.font },
|
|
22
|
+
(0, ide_core_browser_1.localize)('editor.largeFile.prevent'),
|
|
23
|
+
react_1.default.createElement("a", { onClick: () => handleClick() }, (0, ide_core_browser_1.localize)('editor.largeFile.prevent.stillOpen'))));
|
|
34
24
|
};
|
|
35
25
|
exports.LargeFilePrevent = LargeFilePrevent;
|
|
36
26
|
//# sourceMappingURL=prevent.view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prevent.view.js","sourceRoot":"","sources":["../../src/browser/prevent.view.tsx"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"prevent.view.js","sourceRoot":"","sources":["../../src/browser/prevent.view.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,iEAAgF;AAChF,qDAA8D;AAC9D,kEAAsF;AAEtF,oFAAyC;AAElC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,aAAa,GAAG,IAAA,gCAAa,EAAyB,mCAAsB,CAAC,CAAC;IACpF,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAY,4BAAS,CAAC,CAAC;IAErD,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,MAAM,OAAO,GAAG,aAAa,CAAC,eAAe,CAAC;QAE9C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QAED,OAAO,CAAC,QAAQ,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QACvC,QAAQ,CAAC,IAAI,CAAC,IAAI,oCAA4B,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC;IAEF,OAAO,CACL,uCAAK,SAAS,EAAE,2BAAM,CAAC,IAAI;QACxB,IAAA,2BAAQ,EAAC,0BAA0B,CAAC;QACrC,qCAAG,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,IAAG,IAAA,2BAAQ,EAAC,oCAAoC,CAAC,CAAK,CACjF,CACP,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,gBAAgB,oBAqB3B"}
|
|
@@ -50,42 +50,11 @@
|
|
|
50
50
|
height: 100%;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
.
|
|
54
|
-
display: flex;
|
|
55
|
-
justify-content: center;
|
|
56
|
-
align-items: center;
|
|
57
|
-
|
|
58
|
-
flex-direction: column;
|
|
59
|
-
|
|
60
|
-
font-size: 12px;
|
|
53
|
+
.external {
|
|
61
54
|
padding: 10px;
|
|
55
|
+
}
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
user-select: none;
|
|
67
|
-
|
|
68
|
-
& .icon {
|
|
69
|
-
font-size: 40px !important;
|
|
70
|
-
color: var(--kt-modalWarningIcon-foreground);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.description {
|
|
74
|
-
width: 100%;
|
|
75
|
-
margin-top: 4px;
|
|
76
|
-
|
|
77
|
-
text-align: center;
|
|
78
|
-
|
|
79
|
-
font-size: 14px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
& .action-wrapper {
|
|
83
|
-
display: flex;
|
|
84
|
-
width: 100%;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
& .action-button {
|
|
88
|
-
margin-top: 20px;
|
|
89
|
-
font-size: 13px;
|
|
90
|
-
}
|
|
57
|
+
.font {
|
|
58
|
+
padding: 4px;
|
|
59
|
+
font-size: 12px;
|
|
91
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/ide-file-scheme",
|
|
3
|
-
"version": "3.1.3-next-
|
|
3
|
+
"version": "3.1.3-next-1719220003.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib",
|
|
6
6
|
"src"
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"url": "git@github.com:opensumi/core.git"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@opensumi/ide-core-common": "3.1.3-next-
|
|
21
|
-
"@opensumi/ide-core-node": "3.1.3-next-
|
|
22
|
-
"@opensumi/ide-file-service": "3.1.3-next-
|
|
20
|
+
"@opensumi/ide-core-common": "3.1.3-next-1719220003.0",
|
|
21
|
+
"@opensumi/ide-core-node": "3.1.3-next-1719220003.0",
|
|
22
|
+
"@opensumi/ide-file-service": "3.1.3-next-1719220003.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@opensumi/ide-core-browser": "3.1.3-next-
|
|
26
|
-
"@opensumi/ide-dev-tool": "3.1.3-next-
|
|
27
|
-
"@opensumi/ide-editor": "3.1.3-next-
|
|
28
|
-
"@opensumi/ide-monaco": "3.1.3-next-
|
|
29
|
-
"@opensumi/ide-overlay": "3.1.3-next-
|
|
25
|
+
"@opensumi/ide-core-browser": "3.1.3-next-1719220003.0",
|
|
26
|
+
"@opensumi/ide-dev-tool": "3.1.3-next-1719220003.0",
|
|
27
|
+
"@opensumi/ide-editor": "3.1.3-next-1719220003.0",
|
|
28
|
+
"@opensumi/ide-monaco": "3.1.3-next-1719220003.0",
|
|
29
|
+
"@opensumi/ide-overlay": "3.1.3-next-1719220003.0"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "c3c9a14fdaed45c4f60102e8eb7216a867caa366"
|
|
32
32
|
}
|
|
@@ -1,47 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { INJECTOR_TOKEN, Injector } from '@opensumi/di';
|
|
4
|
-
import { AppConfig,
|
|
4
|
+
import { AppConfig, localize, useInjectable } from '@opensumi/ide-core-browser';
|
|
5
5
|
import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron';
|
|
6
|
-
import {
|
|
7
|
-
ReactEditorComponent,
|
|
8
|
-
ResourceOpenTypeChangedEvent,
|
|
9
|
-
WorkbenchEditorService,
|
|
10
|
-
} from '@opensumi/ide-editor/lib/browser';
|
|
6
|
+
import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser';
|
|
11
7
|
|
|
12
|
-
import
|
|
8
|
+
import styles from './style.module.less';
|
|
13
9
|
|
|
14
10
|
export const BinaryEditorComponent: ReactEditorComponent<null> = (props) => {
|
|
15
11
|
const srcPath = props.resource.uri.codeUri.fsPath;
|
|
16
12
|
const injector: Injector = useInjectable(INJECTOR_TOKEN);
|
|
17
13
|
const appConfig: AppConfig = useInjectable(AppConfig);
|
|
18
|
-
const editorService = useInjectable<WorkbenchEditorService>(WorkbenchEditorService);
|
|
19
|
-
const eventBus = useInjectable<IEventBus>(IEventBus);
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
eventBus.fire(new ResourceOpenTypeChangedEvent(current.uri));
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const actions = [
|
|
33
|
-
{
|
|
34
|
-
label: localize('editor.file.prevent.stillOpen'),
|
|
35
|
-
onClick: () => handleClick(),
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
if (appConfig.isElectronRenderer) {
|
|
40
|
-
actions.push({
|
|
41
|
-
label: localize('editor.openExternal'),
|
|
42
|
-
onClick: () => injector.get(IElectronMainUIService).openPath(srcPath),
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return <PreventComponent description={localize('editor.cannotOpenBinary')} actions={actions} />;
|
|
15
|
+
return (
|
|
16
|
+
<div className={styles.external}>
|
|
17
|
+
{localize('editor.cannotOpenBinary')}
|
|
18
|
+
{appConfig.isElectronRenderer ? (
|
|
19
|
+
<a onClick={() => injector.get(IElectronMainUIService).openPath(srcPath)}>{localize('editor.openExternal')}</a>
|
|
20
|
+
) : null}
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
47
23
|
};
|
|
@@ -120,47 +120,36 @@ export class FileSystemEditorComponentContribution implements BrowserEditorContr
|
|
|
120
120
|
async (resource: IResource<any>, results: IEditorOpenType[]) => {
|
|
121
121
|
const type = await this.getFileType(resource.uri.toString());
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
if (type === 'image') {
|
|
124
|
+
results.push({
|
|
125
|
+
type: EditorOpenType.component,
|
|
126
|
+
componentId: IMAGE_PREVIEW_COMPONENT_ID,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (type === 'video') {
|
|
131
|
+
results.push({
|
|
132
|
+
type: EditorOpenType.component,
|
|
133
|
+
componentId: VIDEO_PREVIEW_COMPONENT_ID,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (type === 'text') {
|
|
138
|
+
const { metadata, uri } = resource as { uri: URI; metadata: any };
|
|
139
|
+
const stat = await this.fileServiceClient.getFileStat(uri.toString());
|
|
140
|
+
await this.preference.ready;
|
|
141
|
+
const maxSize = this.preference.get<number>('editor.largeFile') || 4 * 1024 * 1024 * 1024;
|
|
142
|
+
|
|
143
|
+
if (stat && (stat.size || 0) > maxSize && !(metadata || {}).noPrevent) {
|
|
125
144
|
results.push({
|
|
126
145
|
type: EditorOpenType.component,
|
|
127
|
-
componentId:
|
|
146
|
+
componentId: LARGE_FILE_PREVENT_COMPONENT_ID,
|
|
128
147
|
});
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
case 'video': {
|
|
148
|
+
} else {
|
|
132
149
|
results.push({
|
|
133
|
-
type: EditorOpenType.
|
|
134
|
-
|
|
150
|
+
type: EditorOpenType.code,
|
|
151
|
+
title: localize('editorOpenType.code'),
|
|
135
152
|
});
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
case 'binary':
|
|
139
|
-
case 'text': {
|
|
140
|
-
const { metadata: _metadata, uri } = resource;
|
|
141
|
-
const metadata = _metadata || {};
|
|
142
|
-
|
|
143
|
-
// 二进制文件不支持打开
|
|
144
|
-
if (type === 'binary' && !metadata.skipPreventBinary) {
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const stat = await this.fileServiceClient.getFileStat(uri.toString());
|
|
149
|
-
await this.preference.ready;
|
|
150
|
-
const maxSize = this.preference.getValid<number>('editor.largeFile', 4 * 1024 * 1024 * 1024);
|
|
151
|
-
|
|
152
|
-
if (stat && (stat.size || 0) > maxSize && !metadata.skipPreventTooLarge) {
|
|
153
|
-
results.push({
|
|
154
|
-
type: EditorOpenType.component,
|
|
155
|
-
componentId: LARGE_FILE_PREVENT_COMPONENT_ID,
|
|
156
|
-
});
|
|
157
|
-
} else {
|
|
158
|
-
results.push({
|
|
159
|
-
type: EditorOpenType.code,
|
|
160
|
-
title: localize('editorOpenType.code'),
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
break;
|
|
164
153
|
}
|
|
165
154
|
}
|
|
166
155
|
},
|
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
import cls from 'classnames';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
|
|
4
|
-
import { IEventBus,
|
|
5
|
-
import { Button } from '@opensumi/ide-core-browser/lib/components';
|
|
3
|
+
import { IEventBus, localize, useInjectable } from '@opensumi/ide-core-browser';
|
|
6
4
|
import { WorkbenchEditorService } from '@opensumi/ide-editor';
|
|
7
5
|
import { ResourceOpenTypeChangedEvent } from '@opensumi/ide-editor/lib/browser/types';
|
|
8
6
|
|
|
9
7
|
import styles from './style.module.less';
|
|
10
8
|
|
|
11
|
-
interface PreventComponentProps {
|
|
12
|
-
description: string;
|
|
13
|
-
|
|
14
|
-
actions: {
|
|
15
|
-
label: string;
|
|
16
|
-
onClick: () => void;
|
|
17
|
-
}[];
|
|
18
|
-
}
|
|
19
|
-
export const PreventComponent: React.FC<PreventComponentProps> = (props: PreventComponentProps) => (
|
|
20
|
-
<div className={styles['error-page']}>
|
|
21
|
-
<div className={cls(styles.icon, getExternalIcon('warning'))}></div>
|
|
22
|
-
<div className={styles['description']}>{props.description}</div>
|
|
23
|
-
|
|
24
|
-
<div className={styles['actions-wrapper']}>
|
|
25
|
-
{props.actions.map((action, index) => (
|
|
26
|
-
<Button key={index} onClick={() => action.onClick()} className={styles['action-button']}>
|
|
27
|
-
{action.label}
|
|
28
|
-
</Button>
|
|
29
|
-
))}
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
9
|
export const LargeFilePrevent = () => {
|
|
35
10
|
const editorService = useInjectable<WorkbenchEditorService>(WorkbenchEditorService);
|
|
36
11
|
const eventBus = useInjectable<IEventBus>(IEventBus);
|
|
@@ -42,19 +17,14 @@ export const LargeFilePrevent = () => {
|
|
|
42
17
|
return;
|
|
43
18
|
}
|
|
44
19
|
|
|
45
|
-
current.metadata = {
|
|
20
|
+
current.metadata = { noPrevent: true };
|
|
46
21
|
eventBus.fire(new ResourceOpenTypeChangedEvent(current.uri));
|
|
47
22
|
};
|
|
48
23
|
|
|
49
24
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
label: localize('editor.file.prevent.stillOpen'),
|
|
55
|
-
onClick: () => handleClick(),
|
|
56
|
-
},
|
|
57
|
-
]}
|
|
58
|
-
/>
|
|
25
|
+
<div className={styles.font}>
|
|
26
|
+
{localize('editor.largeFile.prevent')}
|
|
27
|
+
<a onClick={() => handleClick()}>{localize('editor.largeFile.prevent.stillOpen')}</a>
|
|
28
|
+
</div>
|
|
59
29
|
);
|
|
60
30
|
};
|
|
@@ -50,42 +50,11 @@
|
|
|
50
50
|
height: 100%;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
.
|
|
54
|
-
display: flex;
|
|
55
|
-
justify-content: center;
|
|
56
|
-
align-items: center;
|
|
57
|
-
|
|
58
|
-
flex-direction: column;
|
|
59
|
-
|
|
60
|
-
font-size: 12px;
|
|
53
|
+
.external {
|
|
61
54
|
padding: 10px;
|
|
55
|
+
}
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
user-select: none;
|
|
67
|
-
|
|
68
|
-
& .icon {
|
|
69
|
-
font-size: 40px !important;
|
|
70
|
-
color: var(--kt-modalWarningIcon-foreground);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.description {
|
|
74
|
-
width: 100%;
|
|
75
|
-
margin-top: 4px;
|
|
76
|
-
|
|
77
|
-
text-align: center;
|
|
78
|
-
|
|
79
|
-
font-size: 14px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
& .action-wrapper {
|
|
83
|
-
display: flex;
|
|
84
|
-
width: 100%;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
& .action-button {
|
|
88
|
-
margin-top: 20px;
|
|
89
|
-
font-size: 13px;
|
|
90
|
-
}
|
|
57
|
+
.font {
|
|
58
|
+
padding: 4px;
|
|
59
|
+
font-size: 12px;
|
|
91
60
|
}
|