Fix clickable being announced for all modelview text (#8384)

* Fix clickable being announced for all modelview text

* Remove unused method

* Move API changes into proposed
This commit is contained in:
Charles Gagnon
2019-11-22 11:01:46 -08:00
committed by GitHub
parent fc0c05c755
commit 52de2b4751
7 changed files with 45 additions and 32 deletions

View File

@@ -10,12 +10,12 @@ import {
import * as azdata from 'azdata';
import { IComponent, IComponentDescriptor, IModelStore } from 'sql/workbench/browser/modelComponents/interfaces';
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/workbench/browser/modelComponents/interfaces';
import { TitledComponent } from 'sql/workbench/browser/modelComponents/titledComponent';
@Component({
selector: 'modelview-hyperlink',
template: `<a [href]="getUrl()" [title]="title" target="blank">{{getLabel()}}</a>`
template: `<a [href]="getUrl()" [title]="title" target="blank" (click)="onClick()">{{getLabel()}}</a>`
})
export default class HyperlinkComponent extends TitledComponent implements IComponent, OnDestroy, AfterViewInit {
@Input() descriptor: IComponentDescriptor;
@@ -65,4 +65,14 @@ export default class HyperlinkComponent extends TitledComponent implements IComp
public getUrl(): string {
return this.url;
}
public onClick(): boolean {
this.fireEvent({
eventType: ComponentEventType.onDidClick,
args: undefined
});
// If we don't have a URL then return false since that just defaults to the URL for the workbench. We assume
// if a blank url is specified then the caller is handling the click themselves.
return !!this.url;
}
}