Merge branch 'mfilser-new_checklistitem_textarea_autoresize'

This commit is contained in:
Lauri Ojansivu 2020-12-30 19:12:40 +02:00
commit 9c8d5c2613

View file

@ -186,12 +186,6 @@ BlazeComponent.extendComponent({
}
},
// resize the textarea vertically to fit the user-input
autoResize(event) {
const textarea = event.target;
textarea.style.height = textarea.scrollHeight + 'px';
},
events() {
const events = {
'click .toggle-delete-checklist-dialog'(event) {
@ -215,8 +209,6 @@ BlazeComponent.extendComponent({
'click .js-delete-checklist-item': this.deleteItem,
'click .confirm-checklist-delete': this.deleteChecklist,
'focus .js-add-checklist-item': this.focusChecklistItem,
'input textarea.js-edit-checklist-item': this.autoResize,
'focus textarea.js-edit-checklist-item': this.autoResize,
keydown: this.pressKey,
},
];
@ -231,6 +223,14 @@ Template.checklists.helpers({
},
});
Template.addChecklistItemForm.onRendered(() => {
autosize($('textarea.js-add-checklist-item'))
});
Template.editChecklistItemForm.onRendered(() => {
autosize($('textarea.js-edit-checklist-item'))
});
Template.checklistDeleteDialog.onCreated(() => {
const $cardDetails = this.$('.card-details');
this.scrollState = {