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

Copy as HTML generates CSS with global effect #889

Closed
mscha opened this issue Jul 1, 2019 · 5 comments
Closed

Copy as HTML generates CSS with global effect #889

mscha opened this issue Jul 1, 2019 · 5 comments

Comments

@mscha
Copy link

mscha commented Jul 1, 2019

The HTML generated by Copy as HTML (all variations, even Copy as HTML text) generates CSS with global consequences. Most annoyingly, it sets the margins and padding of body to 0.
The effect is that if you paste this somewhere (e.g. in a compose window in Thunderbird), it affects the entire message.

Can you please ensure the CSS doesn't have global effect?
The obvious way to do that, is to give the div containing the text a class="mintty" or similar, and ensure all CSS rules apply to (children of) .mintty.

@mintty
Copy link
Owner

mintty commented Jul 4, 2019

Tweaked in repository.
Can you evaluate the current HTML creation?

@mscha
Copy link
Author

mscha commented Jul 7, 2019

I'm not able to make a build at this time, but looking at the commit, that only fixes my example annoyance, not the whole issue.
For instance, if you paste the generated HTML in an existing document, all existing <pre>s will lose their margin and padding, and every single <span> will suddenly have a fixed-width font.

My preferred solution is to put a class="mintty" on the main <div>, and make sure all CSS is only applied to children of .mintty. For instance:

.mintty, .mintty pre { margin: 0; padding: 0 }
.mintty span {
  font-family: 'InputMono', 'Lucida Console ', 'Consolas', monospace;
}

and so on.
(Although it might be better to clean up the HTML/CSS a bit as well: for instance, it makes no sense to apply the fonts to the span, better to apply it to the ,mintty class.)

@mintty
Copy link
Owner

mintty commented Jul 8, 2019

Thanks, I'll give it another tweak.
However, applying formatting locally is on purpose, to my own annoyance, because some tools that you'd like to paste into don't apply the format otherwise, particularly PowerPoint.

@mintty
Copy link
Owner

mintty commented Jul 9, 2019

Actually, div has id='vt100' already. I guess I'll just prefix div and pre with #vt100 and add a mintty class to body.

@mintty
Copy link
Owner

mintty commented Jul 13, 2019

Released 3.0.2.

@mintty mintty closed this as completed Jul 13, 2019
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