mirror of
https://github.com/flarum/core.git
synced 2025-07-17 06:41:21 +02:00
fix: support 3digit hex color input (#3706)
This commit is contained in:
@@ -10,6 +10,11 @@ export default class ColorPreviewInput extends Component {
|
|||||||
|
|
||||||
attrs.type ||= 'text';
|
attrs.type ||= 'text';
|
||||||
|
|
||||||
|
// If the input is a 3 digit hex code, convert it to 6 digits.
|
||||||
|
if (attrs.value.length === 4) {
|
||||||
|
attrs.value = attrs.value.replace(/#([a-f0-9])([a-f0-9])([a-f0-9])/, '#$1$1$2$2$3$3');
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ColorInput">
|
<div className="ColorInput">
|
||||||
<input className={classList('FormControl', className)} id={id} {...attrs} />
|
<input className={classList('FormControl', className)} id={id} {...attrs} />
|
||||||
|
Reference in New Issue
Block a user