react-pdf
react-pdf copied to clipboard
Enhanced Text selection doesn't work as it does in pdf.js
Before you start - checklist
- [X] I followed instructions in documentation written for my React-PDF version
- [X] I have checked if this bug is not already reported
- [X] I have checked if an issue is not listed in Known issues
- [X] If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo
Description
In PDF.js text selection works more smoothly than in react-pdf for my pdf (in Chrome) I added a border to border to .textLayer span, and it seems like in pdf.js they pad text spans so they run into each other, making selection less jumpy, while in react-pdf when the mouse is over white spaces between elements selection behaves erraticaly. The relevant code is in https://github.com/mozilla/pdf.js/blob/26ae50e4494aa57b31f305df759fb44ae8be4cd7/web/text_layer_builder.js , they call expandTextDivs onMouseDown. (when using enhanceTextSelection ) Can this be added to react-pdf?
Thanks, Yuval
Steps to reproduce
Open a pdf in react-pdf in Chrome Select a text hovering on white spaces between lines/ over edges
Expected behavior
Selection should run smoothly
Actual behavior
selection jumps to end/start of page / paragraph
Additional information
No response
Environment
- Browser (if applicable): Chrome 103
- React-PDF version: ^6.0.0-beta.3
- React version: 18.2.0
- Webpack version (if applicable): 5