liveblog icon indicating copy to clipboard operation
liveblog copied to clipboard

Adding <span> tag crashes React app

Open paulschreiber opened this issue 7 years ago • 3 comments

1 Click Text tab 2 Enter <span style="color: red;">hello</span> world 3 Click Visual Tab

React app disappears from screen — all entries are gone.

Console shows:

app.js?ver=1.8.0:14 Error: Minified React error #62; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=62&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at r (app.js?ver=1.8.0:14)
    at rn (app.js?ver=1.8.0:14)
    at ln (app.js?ver=1.8.0:14)
    at finalizeInitialChildren (app.js?ver=1.8.0:22)
    at completeWork (app.js?ver=1.8.0:14)
    at n (app.js?ver=1.8.0:14)
    at i (app.js?ver=1.8.0:14)
    at a (app.js?ver=1.8.0:14)
    at s (app.js?ver=1.8.0:14)
    at w (app.js?ver=1.8.0:14)
    at b (app.js?ver=1.8.0:14)
    at batchedUpdates (app.js?ver=1.8.0:14)
    at Z (app.js?ver=1.8.0:14)
    at De (app.js?ver=1.8.0:14)
u @ app.js?ver=1.8.0:14
s @ app.js?ver=1.8.0:14
w @ app.js?ver=1.8.0:14
b @ app.js?ver=1.8.0:14
batchedUpdates @ app.js?ver=1.8.0:14
Z @ app.js?ver=1.8.0:14
De @ app.js?ver=1.8.0:14

The full text of the error is:

The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.

paulschreiber avatar May 01 '18 14:05 paulschreiber

@jasonagnew Is this something you're able to take a look at? I confirmed it locally.

philipjohn avatar May 10 '18 17:05 philipjohn

@philipjohn @jasonagnew This is likely related to this https://github.com/Automattic/liveblog/blob/master/src/react/Editor/convertFromHTML.js#L23. Text element attributes need to be mapped from HTML attributes to props that React understand.

liamdefty avatar May 31 '18 11:05 liamdefty

Our version (which uses TinyMCE) avoids this problem.

paulschreiber avatar Jun 01 '18 02:06 paulschreiber