mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 08:31:23 -05:00
Make enter submit title field instead of adding newlines
This commit is contained in:
parent
5892f2e7ba
commit
789e15c3ab
1 changed files with 2 additions and 6 deletions
|
@ -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)}
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue