Skip to content

Commit

Permalink
fix(extension-code): remove negative lookbehind (#5916)
Browse files Browse the repository at this point in the history
  • Loading branch information
lino-levan authored Dec 5, 2024
1 parent a8d37ee commit b08c94c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/itchy-carrots-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tiptap/extension-code": patch
---

Implement `inputRegex` and `pasteRegex` while avoiding lookbehind for compatibility with safari versions older than 16.4
4 changes: 2 additions & 2 deletions packages/extension-code/src/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ declare module '@tiptap/core' {
* This ensures that any text between backticks is formatted as code,
* regardless of the surrounding characters (exception being another backtick).
*/
export const inputRegex = /(?<!`)`([^`]+)`(?!`)/
export const inputRegex = /(^|[^`])`([^`]+)`(?!`)/

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

/**
* This extension allows you to mark text as inline code.
Expand Down

0 comments on commit b08c94c

Please sign in to comment.