1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00

Change user size on card, save card description on click outside, prevent list deletion if any filter is active

This commit is contained in:
Maksim Eltyshev 2020-04-30 05:27:46 +05:00
parent febc614ce8
commit ba2017705b
11 changed files with 74 additions and 38 deletions

View file

@ -21,19 +21,15 @@ const EditDescription = React.forwardRef(({ children, defaultValue, onUpdate },
}, [defaultValue, setValue]);
const close = useCallback(() => {
setIsOpened(false);
setValue(null);
}, [setValue]);
const submit = useCallback(() => {
const cleanValue = value.trim() || null;
if (cleanValue !== defaultValue) {
onUpdate(cleanValue);
}
close();
}, [defaultValue, onUpdate, value, close]);
setIsOpened(false);
setValue(null);
}, [defaultValue, onUpdate, value, setValue]);
useImperativeHandle(
ref,
@ -53,10 +49,10 @@ const EditDescription = React.forwardRef(({ children, defaultValue, onUpdate },
const handleFieldKeyDown = useCallback(
(event) => {
if (event.ctrlKey && event.key === 'Enter') {
submit();
close();
}
},
[submit],
[close],
);
const [handleFieldBlur, handleControlMouseOver, handleControlMouseOut] = useClosableForm(
@ -65,8 +61,8 @@ const EditDescription = React.forwardRef(({ children, defaultValue, onUpdate },
);
const handleSubmit = useCallback(() => {
submit();
}, [submit]);
close();
}, [close]);
useEffect(() => {
if (isOpened) {