mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
feat: Add multi-task creation with Ctrl+Enter in Add.jsx
Modified the handleFieldKeyDown function in Add.jsx to handle Ctrl+Enter keypress events. This change allows creating multiple tasks from each non-empty line in the text field when Ctrl+Enter is pressed, while maintaining the existing functionality for creating a single task on Enter.
This commit is contained in:
parent
14dff96434
commit
2067a1ac58
1 changed files with 7 additions and 3 deletions
|
@ -61,13 +61,17 @@ const Add = React.forwardRef(({ children, onCreate }, ref) => {
|
|||
|
||||
const handleFieldKeyDown = useCallback(
|
||||
(event) => {
|
||||
if (event.key === 'Enter') {
|
||||
if (event.ctrlKey && event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
const lines = data.name.split('\n').filter(line => line.trim() !== '');
|
||||
lines.forEach(line => onCreate({ name: line.trim() }));
|
||||
setData({ ...data, name: '' });
|
||||
} else if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
|
||||
submit();
|
||||
}
|
||||
},
|
||||
[submit],
|
||||
[data, onCreate, submit],
|
||||
);
|
||||
|
||||
const [handleFieldBlur, handleControlMouseOver, handleControlMouseOut] = useClosableForm(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue