Open hardeep360 opened 3 months ago
maybe this would be the solution and you might can optimize it From Line 190:
//again for summTaglessData = summaryText.replace(rOpenCloseTag, ''); summTaglessDataLength = summTaglessData.length; summTagless = summTaglessDataLength;
detailsTaglessData = allHtml.substring(summaryText.length).replace(rOpenCloseTag, '');
let summaryLast5Chars = summTaglessData.substring(summTaglessData.length - 5);
let detailsFirst5Chars = detailsTaglessData.substring(0, 5);
if ((summaryLast5Chars + detailsFirst5Chars).indexOf(' ') > 0) {
let nextCharTotalLenth = summaryText.length + detailsFirst5Chars.split(';')[0].length + 1;
let summeryTotalLength = summaryText.length;
while(summeryTotalLength < nextCharTotalLenth) {
summaryText += allHtml.charAt(summeryTotalLength);
summeryTotalLength++;
summTaglessDataLength++;
}
}
If there are too many spaces with then it starts to count each char separately and show very little text. Other thing is it divides wrongs between summarytext and details.
For example: & start to show in summary text and nbsp; start to show in details text.
However, I made a way around for it in sliceOn callback and replace spaces to later. Not firstly in loaded text. This way it is working. Something like
onSlice: function(data) {
}
Here I am converting multiple spaces to so spaces could show correctly in HTML.