mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
parent
974f7047e4
commit
60bf1af4f7
1 changed files with 6 additions and 17 deletions
|
@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
|
||||||
import TextareaAutosize from 'react-textarea-autosize';
|
import TextareaAutosize from 'react-textarea-autosize';
|
||||||
import { Button, Form, TextArea } from 'semantic-ui-react';
|
import { Button, Form, TextArea } from 'semantic-ui-react';
|
||||||
|
|
||||||
import { useClosableForm, useForm } from '../../../hooks';
|
import { useForm } from '../../../hooks';
|
||||||
|
|
||||||
import styles from './CommentEdit.module.scss';
|
import styles from './CommentEdit.module.scss';
|
||||||
|
|
||||||
|
@ -35,12 +35,7 @@ const CommentEdit = React.forwardRef(({ children, defaultData, onUpdate }, ref)
|
||||||
text: data.text.trim(),
|
text: data.text.trim(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!cleanData.text) {
|
if (cleanData.text && !dequal(cleanData, defaultData)) {
|
||||||
textField.current.ref.current.select();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dequal(cleanData, defaultData)) {
|
|
||||||
onUpdate(cleanData);
|
onUpdate(cleanData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,10 +60,9 @@ const CommentEdit = React.forwardRef(({ children, defaultData, onUpdate }, ref)
|
||||||
[submit],
|
[submit],
|
||||||
);
|
);
|
||||||
|
|
||||||
const [handleFieldBlur, handleControlMouseOver, handleControlMouseOut] = useClosableForm(
|
const handleFieldBlur = useCallback(() => {
|
||||||
close,
|
submit();
|
||||||
isOpened,
|
}, [submit]);
|
||||||
);
|
|
||||||
|
|
||||||
const handleSubmit = useCallback(() => {
|
const handleSubmit = useCallback(() => {
|
||||||
submit();
|
submit();
|
||||||
|
@ -100,12 +94,7 @@ const CommentEdit = React.forwardRef(({ children, defaultData, onUpdate }, ref)
|
||||||
/>
|
/>
|
||||||
<div className={styles.controls}>
|
<div className={styles.controls}>
|
||||||
{/* eslint-disable-next-line jsx-a11y/mouse-events-have-key-events */}
|
{/* eslint-disable-next-line jsx-a11y/mouse-events-have-key-events */}
|
||||||
<Button
|
<Button positive content={t('action.save')} />
|
||||||
positive
|
|
||||||
content={t('action.save')}
|
|
||||||
onMouseOver={handleControlMouseOver}
|
|
||||||
onMouseOut={handleControlMouseOut}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue