Relax the requirement that post entities match their value
This commit is contained in:
@@ -81,13 +81,8 @@ function* toSegments(text: string, entities: Entity[]) {
|
|||||||
}
|
}
|
||||||
if (currEnt.index.start < currEnt.index.end) {
|
if (currEnt.index.start < currEnt.index.end) {
|
||||||
let subtext = text.slice(currEnt.index.start, currEnt.index.end)
|
let subtext = text.slice(currEnt.index.start, currEnt.index.end)
|
||||||
if (
|
if (!subtext.trim()) {
|
||||||
!subtext.trim() ||
|
// dont yield links to empty strings
|
||||||
(currEnt.type === 'mention' &&
|
|
||||||
stripUsername(subtext) !== stripUsername(currEnt.value)) ||
|
|
||||||
(currEnt.type === 'link' && !isSameLink(subtext, currEnt.value))
|
|
||||||
) {
|
|
||||||
// dont yield links to empty strings or strings that don't match the entity value
|
|
||||||
yield subtext
|
yield subtext
|
||||||
} else {
|
} else {
|
||||||
yield {
|
yield {
|
||||||
|
|||||||
Reference in New Issue
Block a user