change html editor size

change html editor size

by Will Cunningham -
Number of replies: 5
What file do I need to edit to change the size of the html editor when adding a new journal? I have searched through all the files in the mod but I can't seem to find it? I need to change the height editor.
Average of ratings: -
In reply to Will Cunningham

Re: change html editor size

by Lance Haysom -
Have a read of the neweditor_readme.txt in /lib/editor (path is good for 1.7 -> 1.9).

You could alter the line: this.height = "auto"; (line 124 in /lib/editor/htmlarea/htmlarea.php )

To this.height = "400px"; Or whatever start size you like. Note this will resize all instances of the editor.

If you just wanted to resize the height of the editor when editing a journal question you could change the value in /mod/journal/edit.html line 18:

<?php print_textarea($usehtmleditor, 20, 60, 630, 400, "text", $entry->text); ?>

To

<?php print_textarea($usehtmleditor, 30, 60, 630, 400, "text", $entry->text); ?>


Altering the height of the editor when creating a new journal entry is little more tricky. I've been away from Moodle for a year and it's changed an awful lot!

If you alter the line:
$mform->addElement('htmleditor', 'intro', get_string('journalquestion', 'journal'));

TO

$mform->addElement('htmleditor', 'intro', get_string('journalquestion', 'journal'), array('height'=>'640px'));

It will set the height in the object ( print_object($mform) to see) but appears to be overridden elsewhere, I need to keep digging a little more.

Sorry, thats in /mod/journal/mod_form.php

















Average of ratings: Useful (1)
In reply to Lance Haysom

Re: change html editor size

by Will Cunningham -
Yes I need to change the size when adding a new journal. I am glad it wasn't something real easy, I have looked all over the code. Please keep me informed if you find a way to make it larger.
In reply to Will Cunningham

Re: change html editor size

by Lance Haysom -
I used the wrong property!

Instead of 'height'=>'value' use 'rows'=>value.

So the line would read:

$mform->addElement('htmleditor', 'intro', get_string('journalquestion', 'journal'), array('rows'=>'xxx'));

xxx being the row count you want.
In reply to Lance Haysom

Re: change html editor size

by Will Cunningham -
Thank you! Thank you! Thank you!
That worked perfectly. I really appreciate you taking the time to look into it.