mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Links handling in commands (#15118)
* format * update external options type * add command flag for command * Allow commands in Notebooks Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -78,7 +78,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
|
||||
private onDidClickLink(handle: extHostProtocol.WebviewHandle, link: string): void {
|
||||
const webview = this.getWebview(handle);
|
||||
if (this.isSupportedLink(webview, URI.parse(link))) {
|
||||
this._openerService.open(link, { fromUserGesture: true });
|
||||
this._openerService.open(link, { fromUserGesture: true, allowContributedOpeners: true, allowCommands: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ export class NotificationTemplateRenderer extends Disposable {
|
||||
private renderMessage(notification: INotificationViewItem): boolean {
|
||||
clearNode(this.template.message);
|
||||
this.template.message.appendChild(NotificationMessageRenderer.render(notification.message, {
|
||||
callback: link => this.openerService.open(URI.parse(link)),
|
||||
callback: link => this.openerService.open(URI.parse(link), { allowCommands: true }),
|
||||
toDispose: this.inputDisposables
|
||||
}));
|
||||
|
||||
|
||||
@@ -581,7 +581,7 @@ export abstract class ViewPane extends Pane implements IView {
|
||||
button.label = node.label;
|
||||
button.onDidClick(_ => {
|
||||
this.telemetryService.publicLog2<{ viewId: string, uri: string }, WelcomeActionClassification>('views.welcomeAction', { viewId: this.id, uri: node.href });
|
||||
this.openerService.open(node.href);
|
||||
this.openerService.open(node.href, { allowCommands: true });
|
||||
}, null, disposables);
|
||||
disposables.add(button);
|
||||
disposables.add(attachButtonStyler(button, this.themeService));
|
||||
|
||||
@@ -127,7 +127,7 @@ export class CommentNodeRenderer implements IListRenderer<ITreeNode<CommentNode>
|
||||
inline: true,
|
||||
actionHandler: {
|
||||
callback: (content) => {
|
||||
this.openerService.open(content).catch(onUnexpectedError);
|
||||
this.openerService.open(content, { allowCommands: node.element.comment.body.isTrusted }).catch(onUnexpectedError);
|
||||
},
|
||||
disposeables: disposables
|
||||
}
|
||||
|
||||
@@ -625,11 +625,12 @@ export class ExtensionEditor extends EditorPane {
|
||||
return;
|
||||
}
|
||||
// Only allow links with specific schemes
|
||||
if (matchesScheme(link, Schemas.http) || matchesScheme(link, Schemas.https) || matchesScheme(link, Schemas.mailto)
|
||||
|| (matchesScheme(link, Schemas.command) && URI.parse(link).path === ShowCurrentReleaseNotesActionId)
|
||||
) {
|
||||
if (matchesScheme(link, Schemas.http) || matchesScheme(link, Schemas.https) || matchesScheme(link, Schemas.mailto)) {
|
||||
this.openerService.open(link);
|
||||
}
|
||||
if (matchesScheme(link, Schemas.command) && URI.parse(link).path === ShowCurrentReleaseNotesActionId) {
|
||||
this.openerService.open(link, { allowCommands: true }); // TODO@sandy081 use commands service
|
||||
}
|
||||
}, null, this.contentDisposables));
|
||||
|
||||
return webview;
|
||||
|
||||
@@ -430,7 +430,7 @@ class MarkerWidget extends Disposable {
|
||||
|
||||
this._register(onOpen(e => {
|
||||
dom.EventHelper.stop(e, true);
|
||||
this._openerService.open(codeUri);
|
||||
this._openerService.open(codeUri, { allowCommands: true });
|
||||
}));
|
||||
|
||||
const code = new HighlightedLabel(dom.append(this._codeLink, dom.$('.marker-code')), false);
|
||||
|
||||
@@ -424,7 +424,7 @@ var requirejs = (function() {
|
||||
|
||||
if (matchesScheme(link, Schemas.http) || matchesScheme(link, Schemas.https) || matchesScheme(link, Schemas.mailto)
|
||||
|| matchesScheme(link, Schemas.command)) {
|
||||
this.openerService.open(link, { fromUserGesture: true });
|
||||
this.openerService.open(link, { fromUserGesture: true, allowContributedOpeners: true, allowCommands: true });
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
@@ -755,7 +755,7 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
|
||||
};
|
||||
this._onDidClickSettingLink.fire(e);
|
||||
} else {
|
||||
this._openerService.open(content).catch(onUnexpectedError);
|
||||
this._openerService.open(content, { allowCommands: true }).catch(onUnexpectedError);
|
||||
}
|
||||
},
|
||||
disposeables
|
||||
|
||||
@@ -365,7 +365,7 @@ class HelpItem extends HelpItemBase {
|
||||
}
|
||||
|
||||
protected async takeAction(extensionDescription: IExtensionDescription, url: string): Promise<void> {
|
||||
await this.openerService.open(URI.parse(url));
|
||||
await this.openerService.open(URI.parse(url), { allowCommands: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ export class WalkThroughPart extends EditorPane {
|
||||
this.notificationService.info(localize('walkThrough.gitNotFound', "It looks like Git is not installed on your system."));
|
||||
return;
|
||||
}
|
||||
this.openerService.open(this.addFrom(uri));
|
||||
this.openerService.open(this.addFrom(uri), { allowCommands: true });
|
||||
}
|
||||
|
||||
private addFrom(uri: URI) {
|
||||
|
||||
Reference in New Issue
Block a user