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 CSS color order bug #599

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

acupoftee
Copy link

@acupoftee acupoftee commented Sep 29, 2019

This PR addresses #453

Before the first fix attempt made in PR #497, the array was only reversed in CodeModal.copyData(). The fix from 497 reversed the array in codeblock and copyData() with this technique: [...this.gradient.colors].reverse().join(','). This however created copies of the original array, and displayed code for the reversed gradient arrays.

To fix this, reverse() was removed from both codeblock, and copyData(). All copied arrays look like this:

[...this.gradient.colors].join(', ')

The gradient css will match the preview. Below is a demo featuring the gradient https://uigradients.com/#Margo referenced in the referenced issue:

Copied CSS w/ Fix:

background: #FFEFBA;  /* fallback for old browsers */
background: -webkit-linear-gradient(to top, #FFEFBA, #FFFFFF);  /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to top, #FFEFBA, #FFFFFF); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari7+ */

- removed reverse methods in `codeblock` and `copyData()`
- this prevents the array from being modified again before the copying
@acupoftee
Copy link
Author

If accepted, would it also be helpful to include an additional test for the color order?

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.

1 participant