提交 ea01b394 编写于 作者: M Matt Bierner

Extract renderMarkdown

上级 af47c6c2
......@@ -576,10 +576,7 @@ export class ExtensionEditor extends BaseEditor {
private async openMarkdown(cacheResult: CacheResult<string>, noContentCopy: string, template: IExtensionEditorTemplate): Promise<IActiveElement> {
try {
const contents = await this.loadContents(() => cacheResult, template);
const content = await renderMarkdownDocument(contents, this.extensionService, this.modeService);
const documentContent = await this.renderBody(content);
const body = removeEmbeddedSVGs(documentContent);
const body = await this.renderMarkdown(cacheResult, template);
const webviewElement = this.contentDisposables.add(this.webviewService.createWebviewEditorOverlay('extensionEditor', {
enableFindWidget: true,
......@@ -587,6 +584,7 @@ export class ExtensionEditor extends BaseEditor {
webviewElement.claim(this);
webviewElement.layoutWebviewOverElement(template.content);
webviewElement.html = body;
this.contentDisposables.add(webviewElement.onDidFocus(() => this.fireOnDidFocus()));
const removeLayoutParticipant = arrays.insert(this.layoutParticipants, {
......@@ -597,7 +595,6 @@ export class ExtensionEditor extends BaseEditor {
});
this.contentDisposables.add(toDisposable(removeLayoutParticipant));
webviewElement.html = body;
this.contentDisposables.add(webviewElement.onDidClickLink(link => {
if (!link) {
......@@ -618,6 +615,13 @@ export class ExtensionEditor extends BaseEditor {
}
}
private async renderMarkdown(cacheResult: CacheResult<string>, template: IExtensionEditorTemplate) {
const contents = await this.loadContents(() => cacheResult, template);
const content = await renderMarkdownDocument(contents, this.extensionService, this.modeService);
const documentContent = await this.renderBody(content);
return removeEmbeddedSVGs(documentContent);
}
private async renderBody(body: string): Promise<string> {
const nonce = generateUuid();
const colorMap = TokenizationRegistry.getColorMap();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册