groups: set sigil color on blur, not automatically

This commit is contained in:
Matilde Park 2020-04-01 17:16:16 -04:00 committed by Matilde Park
parent 7dbd2a09f0
commit 48e65499e2

View File

@ -53,7 +53,7 @@ export class ContactCard extends Component {
if (hexTest && (hexTest[1] !== currentColor) && !props.share) { if (hexTest && (hexTest[1] !== currentColor) && !props.share) {
api.contactEdit(props.path, `~${props.ship}`, {color: hexTest[1]}); api.contactEdit(props.path, `~${props.ship}`, {color: hexTest[1]});
} }
} }
editToggle() { editToggle() {
@ -116,6 +116,18 @@ export class ContactCard extends Component {
); );
switch (field) { switch (field) {
case "color": {
let currentColor = (props.contact.color) ? props.contact.color : "000000";
currentColor = uxToHex(currentColor);
let hexExp = /([0-9A-Fa-f]{6})/
let hexTest = hexExp.exec(this.state.colorToSet);
if (hexTest && (hexTest[1] !== currentColor) && !props.share) {
api.contactEdit(props.path, `~${props.ship}`, { color: hexTest[1] }).then(() => {
});
}
break;
}
case "email": { case "email": {
if ( if (
(state.emailToSet === "") || (state.emailToSet === "") ||
@ -318,6 +330,7 @@ export class ContactCard extends Component {
onChange={this.sigilColorSet} onChange={this.sigilColorSet}
defaultValue={defaultColor} defaultValue={defaultColor}
key={"default" + defaultColor} key={"default" + defaultColor}
onBlur={(() => this.setField("color"))}
style={{ style={{
resize: "none", resize: "none",
height: 40, height: 40,