Fix: Markdown Preview scroll remains same after clicking on some other link #78465

Improves the behavior on how markdown preview behaves when clicking a link
This commit is contained in:
Salvador Cabrera
2019-08-19 09:35:06 -05:00
parent 98467c3b7c
commit 34339f92c4
4 changed files with 60 additions and 13 deletions

View File

@@ -134,3 +134,12 @@ export function getEditorLineNumberForPageOffset(offset: number) {
}
return null;
}
/**
* Try to find the html element by using a fragment id
*/
export function getLineElementForFragment(fragment: string): CodeLineElement | undefined {
return getCodeLineElements().find((element) => {
return element.element.id === fragment;
});
}