Fix merging single message entities
This commit is contained in:
parent
2e2c8218f2
commit
6a424aa385
|
@ -4,7 +4,7 @@
|
|||
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
import {MARKDOWN_ENTITIES_TYPES, PASS_CONFLICTING_ENTITIES} from '.';
|
||||
import {PASS_CONFLICTING_ENTITIES, PASS_SINGLE_CONFLICTING_ENTITIES} from '.';
|
||||
import {MessageEntity} from '../../layer';
|
||||
|
||||
const SINGLE_ENTITIES: Set<MessageEntity['_']> = new Set(['messageEntityPre', 'messageEntityCode']);
|
||||
|
@ -16,7 +16,7 @@ export default function findConflictingEntity(currentEntities: MessageEntity[],
|
|||
singleEnd = currentEntity.offset + currentEntity.length;
|
||||
}
|
||||
|
||||
if(newEntity.offset < singleEnd && MARKDOWN_ENTITIES_TYPES.has(newEntity._)) {
|
||||
if(newEntity.offset < singleEnd && !PASS_SINGLE_CONFLICTING_ENTITIES.has(newEntity._)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ export const PASS_CONFLICTING_ENTITIES: Set<MessageEntity['_']> = new Set([
|
|||
'messageEntityLinebreak',
|
||||
'messageEntityCaret'
|
||||
]);
|
||||
export const PASS_SINGLE_CONFLICTING_ENTITIES = new Set(PASS_CONFLICTING_ENTITIES);
|
||||
for(const i in MARKDOWN_ENTITIES) {
|
||||
PASS_CONFLICTING_ENTITIES.add(MARKDOWN_ENTITIES[i]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue