Pārlūkot izejas kodu

Merge pull request #3408 from mfilser/checklistitem_textarea_autoresize

Checklist-Items, Autoresize the textarea vertically to fit the user-input
Lauri Ojansivu 4 gadi atpakaļ
vecāks
revīzija
08866ae20b
1 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  1. 8 0
      client/components/cards/checklists.js

+ 8 - 0
client/components/cards/checklists.js

@@ -186,6 +186,12 @@ 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) {
@@ -209,6 +215,8 @@ 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,
       },
     ];