Updating hex text input to work with or without a hashtag#1
Closed
Updating hex text input to work with or without a hashtag#1
Conversation
|
If this works, it's my opinion that we should move forward with our own forked version, since it works. It's less work, and whatever problems there are, we already know about them. |
groovetrain
approved these changes
Jan 28, 2022
Comment on lines
+356
to
+359
| if (typeof el.value !== 'object' && el.value.indexOf('#') !== 0) { | ||
| el.value = '#' + el.value; | ||
| } | ||
|
|
There was a problem hiding this comment.
I like specifically checking for there being a '#' as the first character, I'd amend the replacement as follows, in case it's later on in the string (perhaps doing too much sanitation, but whatever, I'll leave it up to you if you think it's important enough)
el.value = '#' + el.value.replace(/[^0-9A-F]/ig, '').substr(0,6);
There was a problem hiding this comment.
I also know you probably spent an annoying amount of time finding where to actually make this change, so for that I applaud you! :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UAT feedback "Missing # in color code will not work"
The color picker is built using a 3rd party plugin, unfortunately that plugin does not support hex values that don't include a starting
#so I had to update their code to make it work.There are multiple places in the code that ensure the hex value contains a starting
#, so rather than trying to update them all to work with & without a#I am simply ensuring that all hex values start with a#before doing any processing.I have submitted a bug report and a pull request to the original package, but it doesn't look like there have been any changes since the
masterbranch was created so I'm not very hopeful that they will pull it in.So I'm thinking to switch mcms to use our [fixed] forked version, but could be easily convinced that we should just change to a different 3rd party color picker instead.
Fwiw, this plugin was selected by Kristine because it looked and behaved how she wanted. I'm sure we can find another plugin that is pretty similar and doesn't have this
#issue, but there would probably be a bit more testing involved in switching plugins.