Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

&nbsp: texts are not working correctly #148

Open
hardeep360 opened this issue May 13, 2024 · 1 comment
Open

&nbsp: texts are not working correctly #148

hardeep360 opened this issue May 13, 2024 · 1 comment

Comments

@hardeep360
Copy link

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) {

data.summary = setSpaces(data.summary);
data.details = setSpaces(data.details);

}

Here I am converting multiple spaces to   so spaces could show correctly in HTML.

@hardeep360
Copy link
Author

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++;
         }
      }

@hardeep360 hardeep360 changed the title &nbsp: texts are working correctly &nbsp: texts are not working correctly May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant