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

How can I add a notes icon to a book whenever I highlight paragraphs with notes? #1355

Open
panjadyboy opened this issue Aug 28, 2023 · 6 comments

Comments

@panjadyboy
Copy link

No description provided.

@panjadyboy
Copy link
Author

Can anyone help on this ?

@johnfactotum
Copy link
Contributor

Easiest way is probably inserting the icon with Range.insertNode(). You can use ignoreClass to ignore it when getting the CFI.

Alternatively, you can append the icon element outside the rendition, and use getClientRects to get the position of the highlighted text and position the icon based on this. (But note that these the rects would be relative to the iframe; see https://github.com/johnfactotum/epubjs-tips#get-position-of-selected-text)

@panjadyboy
Copy link
Author

When we use range.insertNode() , icon disappear after sometime . Can you please help how to resolve this ?

@panjadyboy
Copy link
Author

Can anybody help me on this ?

@panjadyboy
Copy link
Author

Hello , can anyone help me on this??

@johnfactotum
Copy link
Contributor

Ah yes, I forgot about that. If I recall correctly, the problem would be that Epub.js reloads the whole section whenever it resizes. I'm not sure if there's a hook that could be used to account for that. Personally I would try a different approach that doesn't involve mutating the content.

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

2 participants