Add 100 character buffer to read more
This commit is contained in:
parent
c9678c4877
commit
29b4148889
2 changed files with 37 additions and 22 deletions
|
@ -25,6 +25,7 @@ export type Props = Pick<
|
|||
|
||||
const INITIAL_LENGTH = 800;
|
||||
const INCREMENT_COUNT = 3000;
|
||||
const BUFFER = 100;
|
||||
|
||||
function graphemeAwareSlice(
|
||||
str: string,
|
||||
|
@ -33,7 +34,7 @@ function graphemeAwareSlice(
|
|||
hasReadMore: boolean;
|
||||
text: string;
|
||||
} {
|
||||
if (str.length <= length) {
|
||||
if (str.length <= length + BUFFER) {
|
||||
return { text: str, hasReadMore: false };
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue