Merge pull request #294 from answerdev/feat/1.0.8/ui

fix: fixed the BR tag in the editor block formula HTML caused renderi…
This commit is contained in:
dashuai
2023-03-28 16:32:56 +08:00
committed by GitHub
+7
View File
@@ -80,6 +80,13 @@ export function createEditorUtils(
export function htmlRender(el: HTMLElement | null) {
if (!el) return;
// Replace all br tags with newlines
// Fixed an issue where the BR tag in the editor block formula HTML caused rendering errors.
el.querySelectorAll('br').forEach((br) => {
br.parentNode?.insertBefore(document.createTextNode('\n'), br);
br.parentNode?.removeChild(br);
});
import('mermaid').then(({ default: mermaid }) => {
mermaid.initialize({ startOnLoad: false });