提交 b88a89c9 编写于 作者: M Matt Bierner 提交者: GitHub

Allow markdown preview to scroll past content (#15919)

* Allow markdown preview to scroll past content

Issue #15795

Allows the markdown preview to scroll past its contents, like we do with the editor.

Closes #15795

* Toggle preview scroll beyond using editor.scrollBeyondLastLine
上级 d1e9f733
......@@ -10,6 +10,10 @@ body {
line-height: 22px;
}
body.scrollBeyondLastLine {
margin-bottom: calc(100vh - 22px);
}
img {
max-width: 100%;
max-height: 100%;
......
......@@ -225,6 +225,7 @@ class MDDocumentContentProvider implements vscode.TextDocumentContentProvider {
public provideTextDocumentContent(uri: vscode.Uri): Thenable<string> {
return vscode.workspace.openTextDocument(vscode.Uri.parse(uri.query)).then(document => {
const scrollBeyondLastLine = vscode.workspace.getConfiguration('editor')['scrollBeyondLastLine'];
const head = [].concat(
'<!DOCTYPE html>',
'<html>',
......@@ -235,7 +236,7 @@ class MDDocumentContentProvider implements vscode.TextDocumentContentProvider {
this.computeCustomStyleSheetIncludes(uri),
`<base href="${document.uri.toString(true)}">`,
'</head>',
'<body>'
`<body class="${scrollBeyondLastLine ? 'scrollBeyondLastLine' : ''}">`
).join('\n');
const body = this._renderer.render(this.getDocumentContentForPreview(document));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册