提交 eba0fc96 编写于 作者: M Matt Bierner

Fixes #19192 - markdown scroll selection sync setting disabling double click and other features

上级 d0163a14
......@@ -161,39 +161,39 @@
scrollToRevealSourceLine(line);
}
}, false);
}
document.addEventListener('dblclick', e => {
if (!window.initialData.doubleClickToSwitchToEditor) {
return;
}
document.addEventListener('dblclick', e => {
if (!window.initialData.doubleClickToSwitchToEditor) {
return;
}
const offset = e.pageY;
const line = getEditorLineNumberForPageOffset(offset);
if (!isNaN(line)) {
const args = [window.initialData.source, line];
window.parent.postMessage({
command: "did-click-link",
data: `command:_markdown.didClick?${encodeURIComponent(JSON.stringify(args))}`
}, "file://");
}
});
if (window.initialData.scrollEditorWithPreview) {
window.addEventListener('scroll', throttle(() => {
if (scrollDisabled) {
scrollDisabled = false;
} else {
const line = getEditorLineNumberForPageOffset(window.scrollY);
if (!isNaN(line)) {
const args = [window.initialData.source, line];
window.parent.postMessage({
command: "did-click-link",
data: `command:_markdown.revealLine?${encodeURIComponent(JSON.stringify(args))}`
}, "file://");
}
}
}, 50));
const offset = e.pageY;
const line = getEditorLineNumberForPageOffset(offset);
if (!isNaN(line)) {
const args = [window.initialData.source, line];
window.parent.postMessage({
command: "did-click-link",
data: `command:_markdown.didClick?${encodeURIComponent(JSON.stringify(args))}`
}, "file://");
}
});
if (window.initialData.scrollEditorWithPreview) {
window.addEventListener('scroll', throttle(() => {
if (scrollDisabled) {
scrollDisabled = false;
} else {
const line = getEditorLineNumberForPageOffset(window.scrollY);
if (!isNaN(line)) {
const args = [window.initialData.source, line];
window.parent.postMessage({
command: "did-click-link",
data: `command:_markdown.revealLine?${encodeURIComponent(JSON.stringify(args))}`
}, "file://");
}
}
}, 50));
}
}());
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册