mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix CalloutDialog not opening after bad link (#16051)
* fix null parentNode
This commit is contained in:
@@ -351,8 +351,12 @@ export class MarkdownToolbarComponent extends AngularDisposable {
|
|||||||
|
|
||||||
private getCurrentLinkUrl(): string {
|
private getCurrentLinkUrl(): string {
|
||||||
if (this.cellModel.currentMode === CellEditModes.WYSIWYG) {
|
if (this.cellModel.currentMode === CellEditModes.WYSIWYG) {
|
||||||
const parentNode = document.getSelection().anchorNode.parentNode as HTMLAnchorElement;
|
const anchorNode = document.getSelection().anchorNode;
|
||||||
if (parentNode.protocol === 'file:') {
|
if (!anchorNode) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
const parentNode = anchorNode.parentNode as HTMLAnchorElement;
|
||||||
|
if (parentNode?.protocol === 'file:') {
|
||||||
// Pathname starts with / per https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/pathname so trim it off
|
// Pathname starts with / per https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/pathname so trim it off
|
||||||
return parentNode.pathname?.slice(1) || '';
|
return parentNode.pathname?.slice(1) || '';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user