mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 21:25:47 +01:00
Fix ctrl-click for docs
ctrl-clicking doc links leads to dev branch docs if you are playing on dev branch. Makes this behavior usable before stable branch gets updated.
This commit is contained in:
parent
d943f39401
commit
8b008e1b7a
@ -5,6 +5,7 @@ import { MD } from "../../ui/MD/MD";
|
|||||||
|
|
||||||
import { getPage } from "./root";
|
import { getPage } from "./root";
|
||||||
import { Navigator, useHistory } from "../../ui/React/Documentation";
|
import { Navigator, useHistory } from "../../ui/React/Documentation";
|
||||||
|
import { CONSTANTS } from "../../Constants";
|
||||||
|
|
||||||
const resolveRelativePath = (folder: string, relative: string): string => {
|
const resolveRelativePath = (folder: string, relative: string): string => {
|
||||||
const noLastSlash = folder.endsWith("/") ? folder.slice(0, folder.length - 1) : folder;
|
const noLastSlash = folder.endsWith("/") ? folder.slice(0, folder.length - 1) : folder;
|
||||||
@ -29,7 +30,8 @@ export function DocumentationRoot(): React.ReactElement {
|
|||||||
navigate(relPath: string, external: boolean) {
|
navigate(relPath: string, external: boolean) {
|
||||||
const newPath = resolvePath(history.page, relPath);
|
const newPath = resolvePath(history.page, relPath);
|
||||||
if (external) {
|
if (external) {
|
||||||
const url = `https://github.com/bitburner-official/bitburner-src/blob/stable/src/Documentation/ui/doc/${newPath}`;
|
const ver = CONSTANTS.isDevBranch ? "dev" : "stable";
|
||||||
|
const url = `https://github.com/bitburner-official/bitburner-src/blob/${ver}/src/Documentation/ui/doc/${newPath}`;
|
||||||
window.open(url, "_newtab");
|
window.open(url, "_newtab");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user