mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Trim pathname for link callout file paths (#15716)
* Don't use pathname for link URLs * Trim pathname instead
This commit is contained in:
@@ -351,10 +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) {
|
||||||
if (document.getSelection().anchorNode.parentNode['protocol'] === 'file:') {
|
const parentNode = document.getSelection().anchorNode.parentNode as HTMLAnchorElement;
|
||||||
return document.getSelection().anchorNode.parentNode['pathname'] || '';
|
if (parentNode.protocol === 'file:') {
|
||||||
|
// Pathname starts with / per https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/pathname so trim it off
|
||||||
|
return parentNode.pathname?.slice(1) || '';
|
||||||
} else {
|
} else {
|
||||||
return document.getSelection().anchorNode.parentNode['href'] || '';
|
return parentNode.href || '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const editorControl = this.getCellEditorControl();
|
const editorControl = this.getCellEditorControl();
|
||||||
|
|||||||
Reference in New Issue
Block a user