Skip to content

Commit

Permalink
Fixed highlight words not show in article title
Browse files Browse the repository at this point in the history
  • Loading branch information
ihavecoke committed Jun 19, 2024
1 parent 4cd2f35 commit 16a9dcf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
2 changes: 2 additions & 0 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const ossEnv = isDev ? "/" : proxy;
const targetPortalPath = proxy === "canary" ? "https://m.longbridge.xyz" : "https://m.lbkrs.com";
const localAPIProxyPath = "/dev-proxy";
const apiProxyUrl = `${isDev ? localAPIProxyPath : targetPortalPath}/api/forward`;
const portAIProxyUrl = isDev ? 'http://localhost:4040/dev-proxy' : undefined;

const config: Config = {
title: "LongPort wiki",
Expand All @@ -34,6 +35,7 @@ const config: Config = {
favicon: "https://pub.lbkrs.com/static/offline/202211/qohHsXzN9qtQ23ox/longport_favicon.png",
customFields: {
isDev,
portAIProxyUrl,
apiProxyUrl
},
headTags: [
Expand Down
30 changes: 20 additions & 10 deletions src/theme/DocRoot/Layout/Main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,40 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import clsx from 'clsx';
import {useDocsSidebar} from '@docusaurus/theme-common/internal';
import type {Props} from '@theme/DocRoot/Layout/Main';
import React from "react";
import clsx from "clsx";
import { useDocsSidebar } from "@docusaurus/theme-common/internal";
import type { Props } from "@theme/DocRoot/Layout/Main";

import styles from './styles.module.css';
import styles from "./styles.module.css";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";

export default function DocRootLayoutMain({
hiddenSidebarContainer,
children,
}: Props): JSX.Element {
const sidebar = useDocsSidebar();
const {
siteConfig: {
customFields: { portAIProxyUrl },
},
} = useDocusaurusContext();

return (
<main
className={clsx(
styles.docMainContainer,
(hiddenSidebarContainer || !sidebar) && styles.docMainContainerEnhanced,
)}>
(hiddenSidebarContainer || !sidebar) && styles.docMainContainerEnhanced
)}
>
<div
className={clsx(
'container sm:px-4 md:px-0 wiki-article-content mt-8 padding-top--md padding-bottom--lg',
"container sm:px-4 md:px-0 wiki-article-content mt-8 padding-top--md padding-bottom--lg",
styles.docItemWrapper,
hiddenSidebarContainer && styles.docItemWrapperEnhanced,
)}>
hiddenSidebarContainer && styles.docItemWrapperEnhanced
)}
data-proxy={portAIProxyUrl}
>
{children}
</div>
</main>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const loadScript = (src) => {
let highlightIsLoaded = false
export const loadHighlight = async () => {
if (!highlightIsLoaded) {
await loadScript('https://assets.lbkrs.com/uploads/e6eebe73-a777-4dc5-b682-a80db1af5554/highlight.js')
await loadScript('https://assets.lbkrs.com/uploads/c6e6f6e9-78ab-42f1-942d-111bdb58d758/index.umd.js')
}
highlightIsLoaded = true
const xHighlights = document.querySelectorAll('.doc-highlight')
Expand Down

0 comments on commit 16a9dcf

Please sign in to comment.