2000calories / flutter_easy_rich_text

The EasyRichText widget provides an easy way to use RichText.
https://pub.dev/packages/easy_rich_text
MIT License
79 stars 34 forks source link

Bug in Safari #37

Closed larryrobinson closed 1 year ago

larryrobinson commented 1 year ago

The RegEx for doing pattern matches in easy_rich_text does not work in the Safari browser. Below is the code sample that blows up Safari and I've also attached a screen shot of the error message in the browser.

`

Widget instructions() { return Padding( padding: const EdgeInsets.only(left: 0, right: 0), child: EasyRichText( "Below are the menu images that have been uploaded. Select one and then click items.", defaultStyle: instructionStyle, patternList: [ EasyRichTextPattern( targetString: 'items', style: instructionStyle.copyWith(fontWeight: FontWeight.bold), ), ], ), ); }

`

Screen Shot 2022-10-07 at 12 02 26 PM

2000calories commented 1 year ago

Currently, the core function of EasyRichText requires lookbehind in Regex. However Safari does not support lookbehind. I could add an option to skip the lookbehind to avoid the error. But most of EasyRichText 's functions will be lost.

9

larryrobinson commented 1 year ago

I suspected this was the case. I think people have been asking the Safari team to enable look behind since at least 2018. We've had to rewrite some of our RegEx statements to not use look behind and that makes RegEx even more unpalatable than it already is.

I appreciate the offer for adding an option but that negates all the great functionality of the package. We will find another way to get done what we need. Thanks for all your work and support on EasyRichText. It's a really nice package.

Feel free to close this issue. Thanks again!

iabdousd commented 1 year ago

Hey @larryrobinson, did you find a way to fix this?

larryrobinson commented 1 year ago

@iabdousd Unfortunately not. As I mentioned above Safari's implementation of RegEx doesn't do look behind and EasyRichText relies on it to work properly. We ended reverting back to Flutter's Rich Text control which works great across all browsers but the code is more verbose.