Skip to content

Commit

Permalink
fix: Fix #2016 Image input rule (#2020)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nokola authored Oct 11, 2021
1 parent d8ef159 commit 503a3f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/extension-image/src/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 }
},
Expand Down

0 comments on commit 503a3f2

Please sign in to comment.