mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 14:13:21 +08:00
fix(extension/link): 🐛 fix last word value not being passed through when undefined (#3258)
This commit is contained in:
parent
801b436d7a
commit
69923e2b0e
@ -89,9 +89,18 @@ export function autolink(options: AutolinkOptions): Plugin {
|
||||
|
||||
if (textBlock && textBeforeWhitespace) {
|
||||
const wordsBeforeWhitespace = textBeforeWhitespace.split(' ').filter(s => s !== '')
|
||||
|
||||
if (wordsBeforeWhitespace.length <= 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
const lastWordBeforeSpace = wordsBeforeWhitespace[wordsBeforeWhitespace.length - 1]
|
||||
const lastWordAndBlockOffset = textBlock.pos + textBeforeWhitespace.lastIndexOf(lastWordBeforeSpace)
|
||||
|
||||
if (!lastWordBeforeSpace) {
|
||||
return false
|
||||
}
|
||||
|
||||
find(lastWordBeforeSpace)
|
||||
.filter(link => link.isLink)
|
||||
.filter(link => {
|
||||
|
Loading…
Reference in New Issue
Block a user