Open strin opened 8 years ago
Building a comment component.
Currently we have pdf (paper) converted to html using pdf2htmlEX. It parses the pdf file and generates css, html and javascript. The html is the pdf decomposed into the pieces of text or pictures it has. The css records all possible style related info about the pieces (font, line spacing, relative position to page etc.). The pieces are labeled using the styles from css, so they are unique. The pdf provides animation for scrolling and other functionalities.
Use redisdb for storage, data model:
threads {
paperid
threadid, used to locate all posts
meta data {
pos, position in paper (can be used for on demand loading)
npost, number of posts (can be used for preview)
}
}
comments {
threadid
commentid
usedid
text
datetime
}
The comments section is a side pane, it can be toggled by user.
When rendering, we give a hint on the pdf indicating it has comments somewhere, user can click/mouseover and open/see preview of it. When the side pane is toggled, we also indicate how threads correspond to original texts (simultaneous highlight or a line connecting the two).
For commenting, user can add reply to existing threads. Or click on the pdf to create a new thread. We can use a global listener, and identify the element clicked jquery.event.target, use the xpath or css selector as ID for thread.
Cool. Awesome design. I say let's just integrate medium.js and see how it works.
Ok let me try to make a fast prototype.
Cool. I kind of want to keep our effort minimal. Some higher barrier stuff is more interesting. Let's wrap this up and build something for our own daily uses.