uiwjs / react-md-editor

A simple markdown editor with preview, implemented with React.js and TypeScript.
https://uiwjs.github.io/react-md-editor
MIT License
2.15k stars 155 forks source link

Multiline code block crashing page #559

Open ntcnjl opened 1 year ago

ntcnjl commented 1 year ago

When using the ``` code block, the whole page crashes with multiple errors in the console:

react-dom.development.js:18687 The above error occurred in the <ReactMarkdown> component:

    at ReactMarkdown (https://website/static/js/bundle.js:233154:42)
    at div
    at https://website/static/js/bundle.js:38066:32
    at div
    at div
    at div
    at https://website/static/js/bundle.js:38452:70
    at div
    at AjaxElementLoader (https://website/static/js/bundle.js:933:143)
    at AjaxWidgetLoader (https://website/static/js/bundle.js:1041:143)
    at Note (https://website/static/js/bundle.js:14205:143)
    at ConnectFunction (https://website/static/js/bundle.js:159021:68)
    at div
    at div
    at Widget (https://website/static/js/bundle.js:9445:143)
    at div
    at Resizable (https://website/static/js/bundle.js:161498:35)
    at DraggableCore (https://website/static/js/bundle.js:150793:5)
    at GridItem (https://website/static/js/bundle.js:152323:5)
    at div
    at ReactGridLayout (https://website/static/js/bundle.js:153240:5)
    at ResponsiveReactGridLayout (https://website/static/js/bundle.js:154546:5)
    at WidthProvider (https://website/static/js/bundle.js:155303:7)
    at DashboardGrid (https://website/static/js/bundle.js:2490:143)
    at ConnectFunction (https://website/static/js/bundle.js:159021:68)
    at section
    at App (https://website/static/js/bundle.js:1317:143)
    at ConnectFunction (https://website/static/js/bundle.js:159021:68)
    at CatchError (https://website/static/js/bundle.js:2074:143)
    at Provider (https://website/static/js/bundle.js:158723:20)

React will try to recreate this component tree from scratch using the error boundary you provided, CatchError.

TypeError: N.entries is not a function
    at l (generator.js:304:1)
    at overload (index.js:173:1)
    at node (element<code>) (index.js:189:1)
    at node (element<pre>) (index.js:206:1)
    at node (root) (index.js:206:1)
    at visitParents (index.js:148:1)
    at visit (index.js:165:1)
    at generator.js:177:1
    at wrapped (index.js:115:1)
    at next (index.js:65:1) 

I am using the latest version with react 18.2.0, and have tried copying directly from the README and the error still occurs

jaywcjlove commented 1 year ago
image

I can't reproduce your error.

@ntcnjl

ntcnjl commented 1 year ago

Im using node 18.14.2, could that be causing issues?

jaywcjlove commented 1 year ago
image

@ntcnjl I can't reproduce your error

ntcnjl commented 1 year ago

I've been able to fix it by switching to a react-markdown for the preview which works fine

jaywcjlove commented 1 year ago

@ntcnjl If you can provide a reproducible example, I can help you take a look