fix: markdown editor crashes on older iOS/Safari due to unsupported regex#4349
fix: markdown editor crashes on older iOS/Safari due to unsupported regex#4349cemreinanc merged 2 commits intomainfrom
Conversation
Cleanup: Preview Environment RemovedThe preview environment for this PR has been destroyed.
Cleanup triggered by PR close at 2026-02-16T11:45:27Z |
📝 WalkthroughWalkthroughThis pull request fixes a critical compatibility issue affecting older iOS/Safari versions by removing unsupported negative lookbehind regex patterns from the markdown editor. The math expression preprocessing logic is restructured to use position-aware escaping detection instead of lookaround assertions, with corresponding updates to dollar sign escaping and new test coverage for edge cases. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
front_end/src/components/markdown_editor/plugins/equation/components/equation_editor.tsx (1)
19-24: Good: removes negative lookbehind for Safari compatibility.One minor note: this only checks a single preceding
\, whereashelpers.tsusesisEscapedAtwhich correctly handles consecutive backslashes (e.g.,\\$where the backslash itself is escaped). In the equation editor context this is unlikely to matter, but importing and reusingisEscapedAtwould improve consistency.♻️ Optional: use isEscapedAt for consistency
+import { isEscapedAt } from "../../helpers"; // would need to export it + value = value.replace(/\$/g, (match, offset, input) => { - if (offset > 0 && input[offset - 1] === "\\") { + if (isEscapedAt(input, offset)) { return match; } return "\\$"; });
Fixes #4238
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests