Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/Verte.vue
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ export default {
inputChanged (event, value) {
const el = event.target;
if (this.currentModel === 'hex') {
if (typeof el.value !== 'object' && el.value.indexOf('#') !== 0) {
el.value = '#' + el.value;
}

Comment on lines +356 to +359

Choose a reason for hiding this comment

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

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);

Choose a reason for hiding this comment

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

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.selectColor(el.value);
return;
}
Expand Down