@codingame/monaco-vscode-extension-gallery-service-override 1.85.0 → 1.85.1
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/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.contribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +0 -43
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +0 -104
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.js +0 -207
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-extension-gallery-service-override",
|
|
3
|
-
"version": "1.85.
|
|
3
|
+
"version": "1.85.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@1.85.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.85.1",
|
|
22
22
|
"monaco-editor": "0.45.0",
|
|
23
23
|
"vscode-semver": "npm:semver@=5.5.0"
|
|
24
24
|
}
|
|
@@ -50,7 +50,7 @@ import { Delegate } from './extensionsList.js';
|
|
|
50
50
|
import { ExtensionsTree, ExtensionData, ExtensionsGridView, getExtensions } from './extensionsViewer.js';
|
|
51
51
|
import { RemoteBadgeWidget, VerifiedPublisherWidget, InstallCountWidget, RatingsWidget, SponsorWidget, ExtensionStatusWidget, ExtensionWidget, ExtensionRecommendationWidget, onClick } from './extensionsWidgets.js';
|
|
52
52
|
import { ExtensionContainers, VIEWLET_ID, IExtensionsWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
53
|
-
import { renderMarkdownDocument, DEFAULT_MARKDOWN_STYLES } from '
|
|
53
|
+
import { renderMarkdownDocument, DEFAULT_MARKDOWN_STYLES } from 'vscode/vscode/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer';
|
|
54
54
|
import { ShowCurrentReleaseNotesActionId } from '../../update/common/update.js';
|
|
55
55
|
import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED, IWebviewService } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview';
|
|
56
56
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
@@ -9,7 +9,7 @@ import { Extensions as Extensions$3 } from 'vscode/vscode/vs/workbench/common/co
|
|
|
9
9
|
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
10
10
|
import { VIEWLET_ID, IExtensionsWorkbenchService, CONTEXT_HAS_GALLERY, AutoUpdateConfigurationKey, HasOutdatedExtensionsContext, OUTDATED_EXTENSIONS_VIEW_ID, SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID, INSTALL_EXTENSION_FROM_VSIX_COMMAND_ID, extensionsSearchActionsMenu, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID, WORKSPACE_RECOMMENDATIONS_VIEW_ID, THEME_ACTIONS_GROUP, INSTALL_ACTIONS_GROUP, UPDATE_ACTIONS_GROUP, TOGGLE_IGNORE_EXTENSION_ACTION_ID } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
11
11
|
import { SearchExtensionsAction, PromptExtensionInstallFailureAction, ConfigureWorkspaceFolderRecommendedExtensionsAction, InstallSpecificVersionOfExtensionAction, ReinstallAction, SetColorThemeAction, SetFileIconThemeAction, SetProductIconThemeAction, ToggleAutoUpdateForExtensionAction, ToggleAutoUpdatesForPublisherAction, SwitchToPreReleaseVersionAction, SwitchToReleasedVersionAction, ClearLanguageAction, ConfigureWorkspaceRecommendedExtensionsAction } from 'vscode/vscode/vs/workbench/contrib/extensions/browser/extensionsActions';
|
|
12
|
-
import { ExtensionsInput } from '
|
|
12
|
+
import { ExtensionsInput } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensionsInput';
|
|
13
13
|
import { ExtensionEditor } from './extensionEditor.js';
|
|
14
14
|
import { ExtensionsViewPaneContainer, StatusUpdater, MaliciousExtensionChecker, ExtensionsViewletViewsContribution, DefaultViewsContext, SearchHasTextContext } from './extensionsViewlet.js';
|
|
15
15
|
import { Extensions as Extensions$2 } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
@@ -17,7 +17,7 @@ import * as JSONContributionRegistry from 'monaco-editor/esm/vs/platform/jsonsch
|
|
|
17
17
|
import { ExtensionsConfigurationSchemaId, ExtensionsConfigurationSchema } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensionsFileTemplate';
|
|
18
18
|
import { CommandsRegistry, ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
19
19
|
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
20
|
-
import { KeymapExtensions } from '
|
|
20
|
+
import { KeymapExtensions } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensionsUtils';
|
|
21
21
|
import { areSameExtensions, getIdAndVersion } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
22
22
|
import { EditorPaneDescriptor } from 'vscode/vscode/vs/workbench/browser/editor';
|
|
23
23
|
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
@@ -15,7 +15,7 @@ import { VIEWLET_ID, CONTEXT_HAS_GALLERY, OUTDATED_EXTENSIONS_VIEW_ID, WORKSPACE
|
|
|
15
15
|
import { InstallLocalExtensionsInRemoteAction, InstallRemoteExtensionsInLocalAction } from 'vscode/vscode/vs/workbench/contrib/extensions/browser/extensionsActions';
|
|
16
16
|
import { IExtensionManagementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
17
17
|
import { IExtensionManagementServerService, IWorkbenchExtensionEnablementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement';
|
|
18
|
-
import { ExtensionsInput } from '
|
|
18
|
+
import { ExtensionsInput } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensionsInput';
|
|
19
19
|
import { ServerInstalledExtensionsView, DefaultPopularExtensionsView, DefaultRecommendedExtensionsView, EnabledExtensionsView, DisabledExtensionsView, SearchMarketplaceExtensionsView, ExtensionsListView, RecentlyUpdatedExtensionsView, OutdatedExtensionsView, WorkspaceRecommendedExtensionsView, RecommendedExtensionsView, BuiltInFeatureExtensionsView, BuiltInThemesExtensionsView, BuiltInProgrammingLanguageExtensionsView, UntrustedWorkspaceUnsupportedExtensionsView, UntrustedWorkspacePartiallySupportedExtensionsView, VirtualWorkspaceUnsupportedExtensionsView, VirtualWorkspacePartiallySupportedExtensionsView, DeprecatedExtensionsView } from './extensionsViews.js';
|
|
20
20
|
import { IProgressService } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
21
21
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
@@ -18,7 +18,7 @@ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
|
18
18
|
import { HasOutdatedExtensionsContext, AutoUpdateConfigurationKey, AutoCheckUpdatesConfigurationKey } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
19
19
|
import { SIDE_GROUP, ACTIVE_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
20
20
|
import { IURLService } from 'vscode/vscode/vs/platform/url/common/url';
|
|
21
|
-
import { ExtensionsInput } from '
|
|
21
|
+
import { ExtensionsInput } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensionsInput';
|
|
22
22
|
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
23
23
|
import { IProgressService } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
24
24
|
import { Severity, INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
2
|
-
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
3
|
-
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
-
import { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
|
|
5
|
-
import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
6
|
-
import { join } from 'monaco-editor/esm/vs/base/common/path.js';
|
|
7
|
-
|
|
8
|
-
class ExtensionsInput extends EditorInput {
|
|
9
|
-
static { this.ID = 'workbench.extensions.input2'; }
|
|
10
|
-
get typeId() {
|
|
11
|
-
return ExtensionsInput.ID;
|
|
12
|
-
}
|
|
13
|
-
get capabilities() {
|
|
14
|
-
return 2 | 8 | 1024 ;
|
|
15
|
-
}
|
|
16
|
-
get resource() {
|
|
17
|
-
return ( URI.from({
|
|
18
|
-
scheme: Schemas.extension,
|
|
19
|
-
path: join(this._extension.identifier.id, 'extension')
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
constructor(_extension) {
|
|
23
|
-
super();
|
|
24
|
-
this._extension = _extension;
|
|
25
|
-
}
|
|
26
|
-
get extension() { return this._extension; }
|
|
27
|
-
getName() {
|
|
28
|
-
return ( localizeWithPath(
|
|
29
|
-
'vs/workbench/contrib/extensions/common/extensionsInput',
|
|
30
|
-
'extensionsInputName',
|
|
31
|
-
"Extension: {0}",
|
|
32
|
-
this._extension.displayName
|
|
33
|
-
));
|
|
34
|
-
}
|
|
35
|
-
matches(other) {
|
|
36
|
-
if (super.matches(other)) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
return other instanceof ExtensionsInput && areSameExtensions(this._extension.identifier, other._extension.identifier);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { ExtensionsInput };
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
-
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
4
|
-
import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
5
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
|
-
import { IExtensionManagementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
7
|
-
import { IWorkbenchExtensionEnablementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement';
|
|
8
|
-
import { IExtensionRecommendationsService } from 'vscode/vscode/vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
|
|
9
|
-
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
10
|
-
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
11
|
-
import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
12
|
-
import { Severity, INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
13
|
-
|
|
14
|
-
let KeymapExtensions = class KeymapExtensions extends Disposable {
|
|
15
|
-
constructor(instantiationService, extensionEnablementService, tipsService, lifecycleService, notificationService) {
|
|
16
|
-
super();
|
|
17
|
-
this.instantiationService = instantiationService;
|
|
18
|
-
this.extensionEnablementService = extensionEnablementService;
|
|
19
|
-
this.tipsService = tipsService;
|
|
20
|
-
this.notificationService = notificationService;
|
|
21
|
-
this._register(lifecycleService.onDidShutdown(() => this.dispose()));
|
|
22
|
-
this._register(instantiationService.invokeFunction(onExtensionChanged)((identifiers => {
|
|
23
|
-
Promise.all(( identifiers.map(identifier => this.checkForOtherKeymaps(identifier))))
|
|
24
|
-
.then(undefined, onUnexpectedError);
|
|
25
|
-
})));
|
|
26
|
-
}
|
|
27
|
-
checkForOtherKeymaps(extensionIdentifier) {
|
|
28
|
-
return this.instantiationService.invokeFunction(getInstalledExtensions).then(extensions => {
|
|
29
|
-
const keymaps = extensions.filter(extension => isKeymapExtension(this.tipsService, extension));
|
|
30
|
-
const extension = keymaps.find(extension => areSameExtensions(extension.identifier, extensionIdentifier));
|
|
31
|
-
if (extension && extension.globallyEnabled) {
|
|
32
|
-
const otherKeymaps = keymaps.filter(extension => !areSameExtensions(extension.identifier, extensionIdentifier) && extension.globallyEnabled);
|
|
33
|
-
if (otherKeymaps.length) {
|
|
34
|
-
return this.promptForDisablingOtherKeymaps(extension, otherKeymaps);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return undefined;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
promptForDisablingOtherKeymaps(newKeymap, oldKeymaps) {
|
|
41
|
-
const onPrompt = (confirmed) => {
|
|
42
|
-
if (confirmed) {
|
|
43
|
-
this.extensionEnablementService.setEnablement(( oldKeymaps.map(keymap => keymap.local)), 6 );
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
this.notificationService.prompt(Severity.Info, ( localizeWithPath(
|
|
47
|
-
'vs/workbench/contrib/extensions/common/extensionsUtils',
|
|
48
|
-
'disableOtherKeymapsConfirmation',
|
|
49
|
-
"Disable other keymaps ({0}) to avoid conflicts between keybindings?",
|
|
50
|
-
( oldKeymaps.map(k => `'${k.local.manifest.displayName}'`)).join(', ')
|
|
51
|
-
)), [{
|
|
52
|
-
label: ( localizeWithPath('vs/workbench/contrib/extensions/common/extensionsUtils', 'yes', "Yes")),
|
|
53
|
-
run: () => onPrompt(true)
|
|
54
|
-
}, {
|
|
55
|
-
label: ( localizeWithPath('vs/workbench/contrib/extensions/common/extensionsUtils', 'no', "No")),
|
|
56
|
-
run: () => onPrompt(false)
|
|
57
|
-
}]);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
KeymapExtensions = ( __decorate([
|
|
61
|
-
( __param(0, IInstantiationService)),
|
|
62
|
-
( __param(1, IWorkbenchExtensionEnablementService)),
|
|
63
|
-
( __param(2, IExtensionRecommendationsService)),
|
|
64
|
-
( __param(3, ILifecycleService)),
|
|
65
|
-
( __param(4, INotificationService))
|
|
66
|
-
], KeymapExtensions));
|
|
67
|
-
function onExtensionChanged(accessor) {
|
|
68
|
-
const extensionService = accessor.get(IExtensionManagementService);
|
|
69
|
-
const extensionEnablementService = accessor.get(IWorkbenchExtensionEnablementService);
|
|
70
|
-
const onDidInstallExtensions = Event.chain(extensionService.onDidInstallExtensions, $ => ( $.filter(e => ( e.some(({ operation }) => operation === 2 )))
|
|
71
|
-
.map(e => ( e.map(({ identifier }) => identifier)))));
|
|
72
|
-
return Event.debounce(Event.any(Event.any(onDidInstallExtensions, ( Event.map(extensionService.onDidUninstallExtension, e => [e.identifier]))), ( Event.map(
|
|
73
|
-
extensionEnablementService.onEnablementChanged,
|
|
74
|
-
extensions => ( extensions.map(e => e.identifier))
|
|
75
|
-
))), (result, identifiers) => {
|
|
76
|
-
result = result || [];
|
|
77
|
-
for (const identifier of identifiers) {
|
|
78
|
-
if (( result.some(l => !areSameExtensions(l, identifier)))) {
|
|
79
|
-
result.push(identifier);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
async function getInstalledExtensions(accessor) {
|
|
86
|
-
const extensionService = accessor.get(IExtensionManagementService);
|
|
87
|
-
const extensionEnablementService = accessor.get(IWorkbenchExtensionEnablementService);
|
|
88
|
-
const extensions = await extensionService.getInstalled();
|
|
89
|
-
return ( extensions.map(extension => {
|
|
90
|
-
return {
|
|
91
|
-
identifier: extension.identifier,
|
|
92
|
-
local: extension,
|
|
93
|
-
globallyEnabled: extensionEnablementService.isEnabled(extension)
|
|
94
|
-
};
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
97
|
-
function isKeymapExtension(tipsService, extension) {
|
|
98
|
-
const cats = extension.local.manifest.categories;
|
|
99
|
-
return cats && cats.indexOf('Keymaps') !== -1 || ( tipsService.getKeymapRecommendations().some(
|
|
100
|
-
extensionId => areSameExtensions({ id: extensionId }, extension.local.identifier)
|
|
101
|
-
));
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export { KeymapExtensions, getInstalledExtensions };
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { hookDomPurifyHrefAndSrcSanitizer, basicMarkupHtmlTags } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
2
|
-
import * as dompurify from 'monaco-editor/esm/vs/base/browser/dompurify/dompurify.js';
|
|
3
|
-
import { allowedMarkdownAttr } from 'monaco-editor/esm/vs/base/browser/markdownRenderer.js';
|
|
4
|
-
import { marked } from 'monaco-editor/esm/vs/base/common/marked/marked.js';
|
|
5
|
-
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
6
|
-
import { tokenizeToString } from 'monaco-editor/esm/vs/editor/common/languages/textToHtmlTokenizer.js';
|
|
7
|
-
import { escape } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
8
|
-
|
|
9
|
-
const DEFAULT_MARKDOWN_STYLES = `
|
|
10
|
-
body {
|
|
11
|
-
padding: 10px 20px;
|
|
12
|
-
line-height: 22px;
|
|
13
|
-
max-width: 882px;
|
|
14
|
-
margin: 0 auto;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
body *:last-child {
|
|
18
|
-
margin-bottom: 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
img {
|
|
22
|
-
max-width: 100%;
|
|
23
|
-
max-height: 100%;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
a {
|
|
27
|
-
text-decoration: none;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
a:hover {
|
|
31
|
-
text-decoration: underline;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
a:focus,
|
|
35
|
-
input:focus,
|
|
36
|
-
select:focus,
|
|
37
|
-
textarea:focus {
|
|
38
|
-
outline: 1px solid -webkit-focus-ring-color;
|
|
39
|
-
outline-offset: -1px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
hr {
|
|
43
|
-
border: 0;
|
|
44
|
-
height: 2px;
|
|
45
|
-
border-bottom: 2px solid;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
h1 {
|
|
49
|
-
padding-bottom: 0.3em;
|
|
50
|
-
line-height: 1.2;
|
|
51
|
-
border-bottom-width: 1px;
|
|
52
|
-
border-bottom-style: solid;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
h1, h2, h3 {
|
|
56
|
-
font-weight: normal;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
table {
|
|
60
|
-
border-collapse: collapse;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
th {
|
|
64
|
-
text-align: left;
|
|
65
|
-
border-bottom: 1px solid;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
th,
|
|
69
|
-
td {
|
|
70
|
-
padding: 5px 10px;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
table > tbody > tr + tr > td {
|
|
74
|
-
border-top-width: 1px;
|
|
75
|
-
border-top-style: solid;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
blockquote {
|
|
79
|
-
margin: 0 7px 0 5px;
|
|
80
|
-
padding: 0 16px 0 10px;
|
|
81
|
-
border-left-width: 5px;
|
|
82
|
-
border-left-style: solid;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
code {
|
|
86
|
-
font-family: "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
pre {
|
|
90
|
-
padding: 16px;
|
|
91
|
-
border-radius: 3px;
|
|
92
|
-
overflow: auto;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
pre code {
|
|
96
|
-
font-family: var(--vscode-editor-font-family);
|
|
97
|
-
font-weight: var(--vscode-editor-font-weight);
|
|
98
|
-
font-size: var(--vscode-editor-font-size);
|
|
99
|
-
line-height: 1.5;
|
|
100
|
-
color: var(--vscode-editor-foreground);
|
|
101
|
-
tab-size: 4;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.monaco-tokenized-source {
|
|
105
|
-
white-space: pre;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/** Theming */
|
|
109
|
-
|
|
110
|
-
.pre {
|
|
111
|
-
background-color: var(--vscode-textCodeBlock-background);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.vscode-high-contrast h1 {
|
|
115
|
-
border-color: rgb(0, 0, 0);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.vscode-light th {
|
|
119
|
-
border-color: rgba(0, 0, 0, 0.69);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.vscode-dark th {
|
|
123
|
-
border-color: rgba(255, 255, 255, 0.69);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.vscode-light h1,
|
|
127
|
-
.vscode-light hr,
|
|
128
|
-
.vscode-light td {
|
|
129
|
-
border-color: rgba(0, 0, 0, 0.18);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.vscode-dark h1,
|
|
133
|
-
.vscode-dark hr,
|
|
134
|
-
.vscode-dark td {
|
|
135
|
-
border-color: rgba(255, 255, 255, 0.18);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
@media (forced-colors: active) and (prefers-color-scheme: light){
|
|
139
|
-
body {
|
|
140
|
-
forced-color-adjust: none;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
@media (forced-colors: active) and (prefers-color-scheme: dark){
|
|
145
|
-
body {
|
|
146
|
-
forced-color-adjust: none;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
`;
|
|
150
|
-
const allowedProtocols = [Schemas.http, Schemas.https, Schemas.command];
|
|
151
|
-
function sanitize(documentContent, allowUnknownProtocols) {
|
|
152
|
-
const hook = hookDomPurifyHrefAndSrcSanitizer(allowedProtocols, true);
|
|
153
|
-
try {
|
|
154
|
-
return dompurify.sanitize(documentContent, {
|
|
155
|
-
...{
|
|
156
|
-
ALLOWED_TAGS: [
|
|
157
|
-
...basicMarkupHtmlTags,
|
|
158
|
-
'checkbox',
|
|
159
|
-
'checklist',
|
|
160
|
-
],
|
|
161
|
-
ALLOWED_ATTR: [
|
|
162
|
-
...allowedMarkdownAttr,
|
|
163
|
-
'data-command', 'name', 'id', 'role', 'tabindex',
|
|
164
|
-
'x-dispatch',
|
|
165
|
-
'required', 'checked', 'placeholder', 'when-checked', 'checked-on',
|
|
166
|
-
],
|
|
167
|
-
},
|
|
168
|
-
...(allowUnknownProtocols ? { ALLOW_UNKNOWN_PROTOCOLS: true } : {}),
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
finally {
|
|
172
|
-
hook.dispose();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
async function renderMarkdownDocument(text, extensionService, languageService, shouldSanitize = true, allowUnknownProtocols = false, token) {
|
|
176
|
-
const highlight = (code, lang, callback) => {
|
|
177
|
-
if (!callback) {
|
|
178
|
-
return code;
|
|
179
|
-
}
|
|
180
|
-
if (typeof lang !== 'string') {
|
|
181
|
-
callback(null, `<code>${escape(code)}</code>`);
|
|
182
|
-
return '';
|
|
183
|
-
}
|
|
184
|
-
extensionService.whenInstalledExtensionsRegistered().then(async () => {
|
|
185
|
-
if (token?.isCancellationRequested) {
|
|
186
|
-
callback(null, '');
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
const languageId = languageService.getLanguageIdByLanguageName(lang);
|
|
190
|
-
const html = await tokenizeToString(languageService, code, languageId);
|
|
191
|
-
callback(null, `<code>${html}</code>`);
|
|
192
|
-
});
|
|
193
|
-
return '';
|
|
194
|
-
};
|
|
195
|
-
return ( new Promise((resolve, reject) => {
|
|
196
|
-
marked(text, { highlight }, (err, value) => err ? reject(err) : resolve(value));
|
|
197
|
-
})).then(raw => {
|
|
198
|
-
if (shouldSanitize) {
|
|
199
|
-
return sanitize(raw, allowUnknownProtocols);
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
return raw;
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export { DEFAULT_MARKDOWN_STYLES, renderMarkdownDocument };
|