mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
parent
27a17935b8
commit
18146e8c71
|
@ -14,15 +14,9 @@ export class ShowSourceCommand implements Command {
|
|||
private readonly previewManager: MarkdownPreviewManager
|
||||
) { }
|
||||
|
||||
|
||||
public execute(docUri?: vscode.Uri) {
|
||||
if (!docUri) {
|
||||
return vscode.commands.executeCommand('workbench.action.navigateBack');
|
||||
}
|
||||
|
||||
const resource = this.previewManager.getResourceForPreview(docUri);
|
||||
if (resource) {
|
||||
return vscode.workspace.openTextDocument(resource)
|
||||
public execute() {
|
||||
if (this.previewManager.activePreviewResource) {
|
||||
return vscode.workspace.openTextDocument(this.previewManager.activePreviewResource)
|
||||
.then(document => vscode.window.showTextDocument(document));
|
||||
}
|
||||
return undefined;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { Command } from '../commandManager';
|
||||
import { MarkdownPreviewManager } from '../features/previewManager';
|
||||
|
||||
|
@ -14,7 +13,7 @@ export class ToggleLockCommand implements Command {
|
|||
private readonly previewManager: MarkdownPreviewManager
|
||||
) { }
|
||||
|
||||
public execute(previewUri?: vscode.Uri) {
|
||||
this.previewManager.toggleLock(previewUri);
|
||||
public execute() {
|
||||
this.previewManager.toggleLock();
|
||||
}
|
||||
}
|
|
@ -76,13 +76,8 @@ export class MarkdownPreviewManager {
|
|||
return this.activePreview && this.activePreview.resource;
|
||||
}
|
||||
|
||||
public getResourceForPreview(previewUri: vscode.Uri): vscode.Uri | undefined {
|
||||
const preview = this.getPreviewWithUri(previewUri);
|
||||
return preview && preview.resource;
|
||||
}
|
||||
|
||||
public toggleLock(previewUri?: vscode.Uri) {
|
||||
const preview = previewUri ? this.getPreviewWithUri(previewUri) : this.activePreview;
|
||||
public toggleLock() {
|
||||
const preview = this.activePreview;
|
||||
if (preview) {
|
||||
preview.toggleLock();
|
||||
|
||||
|
@ -103,10 +98,6 @@ export class MarkdownPreviewManager {
|
|||
preview.matchesResource(resource, previewSettings.previewColumn, previewSettings.locked));
|
||||
}
|
||||
|
||||
private getPreviewWithUri(previewUri: vscode.Uri): MarkdownPreview | undefined {
|
||||
return this.previews.find(preview => preview.uri.toString() === previewUri.toString());
|
||||
}
|
||||
|
||||
private createNewPreview(
|
||||
resource: vscode.Uri,
|
||||
previewSettings: PreviewSettings
|
||||
|
|
Loading…
Reference in a new issue