DrupalGap icon indicating copy to clipboard operation
DrupalGap copied to clipboard

Body Field on Node Edit Does not Resize

Open mkinnan opened this issue 8 years ago • 0 comments

When editing a node with a body field that contains a lot of text, the textarea input does not resize to show all the entered text. Here is a work around:

function my_module_form_alter(form, form_state, form_id) {

  try {
  
    if (form_id == 'my_module_form') {
    
      setTimeout(function() {

        // only need to adjust textarea for node editing
        if (form.arguments['0']['nid']) {
          
          // auto adjust textarea
          // https://stackoverflow.com/a/13085420
          $("textarea").height( $("textarea")[0].scrollHeight );
     
      });
      
    }
  
  }
  catch (error) { console.log('my_module_form_alter - ' + error); }
}

@signalpoint Would you want something like this into DG core?

mkinnan avatar Jul 16 '17 20:07 mkinnan