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