mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 07:04:45 -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 { mockI18n } from '../../../test-utils/mock-i18n'
|
||||
import { testId } from '../../../utils/test-id'
|
||||
import * as RenderIframeModule from '../../common/render-iframe/render-iframe'
|
||||
import type { CommonModalProps } 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 { MotdModal } from './motd-modal'
|
||||
import { act, render, screen } from '@testing-library/react'
|
||||
|
@ -17,7 +17,7 @@ import React from 'react'
|
|||
|
||||
jest.mock('./fetch-motd')
|
||||
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')
|
||||
|
||||
describe('motd modal', () => {
|
||||
|
@ -39,7 +39,7 @@ describe('motd modal', () => {
|
|||
</span>
|
||||
)
|
||||
}) as React.FC<PropsWithChildren<CommonModalProps>>)
|
||||
jest.spyOn(RenderIframeModule, 'RenderIframe').mockImplementation((props) => {
|
||||
jest.spyOn(RendererIframeModule, 'RendererIframe').mockImplementation((props) => {
|
||||
return (
|
||||
<span {...testId('motd-renderer')}>
|
||||
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 { RendererType } from '../../render-page/window-post-message-communicator/rendering-message'
|
||||
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 React, { useCallback, useMemo, useEffect, useState } from 'react'
|
||||
import { Button, Modal } from 'react-bootstrap'
|
||||
|
@ -55,7 +55,7 @@ export const MotdModal: React.FC = () => {
|
|||
{...cypressId('motd-modal')}>
|
||||
<Modal.Body className={'bg-light'}>
|
||||
<EditorToRendererCommunicatorContextProvider>
|
||||
<RenderIframe
|
||||
<RendererIframe
|
||||
frameClasses={'w-100'}
|
||||
rendererType={RendererType.SIMPLE}
|
||||
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 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
|
||||
forcedDarkMode?: DarkModePreference
|
||||
frameClasses?: string
|
||||
|
@ -36,7 +36,7 @@ export interface RenderIframeProps extends Omit<CommonMarkdownRendererProps & Sc
|
|||
adaptFrameHeightToContent?: boolean
|
||||
}
|
||||
|
||||
const log = new Logger('RenderIframe')
|
||||
const log = new Logger('RendererIframe')
|
||||
|
||||
/**
|
||||
* 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 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,
|
||||
scrollState,
|
||||
onScroll,
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter'
|
||||
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 { DocumentInfobar } from './document-infobar'
|
||||
import React, { Fragment } from 'react'
|
||||
|
@ -23,7 +23,7 @@ export const DocumentReadOnlyPageContent: React.FC = () => {
|
|||
return (
|
||||
<Fragment>
|
||||
<DocumentInfobar />
|
||||
<RenderIframe
|
||||
<RendererIframe
|
||||
frameClasses={'flex-fill h-100 w-100'}
|
||||
markdownContentLines={markdownContentLines}
|
||||
rendererType={RendererType.DOCUMENT}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
import HighlightedCode from '../../../common/highlighted-code/highlighted-code'
|
||||
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 { RendererType } from '../../../render-page/window-post-message-communicator/rendering-message'
|
||||
import type { CheatsheetEntry } from '../../cheatsheet/cheatsheet-extension'
|
||||
|
@ -73,7 +73,7 @@ export const CheatsheetEntryPane: React.FC<CheatsheetRendererProps> = ({ extensi
|
|||
<h4>
|
||||
<Trans i18nKey={'cheatsheet.modal.headlines.exampleOutput'} />
|
||||
</h4>
|
||||
<RenderIframe
|
||||
<RendererIframe
|
||||
frameClasses={'w-100'}
|
||||
adaptFrameHeightToContent={true}
|
||||
rendererType={RendererType.SIMPLE}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter'
|
||||
import { setRendererStatus } from '../../../redux/renderer-status/methods'
|
||||
import type { RenderIframeProps } from '../../common/render-iframe/render-iframe'
|
||||
import { RenderIframe } from '../../common/render-iframe/render-iframe'
|
||||
import type { RendererIframeProps } from '../../common/renderer-iframe/renderer-iframe'
|
||||
import { RendererIframe } from '../../common/renderer-iframe/renderer-iframe'
|
||||
import { RendererType } from '../../render-page/window-post-message-communicator/rendering-message'
|
||||
import { useOnScrollWithLineOffset } from './hooks/use-on-scroll-with-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'
|
||||
|
||||
export type EditorDocumentRendererProps = Omit<
|
||||
RenderIframeProps,
|
||||
RendererIframeProps,
|
||||
'markdownContentLines' | 'rendererType' | 'onTaskCheckedChange'
|
||||
>
|
||||
|
||||
|
@ -24,7 +24,7 @@ export type EditorDocumentRendererProps = Omit<
|
|||
*
|
||||
* @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 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 }) => {
|
||||
const trimmedContentLines = useTrimmedNoteMarkdownContentWithoutFrontmatter()
|
||||
|
@ -33,7 +33,7 @@ export const EditorDocumentRenderer: React.FC<EditorDocumentRendererProps> = ({
|
|||
const adjustedScrollState = useScrollStateWithoutLineOffset(scrollState)
|
||||
|
||||
return (
|
||||
<RenderIframe
|
||||
<RendererIframe
|
||||
{...props}
|
||||
onScroll={adjustedOnScroll}
|
||||
scrollState={adjustedScrollState}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { DarkModePreference } from '../../redux/dark-mode/types'
|
||||
import { Logger } from '../../utils/logger'
|
||||
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 { fetchFrontPageContent } from './requests'
|
||||
import React, { useEffect } from 'react'
|
||||
|
@ -28,7 +28,7 @@ export const IntroCustomContent: React.FC = () => {
|
|||
|
||||
return (
|
||||
<AsyncLoadingBoundary loading={loading || !value} error={error} componentName={'custom intro content'}>
|
||||
<RenderIframe
|
||||
<RendererIframe
|
||||
frameClasses={'w-100 overflow-y-hidden'}
|
||||
markdownContentLines={value as string[]}
|
||||
rendererType={RendererType.SIMPLE}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { useApplicationState } from '../../hooks/common/use-application-state'
|
||||
import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter'
|
||||
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 {
|
||||
CommunicationMessageType,
|
||||
|
@ -37,7 +37,7 @@ export const SlideShowPageContent: React.FC = () => {
|
|||
|
||||
return (
|
||||
<div className={'vh-100 vw-100'}>
|
||||
<RenderIframe
|
||||
<RendererIframe
|
||||
frameClasses={'h-100 w-100'}
|
||||
markdownContentLines={markdownContentLines}
|
||||
rendererType={RendererType.SLIDESHOW}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue