fix pressing enter on channel edit page for adding tags

This commit is contained in:
zxawry 2019-11-14 17:00:01 +00:00 committed by Sean Yesmunt
parent aa69b227bd
commit 66c6ec1626

View file

@ -1,6 +1,6 @@
// @flow // @flow
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Form, FormField } from 'component/common/form'; import { FormField } from 'component/common/form';
import Button from 'component/button'; import Button from 'component/button';
import SelectAsset from 'component/selectAsset'; import SelectAsset from 'component/selectAsset';
import TagsSelect from 'component/tagsSelect'; import TagsSelect from 'component/tagsSelect';
@ -98,15 +98,14 @@ function ChannelForm(props: Props) {
setParams({ ...params, coverUrl }); setParams({ ...params, coverUrl });
updateCover(coverUrl); updateCover(coverUrl);
}; };
const handleSubmit = () => {
updateChannel(params);
setEditing(false);
};
// TODO clear and bail after submit // TODO clear and bail after submit
return ( return (
<section className={'card--section'}> <section className={'card--section'}>
<Form
onSubmit={() => {
updateChannel(params);
setEditing(false);
}}
>
<SelectAsset <SelectAsset
onUpdate={v => handleThumbnailChange(v)} onUpdate={v => handleThumbnailChange(v)}
currentValue={params.thumbnailUrl} currentValue={params.thumbnailUrl}
@ -198,10 +197,9 @@ function ChannelForm(props: Props) {
tagsChosen={params.tags || []} tagsChosen={params.tags || []}
/> />
<div className={'card__actions'}> <div className={'card__actions'}>
<Button button="primary" label={__('Submit')} type="submit" /> <Button button="primary" label={__('Submit')} onClick={handleSubmit} />
<Button button="link" label={__('Cancel')} navigate={`$/${PAGES.CHANNELS}`} /> <Button button="link" label={__('Cancel')} navigate={`$/${PAGES.CHANNELS}`} />
</div> </div>
</Form>
</section> </section>
); );
} }