Render quoted mentions as text
This commit is contained in:
parent
bc3b61db1d
commit
2d5292b2f3
7 changed files with 26 additions and 32 deletions
12
ts/util/getTextWithMentions.ts
Normal file
12
ts/util/getTextWithMentions.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { BodyRangesType } from '../types/Util';
|
||||
|
||||
export function getTextWithMentions(
|
||||
bodyRanges: BodyRangesType,
|
||||
text: string
|
||||
): string {
|
||||
return bodyRanges.reduce((str, range) => {
|
||||
const textBegin = str.substr(0, range.start);
|
||||
const textEnd = str.substr(range.start + range.length, str.length);
|
||||
return `${textBegin}@${range.replacementText}${textEnd}`;
|
||||
}, text);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue