Changing the rows attribute when editing a wysiwyg field's config does not change the height of the editor.

The same issue existed for the stand alone CKeditor: https://www.drupal.org/node/1154730

This issue can be fixed by editing wysiwyg.module and in the wysiwyg_pre_render_text_format function and finding this code

$settings[$format] = array(
    'editor' => 'none',
    'status' => 1,
    'toggle' => 1,
    'resizable' => $resizable,
);

and adding this underneath:

// Set editor height based on the number of rows
if(isset($element['#rows'])) {
    $settings[$format]['rows'] = $element['#rows'];
}

And then also editing ckeditor-3.0.js and in Drupal.wysiwyg.editor.attach.ckeditor function adding the line

settings.height = params.rows * 23;

directly under:

var $drupalToolbar = $('#toolbar', Drupal.overlayChild ? window.parent.document : document);

I've not tested the dev version of the module as I can't use a dev release on my current project. Sorry this is not a patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dahousecat’s picture

Issue summary: View changes
brockfanning’s picture

I'm not totally sure this is the best way to go about this, but here is a patch along the lines of what @dahousecat suggests. It's working for me in the dev version, using CKEditor.

brockfanning’s picture

Status: Active » Needs review
erwangel’s picture

patch #2 did'nt work for me (on 7x-2.2) but following the initial instructions did it.

@brockfanning: "if (isset($element['#rows'])) {..." needs to stay inside the "foreach ($format_field['format']['#options']..." in order to hold values for all textarea fields (in case a node has more than one)

Inspired by patch#2 I added a test for indefined value to the initial post, so it becomes:

if (typeof params.rows != 'undefined') {
  settings.height = params.rows * 23;	
}
TwoD’s picture

I don't think we need to pass the row setting down from the server, and there's a slight chance it'll get ignored or altered in the theme anyway.
How about just accessing the rows attribute (if there), use it if possible, or fall back to a minimum usable height?

Btw, since the editors handle small heights differently, I used different calculations.
CKEditor uses the setting for its inner height, FCKeditor and EpicEditor use it for the total height. EpicEditor has no toolbar so it can go much smaller than the other two while still being usable.

The others do fairly well on their own, but I forgot about YUI. I'll simply add that before committing.

pianomansam’s picture

Status: Needs review » Closed (duplicate)

It looks like this is a duplicate of #507696: Allow individual width/height per field

geek-merlin’s picture

yemoko’s picture

Hi,
patch #5 works for me (on 7x-2.2).

I had issue when changing vertical tabs selection after increasing height on the interface.

Delphine Lepers’s picture

New patch for the latest release