From 503a3f2cf508271cc303fb918568dc8c9b900055 Mon Sep 17 00:00:00 2001 From: Nokola Date: Mon, 11 Oct 2021 11:35:33 -0700 Subject: [PATCH] fix: Fix #2016 Image input rule (#2020) Image input rule leaves erroneous text behind due to my previous change to add group matching in #1574. This change adds a `( ... )` regex group around the image input rule to have it work with the new code. --- packages/extension-image/src/image.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/extension-image/src/image.ts b/packages/extension-image/src/image.ts index 66e01791c07..c7afb83ef7c 100644 --- a/packages/extension-image/src/image.ts +++ b/packages/extension-image/src/image.ts @@ -20,7 +20,7 @@ declare module '@tiptap/core' { } } -export const inputRegex = /!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/ +export const inputRegex = /(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))/ export const Image = Node.create({ name: 'image', @@ -83,7 +83,7 @@ export const Image = Node.create({ find: inputRegex, type: this.type, getAttributes: match => { - const [, alt, src, title] = match + const [,, alt, src, title] = match return { src, alt, title } },