Fixes #9397 Launch onenote links (#9931)

* Fixes #9397 Launch onenote links

* Limit the change to linkhandler directive
This commit is contained in:
Shafiq Ur Rahman
2020-04-13 19:32:42 -07:00
committed by GitHub
parent fc70ddd104
commit a8cf029633

View File

@@ -10,7 +10,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import { onUnexpectedError } from 'vs/base/common/errors';
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({
selector: '[link-handler]',
})
@@ -61,7 +61,12 @@ export class LinkHandlerDirective {
if (uri.fragment && uri.fragment.length > 0 && uri.fsPath === this.workbenchFilePath.fsPath) {
this.notebookService.navigateTo(this.notebookUri, uri.fragment);
} else {
this.openerService.open(uri).catch(onUnexpectedError);
if (this.forceOpenExternal(uri)) {
this.openerService.open(uri, { openExternal: true }).catch(onUnexpectedError);
}
else {
this.openerService.open(uri).catch(onUnexpectedError);
}
}
}
}
@@ -72,4 +77,11 @@ export class LinkHandlerDirective {
}
return !!this.isTrusted && link.scheme === 'command';
}
private forceOpenExternal(link: URI): boolean {
if (link.scheme.toLowerCase() === 'onenote') {
return true;
}
return false;
}
}