mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
Fix document renderer sizing issues (3/4) (#998)
* Rework renderer columns Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
123f959fb3
commit
f7be49bbc3
4 changed files with 48 additions and 25 deletions
|
@ -21,10 +21,6 @@
|
||||||
max-width: 900px;
|
max-width: 900px;
|
||||||
}
|
}
|
||||||
|
|
||||||
& > img {
|
|
||||||
width: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
h1, h2, h3, h4, h5, h6 {
|
||||||
a.heading-anchor {
|
a.heading-anchor {
|
||||||
font-size: 0.75em;
|
font-size: 0.75em;
|
||||||
|
|
27
src/components/render-page/markdown-document.scss
Normal file
27
src/components/render-page/markdown-document.scss
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/*!
|
||||||
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
.markdown-document {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
overflow-y: scroll;
|
||||||
|
overflow-x: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
.markdown-document-side {
|
||||||
|
flex: 1 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.markdown-document-content {
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
flex: 0 0 900px;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 900px;
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ import { ScrollProps } from '../editor-page/synced-scroll/scroll-props'
|
||||||
import { TableOfContents } from '../editor-page/table-of-contents/table-of-contents'
|
import { TableOfContents } from '../editor-page/table-of-contents/table-of-contents'
|
||||||
import { FullMarkdownRenderer } from '../markdown-renderer/full-markdown-renderer'
|
import { FullMarkdownRenderer } from '../markdown-renderer/full-markdown-renderer'
|
||||||
import { ImageClickHandler } from '../markdown-renderer/replace-components/image/image-replacer'
|
import { ImageClickHandler } from '../markdown-renderer/replace-components/image/image-replacer'
|
||||||
|
import './markdown-document.scss'
|
||||||
|
|
||||||
export interface MarkdownDocumentProps extends ScrollProps {
|
export interface MarkdownDocumentProps extends ScrollProps {
|
||||||
extraClasses?: string
|
extraClasses?: string
|
||||||
|
@ -53,33 +54,32 @@ export const MarkdownDocument: React.FC<MarkdownDocumentProps> = (
|
||||||
const [onLineMarkerPositionChanged, onUserScroll] = useSyncedScrolling(internalDocumentRenderPaneRef, rendererRef, contentLineCount, scrollState, onScroll)
|
const [onLineMarkerPositionChanged, onUserScroll] = useSyncedScrolling(internalDocumentRenderPaneRef, rendererRef, contentLineCount, scrollState, onScroll)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`overflow-y-scroll h-100 bg-light m-0 pb-5 row ${extraClasses ?? ''}`}
|
<div className={`markdown-document ${extraClasses ?? ''}`}
|
||||||
ref={internalDocumentRenderPaneRef} onScroll={onUserScroll} onMouseEnter={onMakeScrollSource}>
|
ref={internalDocumentRenderPaneRef} onScroll={onUserScroll} onMouseEnter={onMakeScrollSource}>
|
||||||
<div className={'col-md d-none d-md-block'}/>
|
<div className={'markdown-document-side'}/>
|
||||||
<div className={'bg-light col'}>
|
<div className={'bg-light markdown-document-content'}>
|
||||||
<YamlArrayDeprecationAlert/>
|
<YamlArrayDeprecationAlert/>
|
||||||
<div>
|
<FullMarkdownRenderer
|
||||||
<FullMarkdownRenderer
|
rendererRef={rendererRef}
|
||||||
rendererRef={rendererRef}
|
className={'flex-fill pt-4 mb-3'}
|
||||||
className={'flex-fill pt-4 mb-3'}
|
content={markdownContent}
|
||||||
content={markdownContent}
|
onFirstHeadingChange={onFirstHeadingChange}
|
||||||
onFirstHeadingChange={onFirstHeadingChange}
|
onLineMarkerPositionChanged={onLineMarkerPositionChanged}
|
||||||
onLineMarkerPositionChanged={onLineMarkerPositionChanged}
|
onFrontmatterChange={onFrontmatterChange}
|
||||||
onFrontmatterChange={onFrontmatterChange}
|
onTaskCheckedChange={onTaskCheckedChange}
|
||||||
onTaskCheckedChange={onTaskCheckedChange}
|
onTocChange={(tocAst) => setTocAst(tocAst)}
|
||||||
onTocChange={(tocAst) => setTocAst(tocAst)}
|
wide={wide}
|
||||||
wide={wide}
|
baseUrl={baseUrl}
|
||||||
baseUrl={baseUrl}
|
onImageClick={onImageClick}/>
|
||||||
onImageClick={onImageClick}/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={'col-md pt-4'}>
|
<div className={'markdown-document-side pt-4'}>
|
||||||
<ShowIf condition={!!tocAst}>
|
<ShowIf condition={!!tocAst}>
|
||||||
<ShowIf condition={width >= 1280}>
|
<ShowIf condition={width >= 1100}>
|
||||||
<TableOfContents ast={tocAst as TocAst} className={'sticky'} baseUrl={baseUrl}/>
|
<TableOfContents ast={tocAst as TocAst} className={'sticky'} baseUrl={baseUrl}/>
|
||||||
</ShowIf>
|
</ShowIf>
|
||||||
<ShowIf condition={width < 1280}>
|
<ShowIf condition={width < 1100}>
|
||||||
<div className={'markdown-toc-sidebar-button'}>
|
<div className={'markdown-toc-sidebar-button'}>
|
||||||
<Dropdown drop={'up'}>
|
<Dropdown drop={'up'}>
|
||||||
<Dropdown.Toggle id="toc-overlay-button" variant={'secondary'} className={'no-arrow'}>
|
<Dropdown.Toggle id="toc-overlay-button" variant={'secondary'} className={'no-arrow'}>
|
||||||
|
|
|
@ -82,7 +82,7 @@ export const RenderPage: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
<div className={"vh-100 w-100"}>
|
<div className={"vh-100 w-100"}>
|
||||||
<MarkdownDocument
|
<MarkdownDocument
|
||||||
extraClasses={'w-100'}
|
extraClasses={'bg-light'}
|
||||||
markdownContent={markdownContent}
|
markdownContent={markdownContent}
|
||||||
wide={isWide}
|
wide={isWide}
|
||||||
onTaskCheckedChange={onTaskCheckedChange}
|
onTaskCheckedChange={onTaskCheckedChange}
|
||||||
|
|
Loading…
Reference in a new issue