mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-28 07:40:13 +08:00
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:
parent
d8ef1593af
commit
503a3f2cf5
@ -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 }
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user