mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 09:16:30 -05:00
fix(renderer): merge similar renderer types
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
93f296a175
commit
9d49401b4d
8 changed files with 12 additions and 20 deletions
|
@ -13,7 +13,7 @@ describe('Intro page', () => {
|
|||
|
||||
describe('customizable content', () => {
|
||||
it('fetches and shows the correct intro page content', () => {
|
||||
cy.getIntroBody().contains('test content')
|
||||
cy.getSimpleRendererBody().contains('test content')
|
||||
})
|
||||
|
||||
it("won't show anything if no content was found", () => {
|
||||
|
|
|
@ -22,8 +22,8 @@ describe('Motd', () => {
|
|||
statusCode: 200,
|
||||
headers: { 'Last-Modified': MOCK_LAST_MODIFIED }
|
||||
})
|
||||
cy.visitHome()
|
||||
cy.getMotdBody().should('contain.html', motdMockHtml)
|
||||
cy.visitHistory()
|
||||
cy.getSimpleRendererBody().should('contain.html', motdMockHtml)
|
||||
cy.getByCypressId('motd-dismiss')
|
||||
.click()
|
||||
.then(() => {
|
||||
|
|
|
@ -13,9 +13,7 @@ declare namespace Cypress {
|
|||
|
||||
getMarkdownBody(): Chainable<Element>
|
||||
|
||||
getIntroBody(): Chainable<Element>
|
||||
|
||||
getMotdBody(): Chainable<Element>
|
||||
getSimpleRendererBody(): Chainable<Element>
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,10 +37,6 @@ Cypress.Commands.add('getMarkdownBody', () => {
|
|||
return cy.getIframeBody(RendererType.DOCUMENT).findByCypressId('markdown-body')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('getIntroBody', () => {
|
||||
return cy.getIframeBody(RendererType.INTRO).findByCypressId('markdown-body')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('getMotdBody', () => {
|
||||
return cy.getIframeBody(RendererType.MOTD).findByCypressId('markdown-body')
|
||||
Cypress.Commands.add('getSimpleRendererBody', () => {
|
||||
return cy.getIframeBody(RendererType.SIMPLE).findByCypressId('markdown-body')
|
||||
})
|
||||
|
|
|
@ -20,7 +20,7 @@ exports[`motd modal renders a modal if a motd was fetched and can dismiss it 1`]
|
|||
data-testid="motd-renderer"
|
||||
>
|
||||
This is a mock implementation of a iframe renderer. Props:
|
||||
{"frameClasses":"w-100","rendererType":"motd","markdownContentLines":["very important mock text!"],"adaptFrameHeightToContent":true}
|
||||
{"frameClasses":"w-100","rendererType":"simple","markdownContentLines":["very important mock text!"],"adaptFrameHeightToContent":true}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
|
|
|
@ -57,7 +57,7 @@ export const MotdModal: React.FC = () => {
|
|||
<EditorToRendererCommunicatorContextProvider>
|
||||
<RenderIframe
|
||||
frameClasses={'w-100'}
|
||||
rendererType={RendererType.MOTD}
|
||||
rendererType={RendererType.SIMPLE}
|
||||
markdownContentLines={lines as string[]}
|
||||
adaptFrameHeightToContent={true}
|
||||
/>
|
||||
|
|
|
@ -30,7 +30,7 @@ export const IntroCustomContent: React.FC = () => {
|
|||
<RenderIframe
|
||||
frameClasses={'w-100 overflow-y-hidden'}
|
||||
markdownContentLines={value as string[]}
|
||||
rendererType={RendererType.INTRO}
|
||||
rendererType={RendererType.SIMPLE}
|
||||
forcedDarkMode={true}
|
||||
adaptFrameHeightToContent={true}
|
||||
/>
|
||||
|
|
|
@ -146,8 +146,7 @@ export const IframeMarkdownRenderer: React.FC = () => {
|
|||
slideOptions={slideOptions}
|
||||
/>
|
||||
)
|
||||
case RendererType.MOTD:
|
||||
case RendererType.INTRO:
|
||||
case RendererType.SIMPLE:
|
||||
return (
|
||||
<MarkdownDocument
|
||||
additionalOuterContainerClasses={'vh-100 bg-light overflow-y-hidden'}
|
||||
|
|
|
@ -129,9 +129,8 @@ export type RendererToEditorMessageType =
|
|||
|
||||
export enum RendererType {
|
||||
DOCUMENT = 'document',
|
||||
INTRO = 'intro',
|
||||
SLIDESHOW = 'slideshow',
|
||||
MOTD = 'motd'
|
||||
SIMPLE = 'simple',
|
||||
SLIDESHOW = 'slideshow'
|
||||
}
|
||||
|
||||
export interface BaseConfiguration {
|
||||
|
|
Loading…
Reference in a new issue