Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
CKEditor is not following the changes made in the body rows setting for Drupal 7. The editor area height is fixed, no matter what value you choose for the field's 'rows' setting.
Proposed resolution
Make the editor area height respect the field's rows value.
Remaining tasks
none
User interface changes
Improved editor experience.
API changes
none
Original report by @Gemini Lights
CKEditor is not following the changes made in the body rows setting for Drupal 7.
It's always defaulted to the normal, no matter what value you choose in the "manage fields" of content types.
Is this a bug?
Comment | File | Size | Author |
---|---|---|---|
#29 | ckeditor-area-height-1154730-29.patch | 440 bytes | Sutharsan |
Comments
Comment #1
dczepierga CreditAttribution: dczepierga commentedPls try to update to last DEV version of CKEditor module...
If it doesn't help, pls write exactly step by step what'd u do...
Greetings
Comment #2
WorldFallz CreditAttribution: WorldFallz commentedI can confirm this is still a problem with 7.x-1.x-dev.
To reproduce:
1. go to the 'manage fields' tab of any content type and edit the body field (ie for basic page: admin/structure/types/manage/page/fields/body).
2. set the "Rows" setting to anything obviously different than the default (like 50).
3. create a node of that type and note that the size of the body field is unchanged (ie for basic page: node/add/page).
Comment #3
mkesicki CreditAttribution: mkesicki commentedI can confirm this bug with latest DEV version. To reproduce please follow to http://drupal.org/node/1154730#comment-4571232
Comment #4
jrhansen CreditAttribution: jrhansen commentedAny fix for this yet? The issue is still present with 1.3.
Comment #5
altavis CreditAttribution: altavis commentedFor those who just want higher editor area - you can set
config.height = 400;
in Custom javascript configurationIt's just a workaround.
Comment #6
tanitani CreditAttribution: tanitani commentedThis is an issue as I need to have the boxes to be 2 rows high to remind my editors to keep it short (I need full HTML therefore single line text fields are not an option, AFAIK) and since there are several boxes on the edit form the large size forces unnecessary scrolling.
BTW, where is the Custom javascript configuration? It probably sets the height across the board, in which case I cannot make use of this method as I need to have larger boxes on other nodes.
Tanks,
Gábor
Comment #7
mkesicki CreditAttribution: mkesicki commentedCustom JavaScript configuration is in CKEditor's profile settings. Check "advanced settings' section in selected profile configuration. It should be in link similar like
http://yourDrupalDomain/node#overlay=admin/config/content/ckeditor/edit/Advanced
(for "Advanced profile.").Comment #8
tanitani CreditAttribution: tanitani commentedThank you, however, I am afraid that is not available to me as I am using CKEditor with Wysiwyg, so the settings are different (more limited).
In fact I was wondering about what the benefit might be using Wysiwyg at the time I installed it, but it seemed a good idea based on the reviews...
In fact, would it benefit me if I did away with Wysiwyg??
Comment #9
mkesicki CreditAttribution: mkesicki commented@tanitani , hese modules are different and is up to you which one you choose.
In CKEditor module you can easily customize CKEditor's buttons and configure things that are build in CKEditor.
Comment #10
Toby Wild CreditAttribution: Toby Wild commentedI am running the latest D7, with CKEditor 7.x-1.6 with CKEditor 3.6.2.
I am having the same issue, I am unable to set the height of a 'Long text and summary' field.
As I require the 'body' field to be full size, but like above, another just needs to be 2 or 3 lines.
I created a separate Text Format called "Small Field Format".
I then created a new CKEditor profile for just that Text Format.
I set custom javascript to "config.height = '300'" just to test things out.
I then select that text format (And therefor that CKEditor profile) when I go to edit, and nothing appears different.
I changed the icons in the toolbar, and they change, so it is using the different CKEditor Profile, but it's ignoring the config.height.
Comment #11
mkesicki CreditAttribution: mkesicki commented@Toby Wild please tyr use
config.height='300';
Comment #12
Toby Wild CreditAttribution: Toby Wild commented@michal_cksource
Thanks, that works perfectly. Must have been my syntax in the Javascript Config.
Comment #13
alisonHi -- just checking in about this because I'm still dealing with the problem a year later (thank you for the workaround in the meantime, though).
Thanks!
Comment #14
alisonI think this issue is not fixed.
I appreciate the workaround, but it's still just a workaround -- I really feel like we should be able to control the height of our textareas on a per-field basis.
(Also, less important, but still a problem -- when a textarea's height has been set and it happens to be much different from the height forced for all textareas using the same CKEditor profile, when you "Switch to plain text editor" the height change is very jarring and disruptive. (A similar thing happens when you switch between text formats that use different CKEditor profiles.))
I feel like this didn't happen with the Drupal 6 version? I don't know what changed, on the Drupal side, or on CKEditor's, but a few issue queues support my vague recollection, I think... (#756516: Error in module code and #785310: #rows element not properly called upon, for example)
Comment #15
Mike Serafin CreditAttribution: Mike Serafin commentedAlso confirming this bug and would like to see a fix.
I don't want to do the JavaScript work around as I need to set the text area height only for a specific content type and don't want to change it across the board.
Comment #16
wwalc CreditAttribution: wwalc commentedPatches are welcome :-)
Comment #17
adamtong CreditAttribution: adamtong commentedi confirm it is a bug too. please help fix.
Thank you.
Comment #18
Andrei.Sapeshko CreditAttribution: Andrei.Sapeshko commentedРossible solution.
http://drupal.org/node/2000712
Comment #19
Kristen PolAnyone have a workaround when using wysiwyg+ckeditor? Can I pass in the:
use config.height='300';
somewhere?
I didn't see any custom settings that would be passed along to ckeditor from wysiwyg. I have lots of text areas that I'd like a lot smaller. I'd even be okay with making all text areas smallish for now and they can expand the height for body text when needed.
Comment #20
Kristen PolI found this thread:
#1012050: default display height of CKEditor
Comment #21
Anonymous (not verified) CreditAttribution: Anonymous commentedDefinitely experiencing this problem with WYSIWYG Module and CKeditor 4.3 installed. PS: For those of you wanting 4.3 here is a link to instructions to fix the install error:
http://www.webopius.com/content/717/how-to-get-ckeditor-4-x-working-with...
Comment #22
Agogo CreditAttribution: Agogo commented<note>
This comment was NOT, in fact, authored by alisonjo2786, but rather, by Agogo. No idea what's going on (see #23 and #24 below), but, here we are...
</note>
I just found a better workaround for this and thought I should share it. It tries to match the size of the textarea CKEditor is implemented on.
Insert this line inside the modules config file (ckeditor.config.js)
config.height = eval(this.element.$.rows*40) + 'px';
If it doesnt match the size in the browser you use - try to change the number 40 to something a bit smaller or larger.
Comment #23
Agogo CreditAttribution: Agogo commentedEhm... That last comment was added by me "Agogo" but it says it's posted from "alisonjo2786"? wtf?
Comment #24
alisonUmmmm yeah I was just thinking the same thing ("wtf?")..... I wasn't even logged in to Drupal.org on February 7, 2014!
It says I can edit the comment (since it thinks I was the author) -- I can add a note that Agogo is the real author as a really weak band-aid...
Comment #25
samwillc CreditAttribution: samwillc commented#5 worked for me. Thanks @altavis.
I didn't try #22 so can't comment on that.
Comment #26
mrogers CreditAttribution: mrogers commentedHad been struggling with this -- can confirm that #22 works well for me.
Comment #27
rcodina CreditAttribution: rcodina commented#5 worked for me too. Thanks!
admin/config/content/ckeditor/edit/Full + Advanced options + Custom JavaScript configuration
admin/config/content/ckeditor/edit/Advanced + Advanced options + Custom JavaScript configuration
config.height = 400;
Comment #28
Ronino CreditAttribution: Ronino commented#22 is great, thank you! I put it into a custom config file in a module to not have to alter the ckeditor module and adapted it a bit to more reflect the height of the original textarea:
Then I set the file in each profile's "Custom JavaScript configuration" field:
config.customConfig = '../../../custom/my_ckeditor/js/ckeditor.config.local.js';
Comment #29
Sutharsan CreditAttribution: Sutharsan commentedMade a patch out of #20 and #28. I've added a condition in case the rows value is not set. Not sure if this is possible, but it would cause the editor to disappear.
Comment #30
Sutharsan CreditAttribution: Sutharsan commentedComment #31
mengi CreditAttribution: mengi commentedPatch is #29 works great. Thanks for the patch!
From #30 it seems like there are duplicate issues.
Comment #32
Gemini Lights CreditAttribution: Gemini Lights commentedTested patch #29 is working. Thank you Sutharsan.
Comment #33
Sutharsan CreditAttribution: Sutharsan commented@mengi, @Gemini Lights, can you set this issue "Reviewed and tested by the community"?
Comment #34
Gemini Lights CreditAttribution: Gemini Lights commentedComment #35
ayalon CreditAttribution: ayalon commentedThanks! Works as expected. Reviewed #22. Can be commited.
Comment #36
DamienMcKenna+1.
Comment #38
jcisio CreditAttribution: jcisio commentedOk, 20 is reasonably good enough for line height, even it depends on the editor content CSS. Thanks for the patch. Committed and pushed.
Comment #40
UksusoFF CreditAttribution: UksusoFF commentedThis is partially broken on latest dev-version. Works only on node/add page, but not on node/*/edit
Comment #41
jcisio CreditAttribution: jcisio commentedI don't think the last comment is related to this fixed issue.
Comment #42
marcoka CreditAttribution: marcoka commentedwell the last comment is true :)
Comment #43
markus_petrux CreditAttribution: markus_petrux commentedIt also happens here as well. That js snippet I added to the file ckeditor.config.js in our theme folder, which is loaded and works, but editor height is still fixed. The code is executed, but changes here to config.height seem to be ignored.
We're using CKEditor library 4.5.7 ...the problem is related to the module or library?
So what can we do now? ...reopen here? ...create a separate issue?
Comment #44
markus_petrux CreditAttribution: markus_petrux commentedAny idea on why setting the height in ckeditor.config.js (*) is ignored?
(*) the one in our theme folder, which is actually loaded and runs when CKEditor is activated.
Comment #45
marcoka CreditAttribution: marcoka commentedI also tried adding that setting to the config page on the ui /admin/config/content/ckeditor/edit/Full
Height doesnt change and is way to small, meaning i have to scale it on node edit.
ckeditor 4.5.6
Comment #46
FrancewhoaComment #47
Francewhoa