mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 12:33:35 +01:00
@@ -325,7 +325,7 @@ export class MarkdownPreview {
|
||||
this.forceUpdate = false;
|
||||
|
||||
this.currentVersion = { resource, version: document.version };
|
||||
const content = await this._contentProvider.provideTextDocumentContent(document, this._previewConfigurations, this.line);
|
||||
const content = await this._contentProvider.provideTextDocumentContent(document, this._previewConfigurations, this.line, this.state);
|
||||
if (this._resource === resource) {
|
||||
this.editor.title = MarkdownPreview.getPreviewTitle(this._resource, this._locked);
|
||||
this.editor.webview.html = content;
|
||||
|
||||
@@ -47,7 +47,8 @@ export class MarkdownContentProvider {
|
||||
public async provideTextDocumentContent(
|
||||
markdownDocument: vscode.TextDocument,
|
||||
previewConfigurations: MarkdownPreviewConfigurationManager,
|
||||
initialLine: number | undefined = undefined
|
||||
initialLine: number | undefined = undefined,
|
||||
state?: any
|
||||
): Promise<string> {
|
||||
const sourceUri = markdownDocument.uri;
|
||||
const config = previewConfigurations.loadAndCacheConfiguration(sourceUri);
|
||||
@@ -73,7 +74,10 @@ export class MarkdownContentProvider {
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||
${csp}
|
||||
<meta id="vscode-markdown-preview-data" data-settings="${JSON.stringify(initialData).replace(/"/g, '"')}" data-strings="${JSON.stringify(previewStrings).replace(/"/g, '"')}">
|
||||
<meta id="vscode-markdown-preview-data"
|
||||
data-settings="${JSON.stringify(initialData).replace(/"/g, '"')}"
|
||||
data-strings="${JSON.stringify(previewStrings).replace(/"/g, '"')}"
|
||||
data-state="${JSON.stringify(state || {}).replace(/"/g, '"')}">
|
||||
<script src="${this.extensionResourcePath('pre.js')}" nonce="${nonce}"></script>
|
||||
${this.getStyles(sourceUri, nonce, config)}
|
||||
<base href="${markdownDocument.uri.with({ scheme: 'vscode-resource' }).toString(true)}">
|
||||
|
||||
@@ -94,13 +94,6 @@ export class MarkdownPreviewManager implements vscode.WebviewPanelSerializer {
|
||||
this.registerPreview(preview);
|
||||
}
|
||||
|
||||
public async serializeWebviewPanel(
|
||||
webview: vscode.WebviewPanel,
|
||||
): Promise<any> {
|
||||
const preview = this.previews.find(preview => preview.isWebviewOf(webview));
|
||||
return preview ? preview.state : undefined;
|
||||
}
|
||||
|
||||
private getExistingPreview(
|
||||
resource: vscode.Uri,
|
||||
previewSettings: PreviewSettings
|
||||
|
||||
Reference in New Issue
Block a user