提交 0532a342 编写于 作者: M Matt Bierner

Fix markdown preview section links

Fixes #40877
上级 bfb8ac5f
......@@ -252,10 +252,13 @@
const baseElement = document.getElementsByTagName('base')[0];
/** @type {any} */
/** @type {*} */
let node = event.target;
while (node) {
if (node.tagName && node.tagName.toLowerCase() === 'a' && node.href) {
if (node.getAttribute('href').startsWith('#')) {
break;
}
if (node.href.startsWith('file://')) {
const [path, fragment] = node.href.replace(/^file:\/\//i, '').split('#');
postMessage('_markdown.openDocumentLink', { path, fragment });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册