From 744f96852cff0aa419f196a84bdc91971d3eb09e Mon Sep 17 00:00:00 2001 From: yamashush <38120991+yamashush@users.noreply.github.com> Date: Sat, 20 Jan 2024 12:15:56 +0900 Subject: [PATCH] refactor: use provider for baseURL Signed-off-by: yamashush <38120991+yamashush@users.noreply.github.com> --- .../renderers/document/width-based-table-of-contents.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/render-page/renderers/document/width-based-table-of-contents.tsx b/frontend/src/components/render-page/renderers/document/width-based-table-of-contents.tsx index 1ba7f3cf1..9482b4215 100644 --- a/frontend/src/components/render-page/renderers/document/width-based-table-of-contents.tsx +++ b/frontend/src/components/render-page/renderers/document/width-based-table-of-contents.tsx @@ -5,6 +5,7 @@ */ import { TableOfContents } from '../../../editor-page/table-of-contents/table-of-contents' import { TableOfContentsHoveringButton } from '../../markdown-toc-button/table-of-contents-hovering-button' +import { ORIGIN, useBaseUrl } from '../../../../hooks/common/use-base-url' import type { TocAst } from '@hedgedoc/markdown-it-plugins' import React from 'react' @@ -25,9 +26,11 @@ const MAX_WIDTH_FOR_BUTTON_VISIBILITY = 1100 * @param baseUrl the base url that will be used to generate the links //TODO: replace with consumer/provider (https://github.com/hedgedoc/hedgedoc/issues/5035) */ export const WidthBasedTableOfContents: React.FC = ({ tocAst, width, baseUrl }) => { + const rendererBaseUrl = useBaseUrl(ORIGIN.RENDERER) + if (width >= MAX_WIDTH_FOR_BUTTON_VISIBILITY) { - return + return } else { - return + return } }