Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix article doesn't display in Safari #261

Closed
wants to merge 4 commits into from

Conversation

yuxin1234
Copy link

@yuxin1234 yuxin1234 commented Nov 1, 2022

Resolves #260

@sstur
Copy link
Owner

sstur commented Nov 1, 2022

HI @yuxin1234, thanks for the contribution!

Could you please add one or more tests to ensure this does what's expected. It's hard to tell by looking at Regex if it will work right, so adding some tests would be hugely helpful. Ideally a test for such a fix should fail before this patch but pass afterwards.

Note: I just pushed a commit to master to enable automated tests via Github Actions, so please do a git pull.

Thanks!

@yuxin1234
Copy link
Author

@sstur That's a good suggestion. Thanks. I'll write tests.

@ptimson
Copy link

ptimson commented Nov 3, 2022

Hey I have the same issue. I had ago at mimicking the regex without the negative lookbehind and came up with:
^_([\s\S]*?[^\\])_. Would need to write some unit tests as @sstur suggested. Hope this helps happy to contribute :)

@yuxin1234
Copy link
Author

@ptimson Thanks Peter. Please feel free to push your changes to this PR

@ptimson
Copy link

ptimson commented Nov 3, 2022

I dont think I can push to your repo I would have to make my own PR. I believe there a bunch of tests already for this I believe ^_([\s\S]*?[^\\])_ should work just a case of updating the regex and making sure they still pass.

@yuxin1234
Copy link
Author

@ptimson sounds good. Thanks.

@luwangshell
Copy link

Hi @sstur any chance you can review the PR? much appreciated.

@yuxin1234
Copy link
Author

@sstur could you please approve me running workflows? Thank you.

@yuxin1234
Copy link
Author

@sstur I have added unit test. Could you please review the PR? Thank you.

@yuxin1234
Copy link
Author

@sstur Simon, did you see my previous messages?

@MSGInsurIt
Copy link
Contributor

Hi,
@yuxin1234 in your tests you only check one possible scenario. you should make multiple scenarios, otherwise, this regex will break some valid scenarios.

Please take a look at this comment and the merge mentioned:
#255 (comment)

@yuxin1234
Copy link
Author

@MSGInsurlt Thanks Joao. Will do.

@yuxin1234
Copy link
Author

@MSGInsurIt I added tests for 5 more different scenarios. All the tests passed locally.

@MSGInsurIt
Copy link
Contributor

MSGInsurIt commented Dec 22, 2022

Hi @yuxin1234,

I just noticed something on your tests, are you really testing markdown?
This "let markdown = '<p><em><strong>BoldItalic</strong></em></p>';" does not seem to be markdown language...

Other than that, why not use tests added in the https://github.com/sstur/draft-js-utils/pull/254/files ???

And the look behind expression has been corrected in the safari browser I suppose that only the update on safari is needed

@yuxin1234
Copy link
Author

yuxin1234 commented Dec 27, 2022

@MSGInsurIt Happy holidays! As you mentioned, since regex lookbehind has been fixed in WebKit, we just need wait for an updated Safari that supports negative lookbehind, so we probably don't need this PR anymore.

@yuxin1234 yuxin1234 closed this Dec 27, 2022
@GeyseR
Copy link

GeyseR commented Jul 15, 2024

@yuxin1234 @MSGInsurIt I think we should re-cosider closing this PR and fix the issue. While the issue has been fixed a long time ago, occasional update of the minor version of the library (from 1.4.0 to 1.4.1) broke our app for many users who still use the older Safari versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Article does not show up in Safari
6 participants