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

New: centering image prints #18

Merged
merged 2 commits into from
Mar 24, 2017
Merged

New: centering image prints #18

merged 2 commits into from
Mar 24, 2017

Conversation

jeremypress
Copy link
Contributor

No description provided.

@@ -286,6 +286,10 @@ class Image extends Base {
this.printframe = openContentInsideIframe(this.imageEl.outerHTML);
this.printframe.contentWindow.focus();

this.printImage = this.printframe.contentDocument.querySelector('img');
this.printImage.style.display = 'block';
this.printImage.style.margin = '0 auto';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative way to do this would be to load in a stylesheet like we do in preparePrint() in Text.js. Generally if possible, move styles to a stylesheet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth loading the style sheet for 2 lines?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on the fence about it, you can make the judgement call.

Pro in JS:

  • Tons of other places already set styles in JS
  • Only 2 lines

Pro in CSS:

  • Slippery slope to add any styles that we could use CSS for in JS
  • In case future styles need to be added for multi image, we'd be adding to CSS not more to JS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm going to stick with JS. If multi-image printing is introduced I'll happily refactor.

@jeremypress jeremypress merged commit 9ef387d into box:master Mar 24, 2017
@jeremypress jeremypress deleted the image-print-fixes branch March 24, 2017 23:40
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

Successfully merging this pull request may close these issues.

2 participants