diff options
author | boeserwolf <github@noxware.de> | 2020-04-21 00:58:15 +0300 |
---|---|---|
committer | boeserwolf <github@noxware.de> | 2020-04-21 00:58:15 +0300 |
commit | 9f0273aa4487545cc28712d33a4ee141738b1571 (patch) | |
tree | 3caa98de91df7e750886d4d0ac8c82d1161b4eff /client/components/cards | |
parent | 3407b0e65b0ed3cbd864d605f6cd5935db22c987 (diff) | |
download | wekan-9f0273aa4487545cc28712d33a4ee141738b1571.tar.gz wekan-9f0273aa4487545cc28712d33a4ee141738b1571.tar.bz2 wekan-9f0273aa4487545cc28712d33a4ee141738b1571.zip |
Pre-fill the title of checklists (Trello-style)
Diffstat (limited to 'client/components/cards')
-rw-r--r-- | client/components/cards/checklists.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/client/components/cards/checklists.js b/client/components/cards/checklists.js index 94d8176b..5acab536 100644 --- a/client/components/cards/checklists.js +++ b/client/components/cards/checklists.js @@ -1,4 +1,4 @@ -const { calculateIndexData, enableClickOnTouch } = Utils; +const { calculateIndexData, enableClickOnTouch, capitalize } = Utils; function initSorting(items) { items.sortable({ @@ -177,6 +177,16 @@ BlazeComponent.extendComponent({ } }, + focusChecklistItem(event) { + // If a new checklist is created, pre-fill the title and select it. + const checklist = this.currentData().checklist; + if (!checklist) { + const textarea = event.target; + textarea.value = capitalize(TAPi18n.__('r-checklist')); + textarea.select(); + } + }, + events() { const events = { 'click .toggle-delete-checklist-dialog'(event) { @@ -196,6 +206,7 @@ BlazeComponent.extendComponent({ 'submit .js-edit-checklist-item': this.editChecklistItem, 'click .js-delete-checklist-item': this.deleteItem, 'click .confirm-checklist-delete': this.deleteChecklist, + 'focus .js-add-checklist-item': this.focusChecklistItem, keydown: this.pressKey, }, ]; |