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.
This commit is contained in:
Nokola 2021-10-11 11:35:33 -07:00 committed by GitHub
parent d8ef1593af
commit 503a3f2cf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<ImageOptions>({
name: 'image',
@ -83,7 +83,7 @@ export const Image = Node.create<ImageOptions>({
find: inputRegex,
type: this.type,
getAttributes: match => {
const [, alt, src, title] = match
const [,, alt, src, title] = match
return { src, alt, title }
},