Explorar o código

Merge pull request #7555 from weseek/fix/render-drawio-uncompressed-data-with-linebreaks

fix(drawio): Render uncompressed data when line-breaks option is set
Yuki Takei %!s(int64=3) %!d(string=hai) anos
pai
achega
ec3070275e
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      packages/remark-drawio/src/components/DrawioViewer.tsx

+ 3 - 1
packages/remark-drawio/src/components/DrawioViewer.tsx

@@ -84,7 +84,9 @@ export const DrawioViewer = React.memo((props: DrawioViewerProps): JSX.Element =
     }
 
     const code = children instanceof Array
-      ? children.map(e => e?.toString()).join('')
+      ? children
+        .filter(elem => (typeof elem === 'string')) // omit non-string elements (e.g. br element generated by line-breaks option)
+        .join('')
       : children.toString();
 
     let mxgraphData;