Quote: Fix highlight after message editing (#5987)
This commit is contained in:
parent
c226e8fc0b
commit
e1fd770402
@ -74,7 +74,8 @@ function MessageText({
|
||||
const entitiesWithFocusedQuote = useMemo(() => {
|
||||
if (!text || !focusedQuote) return entities;
|
||||
|
||||
const index = text.indexOf(focusedQuote, focusedQuoteOffset);
|
||||
const offsetIndex = text.indexOf(focusedQuote, focusedQuoteOffset);
|
||||
const index = offsetIndex >= 0 ? offsetIndex : text.indexOf(focusedQuote); // Fallback to first occurrence
|
||||
const lendth = focusedQuote.length;
|
||||
if (index >= 0) {
|
||||
return insertTextEntity(entities || [], {
|
||||
|
||||
@ -314,7 +314,8 @@ export function insertTextEntity(entities: ApiMessageEntity[], newEntity: ApiMes
|
||||
if (existingEntityEnd <= newEntityStart
|
||||
|| existingEntityStart > newEntityEnd
|
||||
|| (existingEntityStart > newEntityStart
|
||||
&& existingEntityEnd < newEntityEnd)) {
|
||||
&& existingEntityEnd < newEntityEnd)
|
||||
|| (existingEntityStart === newEntityStart && existingEntityEnd === newEntityEnd)) {
|
||||
resultEntities.push(existingEntity);
|
||||
continue;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user