Fix plus button disappearing on cancel.
This commit is contained in:
parent
f61007cfb6
commit
bf82427ebb
1 changed files with 13 additions and 8 deletions
21
index.html
21
index.html
|
|
@ -988,7 +988,7 @@ chmod 755 kbtd
|
|||
$(`#${containerId}`).appendChild(clone);
|
||||
}
|
||||
|
||||
function createAddForm(placeholder, onSubmit) {
|
||||
function createAddForm(placeholder, onSubmit, onCancel) {
|
||||
const input = h('input', { type: 'text', placeholder });
|
||||
const form = h('div', { className: 'add-card-form' }, input);
|
||||
|
||||
|
|
@ -1012,7 +1012,10 @@ chmod 755 kbtd
|
|||
h('button', { textContent: 'Add', onclick: handleSubmit }),
|
||||
h('button', {
|
||||
textContent: 'Cancel',
|
||||
onclick: () => form.hide()
|
||||
onclick: () => {
|
||||
form.hide();
|
||||
if (onCancel) onCancel();
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
|
|
@ -2001,12 +2004,6 @@ chmod 755 kbtd
|
|||
ondragleave: handleDragLeave
|
||||
}, ...cardElements);
|
||||
|
||||
const addCardForm = createAddForm('Card text...', async (text) => {
|
||||
await createCard(colIndex, text);
|
||||
addCardForm.hide();
|
||||
addCardBtn.style.display = '';
|
||||
});
|
||||
|
||||
const addCardBtn = h('button', {
|
||||
className: 'add-card-btn',
|
||||
textContent: '+',
|
||||
|
|
@ -2017,6 +2014,14 @@ chmod 755 kbtd
|
|||
}
|
||||
});
|
||||
|
||||
const addCardForm = createAddForm('Card text...', async (text) => {
|
||||
await createCard(colIndex, text);
|
||||
addCardForm.hide();
|
||||
addCardBtn.style.display = '';
|
||||
}, () => {
|
||||
addCardBtn.style.display = '';
|
||||
});
|
||||
|
||||
return h('div', {
|
||||
className: 'column',
|
||||
dataset: { colIndex }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue