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

Fix: Only call setOriginalImageSize() on single page images #394

Merged
merged 6 commits into from
Sep 28, 2017

Conversation

pramodsum
Copy link
Contributor

@pramodsum pramodsum commented Sep 15, 2017

Will add tests soon

Copy link
Contributor

@JustinHoldstock JustinHoldstock left a comment

Choose a reason for hiding this comment

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

Add some tests, and then I approve

* @return {Promise} A promise that is resolved if the original image dimensions were set.
*/
setOriginalImageSize(imageEl) {
const promise = new Promise((resolve) => {
Copy link
Contributor

@priyajeet priyajeet Sep 26, 2017

Choose a reason for hiding this comment

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

Don't need to wrap stuff.

if (imageEl.naturalWidth && imageEl.naturalHeight) {
    imageEl.setAttribute('originalWidth', imageEl.naturalWidth);
    imageEl.setAttribute('originalHeight', imageEl.naturalHeight);
    return Promise.resolve();
}

return get().then(...)

@pramodsum pramodsum merged commit 8f1cc35 into box:master Sep 28, 2017
pramodsum added a commit to pramodsum/box-content-preview that referenced this pull request Sep 29, 2017
pramodsum added a commit that referenced this pull request Sep 29, 2017
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.

None yet

3 participants