-
Notifications
You must be signed in to change notification settings - Fork 101
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
deserialize fails to restore highlights #16
Comments
Thanks for reporting. I will do my best to investigate this in a few days. |
@anandi2i Could you somehow share a html document you mentioned above? |
HTML - Content for the above passage <p class="para indent"> Json sent for Deserialization "[["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","The basic structural framework of the plasma membrane is the ","0:9:3:3:0",0,61,0],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","lipid bilayer","0:9:3:3:1:0",0,13,1],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">",", two back-to-back layers made up of three types of lipid molecules—phospholipids, cholesterol, and glycolipids (","0:9:3:3:2",0,113,2],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","Figure 3.2","0:9:3:3:3:0",0,10,3],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","). About 75% of the membrane lipids are ","0:9:3:3:4",0,40,4],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","phospholipids","0:9:3:3:5:0",0,13,5],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">",", lipids that contain phosphorus. Present in smaller amounts are ","0:9:3:3:6",0,65,6],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","cholesterol","0:9:3:3:7:0",0,11,7],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">"," (about 20%), a steroid with an attached —OH (hydroxyl) group, and various ","0:9:3:3:8",0,75,8],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","glycolipids","0:9:3:3:9:0",0,11,9],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">"," (about 5%), lipids with attached carbohydrate groups.","0:9:3:3:10",0,54,10],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","The bilayer arrangement occurs because the lipids are ","0:9:3:5:0",0,54,11],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","amphipathic","0:9:3:5:1:0",0,11,12],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","(am-fē-PATH-ik) molecules, which means that they have both polar and nonpolar parts. In phospholipids (see ","0:9:3:5:2",0,108,13],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","Figure 2.18","0:9:3:5:3:0:0",0,11,14],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","), the polar part is the phosphate-containing “head,” which is ","0:9:3:5:4",0,63,15],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","hydrophilic","0:9:3:5:5:0",0,11,16],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">"," (","0:9:3:5:6",0,2,17],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","hydro-","0:9:3:5:7:0",0,6,18],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">"," = water; -","0:9:3:5:8",0,11,19],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","philic","0:9:3:5:9:0",0,6,20],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">"," = loving). The nonpolar parts are the two long fatty acid “tails,” which are","0:9:3:5:10",0,78,21],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","hydrophobic","0:9:3:5:11:0",0,11,22],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">"," (-","0:9:3:5:12",0,3,23],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">","phobic","0:9:3:5:13:0",0,6,24],["<span class="highlighted annotation-55acbe32ccf210f054c29fcb" type="8" style="background-color: rgb(135, 206, 250);">"," = fearing) hydrocarbon chains. Because “like seeks like,” the phospholipid molecules orient themselves in the bilayer with their hydrophilic heads facing outward. In this way, the heads face a watery fluid on either side—cytosol on the inside and extracellular fluid on the outside. The hydrophobic fatty acid tails in each half of the bilayer point toward one","0:9:3:5:14",0,361,25],["<span class="highlighted annotation-55af40b8ccf2289dcaa8ff86" type="8" style="background-color: rgb(135, 206, 250);">","Many integral proteins are ","0:9:5:7:0",0,27,26],["<span class="highlighted annotation-55af40b8ccf2289dcaa8ff86" type="8" style="background-color: rgb(135, 206, 250);">","glycoproteins","0:9:5:7:1:0",0,13,27],["<span class="highlighted annotation-55af40b8ccf2289dcaa8ff86" type="8" style="background-color: rgb(135, 206, 250);">",", proteins with carbohydrate groups attached to the ends that protrude into the extracellular fluid. The carbohydrates are ","0:9:5:7:2",0,123,28],["<span class="highlighted annotation-55af40b8ccf2289dcaa8ff86" type="8" style="background-color: rgb(135, 206, 250);">","oligosaccharides","0:9:5:7:3:0",0,16,29],["<span class="highlighted annotation-55af40b8ccf2289dcaa8ff86" type="8" style="background-color: rgb(135, 206, 250);">"," (","0:9:5:7:4",0,2,30],["<span class="highlighted annotation-55af40b8ccf2289dcaa8ff86" type="8" style="background-color: rgb(135, 206, 250);">","oligo","0:9:5:7:5:0",0,5,31],["<span class="highlighted annotation-55af40b8ccf2289dcaa8ff86" type="8" style="background-color: rgb(135, 206, 250);">","- = few; -","0:9:5:7:6",0,10,32],["<span class="highlighted annotation-55af40b8ccf2289dcaa8ff86" type="8" style="background-color: rgb(135, 206, 250);">","saccharides","0:9:5:7:7:0",0,11,33],["<span class="highlighted annotation-55af40b8ccf2289dcaa8ff86" type="8" style="background-color: rgb(135, 206, 250);">"," = sugars), chains of 2 to 60 monosaccharides that may be straight or branched. The carbohydrate portions of glycolipids and glycoproteins form an extensive sugary coat called the ","0:9:5:7:8",0,180,34],["<span class="highlighted annotation-55af40b8ccf2289dcaa8ff86" type="8" style="background-color: rgb(135, 206, 250);">","glycocalyx","0:9:5:7:9:0",0,10,35],["<span class="highlighted annotation-55af40b8ccf2289dcaa8ff86" type="8" style="background-color: rgb(135, 206, 250);">"," (glī-kō-KĀL-iks). The pattern of carbohydrates in the glycocalyx varies from one cell to another. Therefore, the glycocalyx acts like a molecular “signature” that enables cells to recognize one another. For example, a white blood cell’s ability to detect a “foreign” glycocalyx is one basis of the immune response that helps us destroy invading organisms. In addition, the glycocalyx enables cells to adhere to one another in some tissues and protects cells from being digested by enzymes in the extracellular fluid. The hydrophilic properties of the glycocalyx attract a film of fluid to the surface of many cells. This action makes red blood cells slippery as they flow through narrow blood vessels and protects cells that line the airways and the gastrointestinal tract from drying out.","0:9:5:7:10",0,790,36]]" |
Here is a short screencast that demonstrates how to reliably recreate the problem on http://mir3z.github.io/texthighlighter/demos/serialization.html Note that the third highlighted word in the first line doesn't get deserialized correctly. |
I think I found a way to fix some issues with serialization but I have limited time and resources to do manual testing. The change are on branch @zippy I will be grateful if you provide me more test cases like the one above. With changes I made your test case succeeds now. @anandi2i Could you check if your issues are still present with the version from branch Please checkout the highlighter directly from github. |
So far it looks good, I can't get it to fail at first pass. I will try a bunch more scenarios. However, on the down side, this fix, doesn't work on items that had been serialized using the version on the current master branch. I.e. those serializations are broken, and still don't de-serialize correctly by the new code. If there is any way you could get previous serializations to be deserialized correctly that would be incredible. |
Are you sure about that? Version from branch should handle correctly old serializations. I made one test in which I took old serializations from you first post:
And deserialized them with the use of code from the branch. As a result I received correctly deserialized highlights. |
Well, I see that in some cases it works, but in others not. For example, here's a gist with html and a serialization on that html (created using the master branch, not the fix) : https://gist.github.com/zippy/fbcff16e9959ee45bccb The very last highlight on the word "son" fails to be deserialized even using the code from the new branch. It deserializes all the other highlights but then throws this error: "Can't deserialize highlight descriptor. Cause: TypeError: node is undefined" |
Unfortunately the new fix doesn't seem to work in all cases. Below is a URL to gist of some HTML and a highlight serialization created over the weekend by one of the users of my website. I also included in the gist the error messages produced in the console. If you need more help repeating this bug, please tell me. |
Hi, any progress on this. Do you need any more examples? I do have more and more examples being found by my users... |
Sorry, I don't have much free time. I will look at this at weekend but I'm
|
I have created a chrome extension based on your library. And a lot of time i get the same error. Here is the error. Can't deserialize highlight descriptor. Cause: TypeError: Cannot read property 'splitText' of undefined If you are still working on the library i can send you the extension and a list of use case example in which this error appears |
Did anyone ever get anywhere with this issue? |
Is this problem still not fixed? |
The deserialization code fails to work in all cases. Here is an example taken from
http://mir3z.github.io/texthighlighter/demos/serialization.html
The following serialization string that the code puts into the console, when de-serialized, doesn't fully deserialize all the highlights and also throws some errors.
In the case below note that the third highlight (of the word "Donec") doesn't get highilghted on deserializing.
Here's one of the errors it adds into the console:
I use this library in a project, and like it very much, but this bug affects my project quite frequently. I've attempted to figure out why the deserialization code has this problem, but haven't been able to, any help you can offer would be greatly appreciated. If you need more sample cases, I'm happy to provide.
The text was updated successfully, but these errors were encountered: