提交 3d5e0586 编写于 作者: J Johannes Rieken

support only custom title of preview pane, #2351

上级 63e98ebb
......@@ -70,7 +70,7 @@ suite('commands namespace tests', () => {
});
let virtualDocumentUri = Uri.parse('speciale://authority/path');
let title = { label: 'A title', description: 'A description' };
let title = 'A title';
return commands.executeCommand('vscode.previewHtml', virtualDocumentUri, title).then(success => {
assert.ok(success);
......@@ -101,6 +101,6 @@ suite('commands namespace tests', () => {
let c = commands.executeCommand('vscode.diff').then(() => assert.ok(false), () => assert.ok(true));
let d = commands.executeCommand('vscode.diff', 1, 2, 3).then(() => assert.ok(false), () => assert.ok(true));
return Promise.all([a, b, c]);
return Promise.all([a, b, c, d]);
});
});
......@@ -151,11 +151,11 @@ class ExtHostApiCommands {
});
this._register('vscode.previewHtml', (uri: URI, position?: vscode.ViewColumn, title?: { label?: string, description?: string }) => {
this._register('vscode.previewHtml', (uri: URI, position?: vscode.ViewColumn, label?: string) => {
return this._commands.executeCommand('_workbench.previewHtml',
uri,
typeof position === 'number' && typeConverters.fromViewColumn(position),
title);
label);
}, {
description: `
Render the html of the resource in an editor view.
......@@ -173,7 +173,7 @@ class ExtHostApiCommands {
args: [
{ name: 'uri', description: 'Uri of the resource to preview.', constraint: value => value instanceof URI || typeof value === 'string' },
{ name: 'column', description: '(optional) Column in which to preview.' },
{ name: 'title', description: '(optional) An object literal defining the label and description, e.g. `{ label: "My Label" description: "My Description" }`' }
{ name: 'label', description: '(optional) An human readable string that is used as title for the preview.', constraint: v => typeof v === 'string' || typeof v === 'undefined' }
]
});
......
......@@ -28,11 +28,11 @@ import {SyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
KeybindingsRegistry.registerCommandDesc({
id: '_workbench.previewHtml',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(0),
handler(accessor: ServicesAccessor, resource: URI | string, position?: EditorPosition, title?: { label?: string; description?: string }) {
handler(accessor: ServicesAccessor, resource: URI | string, position?: EditorPosition, label?: string) {
let uri = resource instanceof URI ? resource : URI.parse(resource);
let {label, description} = !title ? { label: uri.fsPath, description: void 0 } : title;
let input = accessor.get(IInstantiationService).createInstance(HtmlInput, label, description, uri);
label = label || uri.fsPath;
let input = accessor.get(IInstantiationService).createInstance(HtmlInput, label, '', uri);
return accessor.get(IWorkbenchEditorService)
.openEditor(input, { pinned: true }, position)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册