Commit 789e15c3 authored by Paul Kaplan's avatar Paul Kaplan

Make enter submit title field instead of adding newlines

parent 5892f2e7
......@@ -9,12 +9,7 @@ import {selectStudioTitle, selectIsFetchingInfo} from '../../redux/studio';
import {selectCanEditInfo} from '../../redux/studio-permissions';
import {Errors, mutateStudioTitle, selectIsMutatingTitle, selectTitleMutationError} from '../../redux/studio-mutations';
import ValidationMessage from '../../components/forms/validation-message.jsx';
/*
TODO
- no newlines in studio title
- Correct display in read-only mode
- validation message
*/
const errorToMessageId = error => {
switch (error) {
case Errors.INAPPROPRIATE: return 'studio.updateErrors.inappropriate';
......@@ -38,6 +33,7 @@ const StudioTitle = ({
className={fieldClassName}
disabled={isMutating || !canEditInfo || isFetching}
defaultValue={title}
onKeyDown={e => e.key === 'Enter' && e.target.blur()}
onBlur={e => e.target.value !== title &&
handleUpdate(e.target.value)}
/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment