mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 11:10:48 +00:00
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:
parent
d1e9f7339e
commit
b88a89c996
2 changed files with 6 additions and 1 deletions
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in a new issue