mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
This commit partially reverts changes from 4da3e7da. While the consolidation of reStructuredText support into a single module is retained, it needs to be available as a plugin since some IDEs do not include it by default but can still benefit from its capabilities. Merge-request: IJ-MR-139650 Merged-by: Andrey Lisin <andrey.lisin@jetbrains.com> GitOrigin-RevId: bc5cde2970a0760e32ceaee61ceef8427e8f8fe5
21 lines
726 B
JavaScript
21 lines
726 B
JavaScript
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
|
window.__IntelliJTools = {};
|
|
window.onclick = e => {
|
|
if (e.target.tagName !== "A") return true;
|
|
|
|
e.stopPropagation();
|
|
e.preventDefault();
|
|
|
|
const href = e.target.href;
|
|
if (href.indexOf("#") !== -1 && !/^https?:\/\//i.test(href)) { // internal link
|
|
const elementId = href.split('#')[1];
|
|
const elementById = window.document.getElementById(elementId);
|
|
if (elementById) {
|
|
elementById.scrollIntoViewIfNeeded();
|
|
}
|
|
return;
|
|
}
|
|
if (window.__IntelliJTools.openInBrowserCallback !== undefined) {
|
|
window.__IntelliJTools.openInBrowserCallback(href);
|
|
}
|
|
}; |