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

[Bug]: Negative lookahead prevents loading on Safari on iOS 15.7 #5948

Closed
1 task done
Nantris opened this issue Dec 19, 2024 · 4 comments
Closed
1 task done

[Bug]: Negative lookahead prevents loading on Safari on iOS 15.7 #5948

Nantris opened this issue Dec 19, 2024 · 4 comments
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@Nantris
Copy link
Contributor

Nantris commented Dec 19, 2024

Affected Packages

extension-code

Version(s)

2.10.4

Bug Description

These lines cause Safari to fail to load the page on these older versions:

export const inputRegex = /(^|[^`])`([^`]+)`(?!`)/
/**
* Matches inline code while pasting.
*/
export const pasteRegex = /(^|[^`])`([^`]+)`(?!`)/g

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

Safari on iOS 15.7 is supported.

Last known working in 2.10.0

Additional Context (Optional)

Presumably first broken here: f79c05e

This can be worked around for a "best of both worlds" approach - but it's probably best done one a project-wide level rather than locally in the file so I'm not sure how the team will want to handle this.

We use an approach like this:

checkLookBehindSupport.js

function checkLookBehindSupport() {
  try {
    new RegExp('(?<=<kbd>)[sS]+(?=</kbd>)');
    return true;
  } catch {
    return false;
  }
}

export const supportsLookBehind = checkLookBehindSupport();

and then wherever else in the project:

import { supportsLookBehind } from './supportsLookBehind';

export const matcherRegex = supportsLookBehind
  ? // eslint-disable-next-line prefer-regex-literals -- iOS 15.x support
    new RegExp('our-advanced-regex')
  : /our-basic-regex/;

Dependency Updates

  • Yes, I've updated all my dependencies.
@Nantris Nantris added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Dec 19, 2024
@Nantris
Copy link
Contributor Author

Nantris commented Dec 19, 2024

@nperez0111 sorry to ping - this is a blocker for us and patching is not so easy in our setup so I'm hoping to avoid it. Any thoughts on the approach outlined above?

@Nantris
Copy link
Contributor Author

Nantris commented Dec 19, 2024

Accidental duplicate of #5889.

@nperez0111
Copy link
Contributor

Yes, this is a dupe

@Nantris
Copy link
Contributor Author

Nantris commented Dec 31, 2024

You're absolutely right. I thought that iOS 15.x still had an additional issue to resolve but I was mistaken. Sorry for the noise/clutter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

2 participants