提交 b005f534 编写于 作者: J João Moreno

support codicons in welcome view buttons

上级 888f89b4
......@@ -5,12 +5,14 @@
.monaco-text-button {
box-sizing: border-box;
display: inline-block;
display: flex;
width: 100%;
padding: 4px;
text-align: center;
cursor: pointer;
outline-offset: 2px !important;
justify-content: center;
align-items: center;
}
.monaco-text-button:hover {
......@@ -21,3 +23,7 @@
opacity: 0.4;
cursor: default;
}
.monaco-button > .codicon {
margin: 0 0.2em;
}
......@@ -12,9 +12,12 @@ import { mixin } from 'vs/base/common/objects';
import { Event as BaseEvent, Emitter } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { Gesture, EventType } from 'vs/base/browser/touch';
import { renderCodicons } from 'vs/base/common/codicons';
import { escape } from 'vs/base/common/strings';
export interface IButtonOptions extends IButtonStyles {
title?: boolean | string;
readonly title?: boolean | string;
readonly supportCodicons?: boolean;
}
export interface IButtonStyles {
......@@ -149,7 +152,11 @@ export class Button extends Disposable {
if (!DOM.hasClass(this._element, 'monaco-text-button')) {
DOM.addClass(this._element, 'monaco-text-button');
}
this._element.textContent = value;
if (this.options.supportCodicons) {
this._element.innerHTML = renderCodicons(escape(value));
} else {
this._element.textContent = value;
}
if (typeof this.options.title === 'string') {
this._element.title = this.options.title;
} else if (this.options.title) {
......
......@@ -66,7 +66,6 @@
max-width: 260px;
margin-left: auto;
margin-right: auto;
display: block;
}
.monaco-workbench .pane > .pane-body .welcome-view-content {
......
......@@ -458,7 +458,7 @@ export abstract class ViewPane extends Pane implements IView {
if (linkedText.nodes.length === 1 && typeof linkedText.nodes[0] !== 'string') {
const node = linkedText.nodes[0];
const button = new Button(this.viewWelcomeContainer, { title: node.title });
const button = new Button(this.viewWelcomeContainer, { title: node.title, supportCodicons: true });
button.label = node.label;
button.onDidClick(_ => {
this.telemetryService.publicLog2<{ viewId: string, uri: string }, WelcomeActionClassification>('views.welcomeAction', { viewId: this.id, uri: node.href });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册