mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
* Fixes #9397 Launch onenote links * Limit the change to linkhandler directive
This commit is contained in:
@@ -10,7 +10,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
|
|||||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||||
|
|
||||||
const knownSchemes = new Set(['http', 'https', 'file', 'mailto', 'data', 'azuredatastudio', 'azuredatastudio-insiders', 'vscode', 'vscode-insiders', 'vscode-resource']);
|
const knownSchemes = new Set(['http', 'https', 'file', 'mailto', 'data', 'azuredatastudio', 'azuredatastudio-insiders', 'vscode', 'vscode-insiders', 'vscode-resource', 'onenote']);
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[link-handler]',
|
selector: '[link-handler]',
|
||||||
})
|
})
|
||||||
@@ -61,10 +61,15 @@ export class LinkHandlerDirective {
|
|||||||
if (uri.fragment && uri.fragment.length > 0 && uri.fsPath === this.workbenchFilePath.fsPath) {
|
if (uri.fragment && uri.fragment.length > 0 && uri.fsPath === this.workbenchFilePath.fsPath) {
|
||||||
this.notebookService.navigateTo(this.notebookUri, uri.fragment);
|
this.notebookService.navigateTo(this.notebookUri, uri.fragment);
|
||||||
} else {
|
} else {
|
||||||
|
if (this.forceOpenExternal(uri)) {
|
||||||
|
this.openerService.open(uri, { openExternal: true }).catch(onUnexpectedError);
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.openerService.open(uri).catch(onUnexpectedError);
|
this.openerService.open(uri).catch(onUnexpectedError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private isSupportedLink(link: URI): boolean {
|
private isSupportedLink(link: URI): boolean {
|
||||||
if (knownSchemes.has(link.scheme)) {
|
if (knownSchemes.has(link.scheme)) {
|
||||||
@@ -72,4 +77,11 @@ export class LinkHandlerDirective {
|
|||||||
}
|
}
|
||||||
return !!this.isTrusted && link.scheme === 'command';
|
return !!this.isTrusted && link.scheme === 'command';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private forceOpenExternal(link: URI): boolean {
|
||||||
|
if (link.scheme.toLowerCase() === 'onenote') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user