Skip to content

Commit

Permalink
Merge pull request #10729 from ArtemDzhereleiko/AD/imp/paste-hex-with…
Browse files Browse the repository at this point in the history
…-prefix

Fixed paste hex color with prefix
  • Loading branch information
ikulikov committed May 13, 2024
2 parents 98300cb + 0d23f7b commit 875a737
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ export class HexInputComponent {
}

public onInputChange(event: KeyboardEvent, inputValue: string): void {
const value = inputValue.toLowerCase();
const value = inputValue.replace('#', '').toLowerCase();
if (
((event.keyCode === 13 || event.key.toLowerCase() === 'enter') && value.length === 3)
|| value.length === 6 || value.length === 8
) {
const hex = parseInt(value, 16);
const hexStr = hex.toString(16);
if (hexStr.padStart(value.length, '0') === value && this.value !== value) {
if (hexStr.padStart(value.length, '0') === value && this.value.toLowerCase() !== value) {
const newColor = new Color(`#${value}`);
this.colorChange.emit(newColor);
}
Expand Down

0 comments on commit 875a737

Please sign in to comment.