cmfcmf / docusaurus-search-local

Offline / Local Search for Docusaurus v2. Try it live at:
https://cmfcmf.github.io/OpenWeatherMap-PHP-API/
MIT License
441 stars 67 forks source link

Lookbehind regexp causing crash on Safari #18

Closed petrmiko closed 3 years ago

petrmiko commented 3 years ago

Bug description

Safari does not support yet lookbehind regexps, current SearchBar implementation causes crash - blank screen with error in console:

Unhandled Promise Rejection: SyntaxError: Invalid regular expression: invalid group specifier name

Reproduction

Opening docusarus page with in Safari browser.

Package Versions

affected in docusaurus-search-local on version >= 0.2.0, but in my case

"@cmfcmf/docusaurus-search-local": "0.3.0", "@docusaurus/core": "2.0.0-alpha.59", "@docusaurus/plugin-content-docs": "2.0.0-alpha.59", "@docusaurus/plugin-content-pages": "2.0.0-alpha.59", "@docusaurus/theme-classic": "2.0.0-alpha.59",

Node Version

14

petrmiko commented 3 years ago

Cause of the issue - https://github.com/cmfcmf/docusaurus-search-local/blob/master/src/theme/SearchBar/index.js#L121

cmfcmf commented 3 years ago

Thank you for reporting this issue! This should be fixed in 0.3.1 - I don't have access to Safari to verify the fix, but since I no longer use a negative lookbehind it should be fine. Please note that the plugin may not yet be compatible with the latest Docusaurus v2 beta - I'll be working on ensuring compatibility there next.

cmfcmf commented 3 years ago

FYI: I've now also published 0.4.0, which adds compatibility with and requires Docusaurus alpha 66.

petrmiko commented 3 years ago

Thank you for fixing it that quickly!