mirror of
https://github.com/plankanban/planka.git
synced 2025-07-21 14:19:44 +02:00
Allow creating label without name
This commit is contained in:
parent
d88bec8b6b
commit
9ebc82bf22
9 changed files with 31 additions and 51 deletions
|
@ -1,4 +1,4 @@
|
|||
import React, { useRef } from 'react';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, Form } from 'semantic-ui-react';
|
||||
|
@ -18,19 +18,12 @@ const AddStep = React.memo(({ onCreate, onBack }) => {
|
|||
color: LabelColors.KEYS[0],
|
||||
}));
|
||||
|
||||
const editor = useRef(null);
|
||||
|
||||
const handleSubmit = useDeepCompareCallback(() => {
|
||||
const cleanData = {
|
||||
...data,
|
||||
name: data.name.trim(),
|
||||
name: data.name.trim() || null,
|
||||
};
|
||||
|
||||
if (!cleanData.name) {
|
||||
editor.current.selectNameField();
|
||||
return;
|
||||
}
|
||||
|
||||
onCreate(cleanData);
|
||||
onBack();
|
||||
}, [data, onCreate, onBack]);
|
||||
|
@ -44,7 +37,7 @@ const AddStep = React.memo(({ onCreate, onBack }) => {
|
|||
</Popup.Header>
|
||||
<Popup.Content>
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<Editor ref={editor} data={data} onFieldChange={handleFieldChange} />
|
||||
<Editor data={data} onFieldChange={handleFieldChange} />
|
||||
<Button positive content={t('action.createLabel')} className={styles.submitButton} />
|
||||
</Form>
|
||||
</Popup.Content>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue