Skip to content

Commit

Permalink
Removed "Undo" button and unnecessary event.preventDefault()
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Jan 29, 2020
1 parent 64f50f0 commit c3a31e0
Showing 1 changed file with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
*/

import React, {Fragment, useRef} from 'react';
import Button from '../Button';
import ButtonIcon from '../ButtonIcon';
import styles from './EditableValue.css';
import {useEditableValue} from '../hooks';

Expand Down Expand Up @@ -61,11 +59,6 @@ export default function EditableValue({
}
};

const handleBlur = event => {
event.stopPropagation();
applyChanges();
};

const applyChanges = () => {
if (isValid && hasPendingChanges) {
overrideValueFn(path, parsedValue);
Expand All @@ -84,22 +77,14 @@ export default function EditableValue({
<input
autoComplete="new-password"
className={`${isValid ? styles.Input : styles.Invalid} ${className}`}
onBlur={applyChanges}
onChange={handleChange}
onKeyDown={handleKeyDown}
onBlur={handleBlur}
placeholder={placeholder}
ref={inputRef}
type="text"
value={editableValue}
/>
{hasPendingChanges && (
<Button
className={styles.ResetButton}
onClick={reset}
title="Reset value">
<ButtonIcon type="undo" />
</Button>
)}
</Fragment>
);
}

0 comments on commit c3a31e0

Please sign in to comment.