-
Notifications
You must be signed in to change notification settings - Fork 9
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
Selecting/Copying Text Should Work Properly #42
Comments
GitHub clobbered the contents of this comment when I submitted an edit to my most recent comment after pressing back to return to this page. Apparently it got confused about what comment I was editing. I had suggested trying the It's ironic that GitHub of all people have no record or indication of edited posts. |
Changing the Replacing space characters with non-breaking spaces allows them to be copied, but removing whitespace from between nodes doesn't affect the line breaks. |
I was consulting the SVG spec to see if it described this behaviour. It turns out that you aren't even supposed to be able to select multiple However, from the spec it looks like we could fix this by replacing each In SVG Tiny, |
Using I tried two different approaches to transforming the imported SVG, but both resulted in invisible text despite the DOM looking correct. It finally occurred to me to try copying the HTML of the modified elements to an external document to see what happened. They showed up and could be copied correctly (in Chrome)! I don't know what's causing this misbehaviour, but I have a (slightly crude) working solution: convert the SVG back to XML source, then re-parse it. It works (in Chrome)!
|
Looks good to me, is there a pull request for this? |
I've been working on Firefox in my svg-container branch. It's working for every SVG I test it with, though it isn't yet working in Butter. I've moved all of the little SVG utilities to their own class in a separate file,
For now, Firefox's text all ends up on a single line; |
Dear GitHub, Today I realized that the reason that things weren't working until I re-parsed was because I wasn't creating elements with the correct namespace. Even though HTML5 lets me just write We would still encounter the issue with Sincerely, |
In Chrome you can select and copy text from the SVG, but the copied text
has no whitespaceis full of useless line breaks but doesn't incude any spaces.In Firefox you can't even select text.
Being able to copy text is an important feature. It might require a slightly hacky solution, but this should be fixed.
The text was updated successfully, but these errors were encountered: