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
This commit is contained in:
Matt Bierner 2016-11-29 14:51:15 -08:00 committed by GitHub
parent d1e9f7339e
commit b88a89c996
2 changed files with 6 additions and 1 deletions

View file

@ -10,6 +10,10 @@ body {
line-height: 22px;
}
body.scrollBeyondLastLine {
margin-bottom: calc(100vh - 22px);
}
img {
max-width: 100%;
max-height: 100%;

View file

@ -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));