mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-25 21:35:53 +08:00
add text and fullText to suggestion callbacks
This commit is contained in:
parent
8b9d94000d
commit
07aa821d92
@ -48,7 +48,14 @@ export function triggerCharacter(char, { allowSpaces = false, startOfLine = fals
|
|||||||
|
|
||||||
// If the $position is located within the matched substring, return that range
|
// If the $position is located within the matched substring, return that range
|
||||||
if (from < $position.pos && to >= $position.pos) {
|
if (from < $position.pos && to >= $position.pos) {
|
||||||
return { range: { from, to }, text: match[0] }
|
return {
|
||||||
|
range: {
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
},
|
||||||
|
text: match[0].slice(char.length),
|
||||||
|
fullText: match[0],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,6 +95,7 @@ export function suggestionsPlugin({
|
|||||||
view,
|
view,
|
||||||
range: prev.range,
|
range: prev.range,
|
||||||
text: prev.text,
|
text: prev.text,
|
||||||
|
fullText: prev.fullText,
|
||||||
decorationNode,
|
decorationNode,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -97,6 +105,7 @@ export function suggestionsPlugin({
|
|||||||
view,
|
view,
|
||||||
range: next.range,
|
range: next.range,
|
||||||
text: next.text,
|
text: next.text,
|
||||||
|
fullText: next.fullText,
|
||||||
decorationNode,
|
decorationNode,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -106,6 +115,7 @@ export function suggestionsPlugin({
|
|||||||
view,
|
view,
|
||||||
range: next.range,
|
range: next.range,
|
||||||
text: next.text,
|
text: next.text,
|
||||||
|
fullText: next.fullText,
|
||||||
decorationNode,
|
decorationNode,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -124,6 +134,7 @@ export function suggestionsPlugin({
|
|||||||
active: false,
|
active: false,
|
||||||
range: {},
|
range: {},
|
||||||
text: null,
|
text: null,
|
||||||
|
fullText: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -157,6 +168,7 @@ export function suggestionsPlugin({
|
|||||||
next.decorationId = prev.decorationId ? prev.decorationId : decorationId
|
next.decorationId = prev.decorationId ? prev.decorationId : decorationId
|
||||||
next.range = match.range
|
next.range = match.range
|
||||||
next.text = match.text
|
next.text = match.text
|
||||||
|
next.fullText = match.fullText
|
||||||
} else {
|
} else {
|
||||||
next.active = false
|
next.active = false
|
||||||
}
|
}
|
||||||
@ -169,6 +181,7 @@ export function suggestionsPlugin({
|
|||||||
next.decorationId = null
|
next.decorationId = null
|
||||||
next.range = {}
|
next.range = {}
|
||||||
next.text = null
|
next.text = null
|
||||||
|
next.fullText = null
|
||||||
}
|
}
|
||||||
|
|
||||||
return next
|
return next
|
||||||
|
Loading…
Reference in New Issue
Block a user