diff --git a/playwright/e2e/input-rules.spec.ts b/playwright/e2e/input-rules.spec.ts index 3cebc251bbc..a7d6851d88c 100644 --- a/playwright/e2e/input-rules.spec.ts +++ b/playwright/e2e/input-rules.spec.ts @@ -18,3 +18,16 @@ test('applies code mark input rule with preceding character (#5483)', async ({ await expect(editor.el.locator('code')).toHaveText('code') await expect(editor.el.locator('p').first()).toHaveText('hello inline (code)') }) + +test('applies link mark input rule with dot in text (#7872)', async ({ + editor, + open, +}) => { + await open() + await editor.type('[example.org](https://example.org)') + await expect(editor.el.locator('a').first()).toHaveText('example.org') + await expect(editor.el.locator('a').first()).toHaveAttribute( + 'href', + 'https://example.org', + ) +}) diff --git a/src/marks/Link.ts b/src/marks/Link.ts index e506553cc85..99d6e8dcfe7 100644 --- a/src/marks/Link.ts +++ b/src/marks/Link.ts @@ -161,7 +161,7 @@ const Link = TipTapLink.extend({ }, addInputRules() { - const linkInputRegex = /(?:^|\s)\[([\w|\s|-]+)\]\((?.+?)\)$/gm + const linkInputRegex = /(?:^|\s)\[([^[\]]+)\]\((?.+?)\)$/gm return [ markInputRule({ find: linkInputRegex,