Skip to content

Commit

Permalink
fix:(bold-and-italics): Disallow only whitespace in the markdown shor…
Browse files Browse the repository at this point in the history
…tcuts (#651)
  • Loading branch information
rfgamaral committed Feb 8, 2024
1 parent 9c2cd0f commit df9d557
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/extensions/rich-text/bold-and-italics.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Mark, markInputRule, markPasteRule } from '@tiptap/core'

const starInputRegex = /(?:^|\s)((?:\*{3})((?:[^*]+))(?:\*{3}))$/
const starPasteRegex = /(?:^|\s)((?:\*{3})((?:[^*]+))(?:\*{3}))/g
const underscoreInputRegex = /(?:^|\s)((?:_{3})((?:[^_]+))(?:_{3}))$/
const underscorePasteRegex = /(?:^|\s)((?:_{3})((?:[^_]+))(?:_{3}))/g
export const starInputRegex = /(?:^|\s)(\*\*\*(?!\s+\*\*\*)((?:[^*]+))\*\*\*(?!\s+\*\*\*))$/
export const starPasteRegex = /(?:^|\s)(\*\*\*(?!\s+\*\*\*)((?:[^*]+))\*\*\*(?!\s+\*\*\*))/g
export const underscoreInputRegex = /(?:^|\s)(___(?!\s+___)((?:[^_]+))___(?!\s+___))$/
export const underscorePasteRegex = /(?:^|\s)(___(?!\s+___)((?:[^_]+))___(?!\s+___))/g

/**
* The `BoldAndItalics` extension adds the ability to use the `***` and `___` Markdown shortcuts
Expand Down

0 comments on commit df9d557

Please sign in to comment.