Preview not working with Edge

We have a hosted Discourse, and today few people have complained that preview does not work with Edge (at least version 40)

Repro steps:

  • Create a new topic
  • Start writing a message
  • Preview area on the right stays blank (expected: preview shows formatted text as you type)
  • Console displays error message after each character typed, see image

6 Likes

Yep, I can repro on Edge latest.

Microsoft Edge 44.17763.1.0
Microsoft EdgeHTML 18.17763

Not sure when Edge turns into Chrome, looks like “Fall 2019”.

7 Likes

Ok this was kind of tricky to find the root cause, thanks to stellar debugging tools from edge.

So it happens edge has stellar Regexp support (a pattern is emerging) and will result in this:

Edge:

Chrome:

Making this line of Discourse fail https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/engines/discourse-markdown/text-post-process.js.es6#L24 spectacularly.

I was about to write a fix for this case, but @zogstrip found a polyfill, which is probably way better as it will prevent this from happening in any other place in the app.

https://github.com/discourse/discourse/pull/7460

Thanks for reporting this @MikkoH

9 Likes