Open codepeach opened 4 months ago
Bumb this is happening to me too, after some digging it looks like the event "pagesinit" is not triggered with eventBus.on('pagesinit', this.onDocumentReady);
so the scrollRef is not called. Any suggestions?
I had the exact same issue. I think this only occurs in dev-mode cause then NextJS runs react in strict mode and then it will mount the component twice building for production and it worked for me, but obviously not ideal.
The problem as I remembered it is that the react pdf highlighter code in https://github.com/agentcooper/react-pdf-highlighter/blob/14e4e7ccc2a9cd40461f53ce7925482a08a368a4/src/components/PdfHighlighter.tsx#L178C5-L178C16 creates a new eventbus which then is not passed into the "this.view" if it already exists.
Thanks for the hint! I managed to fix it in my version by turning the eventBus in a class variable, similar to how the viewer
is used, and it works in development as well :)
Will submit a pull request in a couple of days (i'm unable to do it right now)
@Gr33nLight Could you show how you were able to achieve it? It still doesn't work for me.
I had the same issue, please tell me how to work it
you can try
Where do I append this? Do I have to fork the repo into my project just for this fix?
Where do I append this? Do I have to fork the repo into my project just for this fix?
You can use patch-package.
I'm trying to use this in Next14, however, when I try to click on the highlights on the sidebar, it doesn't take me to the highlighted portion of the PDF. Anyone know why this might be?
Below is my code