delete baseURL args

Signed-off-by: yamashush <38120991+yamashush@users.noreply.github.com>
This commit is contained in:
yamashush 2024-01-20 12:47:02 +09:00 committed by Tilman Vatteroth
parent 744f96852c
commit dea13bfa90
3 changed files with 4 additions and 7 deletions

View file

@ -99,7 +99,7 @@ export const DocumentMarkdownRenderer: React.FC<DocumentMarkdownRendererProps> =
</div> </div>
</div> </div>
</div> </div>
<DocumentTocSidebar width={internalDocumentRenderPaneSize?.width ?? 0} baseUrl={baseUrl} /> <DocumentTocSidebar width={internalDocumentRenderPaneSize?.width ?? 0} />
</div> </div>
) )
} }

View file

@ -12,16 +12,15 @@ import React, { useState } from 'react'
export interface DocumentTocSidebarProps { export interface DocumentTocSidebarProps {
width: number width: number
baseUrl: string
} }
export const DocumentTocSidebar: React.FC<DocumentTocSidebarProps> = ({ width, baseUrl }) => { export const DocumentTocSidebar: React.FC<DocumentTocSidebarProps> = ({ width }) => {
const [tocAst, setTocAst] = useState<TocAst>() const [tocAst, setTocAst] = useState<TocAst>()
useExtensionEventEmitterHandler(TableOfContentsMarkdownExtension.EVENT_NAME, setTocAst) useExtensionEventEmitterHandler(TableOfContentsMarkdownExtension.EVENT_NAME, setTocAst)
return ( return (
<div className={styles.side}> <div className={styles.side}>
{tocAst !== undefined && <WidthBasedTableOfContents tocAst={tocAst} baseUrl={baseUrl} width={width} />} {tocAst !== undefined && <WidthBasedTableOfContents tocAst={tocAst} width={width} />}
</div> </div>
) )
} }

View file

@ -12,7 +12,6 @@ import React from 'react'
export interface DocumentExternalTocProps { export interface DocumentExternalTocProps {
tocAst: TocAst tocAst: TocAst
width: number width: number
baseUrl: string
} }
const MAX_WIDTH_FOR_BUTTON_VISIBILITY = 1100 const MAX_WIDTH_FOR_BUTTON_VISIBILITY = 1100
@ -23,9 +22,8 @@ const MAX_WIDTH_FOR_BUTTON_VISIBILITY = 1100
* *
* @param tocAst the {@link TocAst AST} that should be rendered. * @param tocAst the {@link TocAst AST} that should be rendered.
* @param width the width that should be used to determine if the button should be shown. * @param width the width that should be used to determine if the button should be shown.
* @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<DocumentExternalTocProps> = ({ tocAst, width, baseUrl }) => { export const WidthBasedTableOfContents: React.FC<DocumentExternalTocProps> = ({ tocAst, width }) => {
const rendererBaseUrl = useBaseUrl(ORIGIN.RENDERER) const rendererBaseUrl = useBaseUrl(ORIGIN.RENDERER)
if (width >= MAX_WIDTH_FOR_BUTTON_VISIBILITY) { if (width >= MAX_WIDTH_FOR_BUTTON_VISIBILITY) {