mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 15:14:56 -04:00
refactor: rename render-iframe to renderer-iframe
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
aef0211092
commit
4d48aa613d
13 changed files with 21 additions and 21 deletions
|
@ -6,9 +6,9 @@
|
||||||
import * as UseBaseUrlModule from '../../../hooks/common/use-base-url'
|
import * as UseBaseUrlModule from '../../../hooks/common/use-base-url'
|
||||||
import { mockI18n } from '../../../test-utils/mock-i18n'
|
import { mockI18n } from '../../../test-utils/mock-i18n'
|
||||||
import { testId } from '../../../utils/test-id'
|
import { testId } from '../../../utils/test-id'
|
||||||
import * as RenderIframeModule from '../../common/render-iframe/render-iframe'
|
|
||||||
import type { CommonModalProps } from '../modals/common-modal'
|
import type { CommonModalProps } from '../modals/common-modal'
|
||||||
import * as CommonModalModule from '../modals/common-modal'
|
import * as CommonModalModule from '../modals/common-modal'
|
||||||
|
import * as RendererIframeModule from '../renderer-iframe/renderer-iframe'
|
||||||
import * as fetchMotdModule from './fetch-motd'
|
import * as fetchMotdModule from './fetch-motd'
|
||||||
import { MotdModal } from './motd-modal'
|
import { MotdModal } from './motd-modal'
|
||||||
import { act, render, screen } from '@testing-library/react'
|
import { act, render, screen } from '@testing-library/react'
|
||||||
|
@ -17,7 +17,7 @@ import React from 'react'
|
||||||
|
|
||||||
jest.mock('./fetch-motd')
|
jest.mock('./fetch-motd')
|
||||||
jest.mock('../modals/common-modal')
|
jest.mock('../modals/common-modal')
|
||||||
jest.mock('../../common/render-iframe/render-iframe')
|
jest.mock('../renderer-iframe/renderer-iframe')
|
||||||
jest.mock('../../../hooks/common/use-base-url')
|
jest.mock('../../../hooks/common/use-base-url')
|
||||||
|
|
||||||
describe('motd modal', () => {
|
describe('motd modal', () => {
|
||||||
|
@ -39,7 +39,7 @@ describe('motd modal', () => {
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}) as React.FC<PropsWithChildren<CommonModalProps>>)
|
}) as React.FC<PropsWithChildren<CommonModalProps>>)
|
||||||
jest.spyOn(RenderIframeModule, 'RenderIframe').mockImplementation((props) => {
|
jest.spyOn(RendererIframeModule, 'RendererIframe').mockImplementation((props) => {
|
||||||
return (
|
return (
|
||||||
<span {...testId('motd-renderer')}>
|
<span {...testId('motd-renderer')}>
|
||||||
This is a mock implementation of a iframe renderer. Props: {JSON.stringify(props)}
|
This is a mock implementation of a iframe renderer. Props: {JSON.stringify(props)}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { testId } from '../../../utils/test-id'
|
||||||
import { EditorToRendererCommunicatorContextProvider } from '../../editor-page/render-context/editor-to-renderer-communicator-context-provider'
|
import { EditorToRendererCommunicatorContextProvider } from '../../editor-page/render-context/editor-to-renderer-communicator-context-provider'
|
||||||
import { RendererType } from '../../render-page/window-post-message-communicator/rendering-message'
|
import { RendererType } from '../../render-page/window-post-message-communicator/rendering-message'
|
||||||
import { CommonModal } from '../modals/common-modal'
|
import { CommonModal } from '../modals/common-modal'
|
||||||
import { RenderIframe } from '../render-iframe/render-iframe'
|
import { RendererIframe } from '../renderer-iframe/renderer-iframe'
|
||||||
import { fetchMotd, MOTD_LOCAL_STORAGE_KEY } from './fetch-motd'
|
import { fetchMotd, MOTD_LOCAL_STORAGE_KEY } from './fetch-motd'
|
||||||
import React, { useCallback, useMemo, useEffect, useState } from 'react'
|
import React, { useCallback, useMemo, useEffect, useState } from 'react'
|
||||||
import { Button, Modal } from 'react-bootstrap'
|
import { Button, Modal } from 'react-bootstrap'
|
||||||
|
@ -55,7 +55,7 @@ export const MotdModal: React.FC = () => {
|
||||||
{...cypressId('motd-modal')}>
|
{...cypressId('motd-modal')}>
|
||||||
<Modal.Body className={'bg-light'}>
|
<Modal.Body className={'bg-light'}>
|
||||||
<EditorToRendererCommunicatorContextProvider>
|
<EditorToRendererCommunicatorContextProvider>
|
||||||
<RenderIframe
|
<RendererIframe
|
||||||
frameClasses={'w-100'}
|
frameClasses={'w-100'}
|
||||||
rendererType={RendererType.SIMPLE}
|
rendererType={RendererType.SIMPLE}
|
||||||
markdownContentLines={lines as string[]}
|
markdownContentLines={lines as string[]}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import { useSendMarkdownToRenderer } from './hooks/use-send-markdown-to-renderer
|
||||||
import { useSendScrollState } from './hooks/use-send-scroll-state'
|
import { useSendScrollState } from './hooks/use-send-scroll-state'
|
||||||
import React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
|
|
||||||
export interface RenderIframeProps extends Omit<CommonMarkdownRendererProps & ScrollProps, 'baseUrl'> {
|
export interface RendererIframeProps extends Omit<CommonMarkdownRendererProps & ScrollProps, 'baseUrl'> {
|
||||||
rendererType: RendererType
|
rendererType: RendererType
|
||||||
forcedDarkMode?: DarkModePreference
|
forcedDarkMode?: DarkModePreference
|
||||||
frameClasses?: string
|
frameClasses?: string
|
||||||
|
@ -36,7 +36,7 @@ export interface RenderIframeProps extends Omit<CommonMarkdownRendererProps & Sc
|
||||||
adaptFrameHeightToContent?: boolean
|
adaptFrameHeightToContent?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const log = new Logger('RenderIframe')
|
const log = new Logger('RendererIframe')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the iframe for the HTML-rendering of the markdown content.
|
* Renders the iframe for the HTML-rendering of the markdown content.
|
||||||
|
@ -54,7 +54,7 @@ const log = new Logger('RenderIframe')
|
||||||
* @param adaptFrameHeightToContent If set, the iframe height will be adjusted to the content height
|
* @param adaptFrameHeightToContent If set, the iframe height will be adjusted to the content height
|
||||||
* @param onRendererStatusChange Callback that is fired when the renderer in the iframe is ready
|
* @param onRendererStatusChange Callback that is fired when the renderer in the iframe is ready
|
||||||
*/
|
*/
|
||||||
export const RenderIframe: React.FC<RenderIframeProps> = ({
|
export const RendererIframe: React.FC<RendererIframeProps> = ({
|
||||||
markdownContentLines,
|
markdownContentLines,
|
||||||
scrollState,
|
scrollState,
|
||||||
onScroll,
|
onScroll,
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter'
|
import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter'
|
||||||
import { setRendererStatus } from '../../redux/renderer-status/methods'
|
import { setRendererStatus } from '../../redux/renderer-status/methods'
|
||||||
import { RenderIframe } from '../common/render-iframe/render-iframe'
|
import { RendererIframe } from '../common/renderer-iframe/renderer-iframe'
|
||||||
import { RendererType } from '../render-page/window-post-message-communicator/rendering-message'
|
import { RendererType } from '../render-page/window-post-message-communicator/rendering-message'
|
||||||
import { DocumentInfobar } from './document-infobar'
|
import { DocumentInfobar } from './document-infobar'
|
||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
|
@ -23,7 +23,7 @@ export const DocumentReadOnlyPageContent: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<DocumentInfobar />
|
<DocumentInfobar />
|
||||||
<RenderIframe
|
<RendererIframe
|
||||||
frameClasses={'flex-fill h-100 w-100'}
|
frameClasses={'flex-fill h-100 w-100'}
|
||||||
markdownContentLines={markdownContentLines}
|
markdownContentLines={markdownContentLines}
|
||||||
rendererType={RendererType.DOCUMENT}
|
rendererType={RendererType.DOCUMENT}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
import HighlightedCode from '../../../common/highlighted-code/highlighted-code'
|
import HighlightedCode from '../../../common/highlighted-code/highlighted-code'
|
||||||
import { HtmlToReact } from '../../../common/html-to-react/html-to-react'
|
import { HtmlToReact } from '../../../common/html-to-react/html-to-react'
|
||||||
import { RenderIframe } from '../../../common/render-iframe/render-iframe'
|
import { RendererIframe } from '../../../common/renderer-iframe/renderer-iframe'
|
||||||
import { ExtensionEventEmitterProvider } from '../../../markdown-renderer/hooks/use-extension-event-emitter'
|
import { ExtensionEventEmitterProvider } from '../../../markdown-renderer/hooks/use-extension-event-emitter'
|
||||||
import { RendererType } from '../../../render-page/window-post-message-communicator/rendering-message'
|
import { RendererType } from '../../../render-page/window-post-message-communicator/rendering-message'
|
||||||
import type { CheatsheetEntry } from '../../cheatsheet/cheatsheet-extension'
|
import type { CheatsheetEntry } from '../../cheatsheet/cheatsheet-extension'
|
||||||
|
@ -73,7 +73,7 @@ export const CheatsheetEntryPane: React.FC<CheatsheetRendererProps> = ({ extensi
|
||||||
<h4>
|
<h4>
|
||||||
<Trans i18nKey={'cheatsheet.modal.headlines.exampleOutput'} />
|
<Trans i18nKey={'cheatsheet.modal.headlines.exampleOutput'} />
|
||||||
</h4>
|
</h4>
|
||||||
<RenderIframe
|
<RendererIframe
|
||||||
frameClasses={'w-100'}
|
frameClasses={'w-100'}
|
||||||
adaptFrameHeightToContent={true}
|
adaptFrameHeightToContent={true}
|
||||||
rendererType={RendererType.SIMPLE}
|
rendererType={RendererType.SIMPLE}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||||
import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter'
|
import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter'
|
||||||
import { setRendererStatus } from '../../../redux/renderer-status/methods'
|
import { setRendererStatus } from '../../../redux/renderer-status/methods'
|
||||||
import type { RenderIframeProps } from '../../common/render-iframe/render-iframe'
|
import type { RendererIframeProps } from '../../common/renderer-iframe/renderer-iframe'
|
||||||
import { RenderIframe } from '../../common/render-iframe/render-iframe'
|
import { RendererIframe } from '../../common/renderer-iframe/renderer-iframe'
|
||||||
import { RendererType } from '../../render-page/window-post-message-communicator/rendering-message'
|
import { RendererType } from '../../render-page/window-post-message-communicator/rendering-message'
|
||||||
import { useOnScrollWithLineOffset } from './hooks/use-on-scroll-with-line-offset'
|
import { useOnScrollWithLineOffset } from './hooks/use-on-scroll-with-line-offset'
|
||||||
import { useScrollStateWithoutLineOffset } from './hooks/use-scroll-state-without-line-offset'
|
import { useScrollStateWithoutLineOffset } from './hooks/use-scroll-state-without-line-offset'
|
||||||
|
@ -15,7 +15,7 @@ import { NoteType } from '@hedgedoc/commons'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
export type EditorDocumentRendererProps = Omit<
|
export type EditorDocumentRendererProps = Omit<
|
||||||
RenderIframeProps,
|
RendererIframeProps,
|
||||||
'markdownContentLines' | 'rendererType' | 'onTaskCheckedChange'
|
'markdownContentLines' | 'rendererType' | 'onTaskCheckedChange'
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ export type EditorDocumentRendererProps = Omit<
|
||||||
*
|
*
|
||||||
* @param scrollState The {@link ScrollState} that should be sent to the renderer
|
* @param scrollState The {@link ScrollState} that should be sent to the renderer
|
||||||
* @param onScroll A callback that is executed when the view in the rendered is scrolled
|
* @param onScroll A callback that is executed when the view in the rendered is scrolled
|
||||||
* @param props Every property from the {@link RenderIframe} except the markdown content
|
* @param props Every property from the {@link RendererIframe} except the markdown content
|
||||||
*/
|
*/
|
||||||
export const EditorDocumentRenderer: React.FC<EditorDocumentRendererProps> = ({ scrollState, onScroll, ...props }) => {
|
export const EditorDocumentRenderer: React.FC<EditorDocumentRendererProps> = ({ scrollState, onScroll, ...props }) => {
|
||||||
const trimmedContentLines = useTrimmedNoteMarkdownContentWithoutFrontmatter()
|
const trimmedContentLines = useTrimmedNoteMarkdownContentWithoutFrontmatter()
|
||||||
|
@ -33,7 +33,7 @@ export const EditorDocumentRenderer: React.FC<EditorDocumentRendererProps> = ({
|
||||||
const adjustedScrollState = useScrollStateWithoutLineOffset(scrollState)
|
const adjustedScrollState = useScrollStateWithoutLineOffset(scrollState)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RenderIframe
|
<RendererIframe
|
||||||
{...props}
|
{...props}
|
||||||
onScroll={adjustedOnScroll}
|
onScroll={adjustedOnScroll}
|
||||||
scrollState={adjustedScrollState}
|
scrollState={adjustedScrollState}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import { DarkModePreference } from '../../redux/dark-mode/types'
|
import { DarkModePreference } from '../../redux/dark-mode/types'
|
||||||
import { Logger } from '../../utils/logger'
|
import { Logger } from '../../utils/logger'
|
||||||
import { AsyncLoadingBoundary } from '../common/async-loading-boundary/async-loading-boundary'
|
import { AsyncLoadingBoundary } from '../common/async-loading-boundary/async-loading-boundary'
|
||||||
import { RenderIframe } from '../common/render-iframe/render-iframe'
|
import { RendererIframe } from '../common/renderer-iframe/renderer-iframe'
|
||||||
import { RendererType } from '../render-page/window-post-message-communicator/rendering-message'
|
import { RendererType } from '../render-page/window-post-message-communicator/rendering-message'
|
||||||
import { fetchFrontPageContent } from './requests'
|
import { fetchFrontPageContent } from './requests'
|
||||||
import React, { useEffect } from 'react'
|
import React, { useEffect } from 'react'
|
||||||
|
@ -28,7 +28,7 @@ export const IntroCustomContent: React.FC = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AsyncLoadingBoundary loading={loading || !value} error={error} componentName={'custom intro content'}>
|
<AsyncLoadingBoundary loading={loading || !value} error={error} componentName={'custom intro content'}>
|
||||||
<RenderIframe
|
<RendererIframe
|
||||||
frameClasses={'w-100 overflow-y-hidden'}
|
frameClasses={'w-100 overflow-y-hidden'}
|
||||||
markdownContentLines={value as string[]}
|
markdownContentLines={value as string[]}
|
||||||
rendererType={RendererType.SIMPLE}
|
rendererType={RendererType.SIMPLE}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import { useApplicationState } from '../../hooks/common/use-application-state'
|
import { useApplicationState } from '../../hooks/common/use-application-state'
|
||||||
import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter'
|
import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter'
|
||||||
import { setRendererStatus } from '../../redux/renderer-status/methods'
|
import { setRendererStatus } from '../../redux/renderer-status/methods'
|
||||||
import { RenderIframe } from '../common/render-iframe/render-iframe'
|
import { RendererIframe } from '../common/renderer-iframe/renderer-iframe'
|
||||||
import { useSendToRenderer } from '../render-page/window-post-message-communicator/hooks/use-send-to-renderer'
|
import { useSendToRenderer } from '../render-page/window-post-message-communicator/hooks/use-send-to-renderer'
|
||||||
import {
|
import {
|
||||||
CommunicationMessageType,
|
CommunicationMessageType,
|
||||||
|
@ -37,7 +37,7 @@ export const SlideShowPageContent: React.FC = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'vh-100 vw-100'}>
|
<div className={'vh-100 vw-100'}>
|
||||||
<RenderIframe
|
<RendererIframe
|
||||||
frameClasses={'h-100 w-100'}
|
frameClasses={'h-100 w-100'}
|
||||||
markdownContentLines={markdownContentLines}
|
markdownContentLines={markdownContentLines}
|
||||||
rendererType={RendererType.SLIDESHOW}
|
rendererType={RendererType.SLIDESHOW}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue