fix: Render Mermaid diagrams in HTML export, towards #6205

This commit is contained in:
Tom Moor
2023-11-23 09:05:40 -05:00
parent ea8ebc3b2a
commit 8b68ee404a
4 changed files with 57 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ export type Props = {
rtl: boolean;
readOnly?: boolean;
readOnlyWriteCheckboxes?: boolean;
staticHTML?: boolean;
editorStyle?: React.CSSProperties;
grow?: boolean;
theme: DefaultTheme;
@@ -260,6 +261,16 @@ const emailStyle = (props: Props) => css`
}
`;
const printStyle = (props: Props) => css`
${props.staticHTML &&
`
body {
height: auto;
min-height: 0;
}
`}
`;
const style = (props: Props) => `
flex-grow: ${props.grow ? 1 : 0};
justify-content: start;
@@ -1128,7 +1139,7 @@ mark {
/* Hide code without display none so toolbar can still be positioned against it */
&:not(.code-active) {
height: 0;
height: ${props.staticHTML ? "auto" : "0"};
margin: -0.5em 0;
overflow: hidden;
}
@@ -1136,7 +1147,7 @@ mark {
/* Hide code without display none so toolbar can still be positioned against it */
.ProseMirror[contenteditable="false"] .code-block[data-language=mermaidjs] {
height: 0;
height: ${props.staticHTML ? "auto" : "0"};
margin: -0.5em 0;
overflow: hidden;
}
@@ -1559,6 +1570,7 @@ const EditorContainer = styled.div<Props>`
${codeBlockStyle}
${findAndReplaceStyle}
${emailStyle}
${printStyle}
`;
export default EditorContainer;