-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Text line should be one text line when select/copy #2140
Comments
When text changes style, too, you get at least a space, e.g.: Because of the nature of web browsers in terms of copy/paste, I think the only way to resolve this one is to do canvas-based text selection (#1205). |
It's also possible to handle the copy/cut "ourself" and not relay on the browser's default behavior. We can detect a copy/cut event, prevent the default one and make sure a custom created string gets copied. Then we can walk the selected text nodes, build them together in the right way. Somewhat the lines:
This doesn't handle offset starting/ending in the divs, but hopefully the basic idea is clear. The 'new-line' attribute is a attribute set on the div if the div is the last div in the line. This doesn't handle RTL text. |
Also, people are asking for caret browsing (F7 key) -- div text layer gives them that. As I understand, the caret mode is useful for accessibility as well. |
In the examples I've seen that attempted to do this, Firefox prevented |
If positioned span's were used instead of div's, I think this would be easier. |
I am trying to use a regex with the text of a PDF and I encountered this issue. Any known solution? |
Fixed by #10197 since we're now using |
If a line is made up of multiple divs, selecting, copy and past will result in multiple lines.
That the content of the divs ends up in multiple lines seems to be the case as we use absolute positioned divs.
The text was updated successfully, but these errors were encountered: