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.
Steps to reproduce the bug:
- Install Drupal 7.15 with Minimal installation profile
- Assure the following modules are enabled:
"Field", "Field SQL storage", "Field UI", "Filter", "Path", "PHP filter", "Text" (minimum enviroment for content types creation) - Add a content type called Article, with all default options
- Try to create an article to see that "Body" field is normal
- Install Fieldgroup 7.x-1.1 (plus "CTools")
- Go to "Manage Fields" (Structure » Content types » Article »)
- Add a new group with a Fieldset widget and change "Fieldgroup settings" to collapsed
- Place "Body" field inside this fieldset
- Try to create an article, again, to see the "Body" field is still normal
- Now enable Wysiwyg 7.x-2.1 and install NicEdit 0.9 editor
- And then associate NicEdit with "Plain Text" input format
- At last try to create an article one more time to witness that "Body" field has shrunk
P.S.: With CKEditor 3.6.3.7474 there is no such problem.
Comments
Comment #1
3magnus CreditAttribution: 3magnus commentedComment #2
TwoDThis happens because of a line in nicedit.js (inside NicEdit itself).
var panelElm = new bkElement('DIV').setStyle({width : (parseInt(e.getStyle('width')) || e.clientWidth)+'px'}).appendBefore(e);
e
is a reference to the textarea being replaced by the editor.The problem is that
e.getStyle('width')
will return 100% when the textfield is hidden (as that's how it's styled), which is then turned into the integer 100. The textarea doesn't actually have a calculated width yet. Even if NicEdit wasn't tricked into thinking 100% is 100px, it would probably not be able to figure out what 100% means until the textarea is shown and gets a calculated width anyway.I'm not sure what to do about this since I can't find a reliable way to figure out how big the textarea is going to be either.
If you click "Disable rich-text" after opening the collapsed fieldset and then click "Enable rich-text", NicEdit will be able to figure out the correct size this time around as the textarea is now visible.
Comment #3
3magnus CreditAttribution: 3magnus commentedGot the problem. It's tricky (without a better word to describe it).
My solution (for now) is exactly to enable the "rich-text" link, wich was not needed and was disabled at first.
And about the issue itself, I'm really not good at script languages (for now), but I can see two options to solve it:
I'll try to help more, but first I'll need some hard studying.
Comment #4
TwoDCKEditor uses a different method to determine its initial size, as this happens internally in the editor I don't think we can do much about it.
I'm not sure I understand your second point.
Comment #5
3magnus CreditAttribution: 3magnus commentedMy workaround was: disable rich-text mode by default and enable rich-text toggle link. So when you just open the fieldset, the body field is in it's full size but configured for plain text only. Then you click in "enable rich-text" and everything goes normal.
And my point was about gathering theese two actions in just one link. So instead user clicking the fieldset title link (to open it) AND THEN clicking the enable rich-text link (to have it all), he/she could have both actions in just one clicking, on the fieldset opening link.
Of course this would only work if rich-text is disabled by default.
Comment #6
TwoDThis is very similar to what happens with some editors in hidden vertical tabs.
I'll mark this a duplicate of that issue for now and I'll look into trying to detect whether an editor will be visible or not later. I'm not going to give it a very high priority though since the editor does still work and I don't think I can create a very reliable solution at this point.
I did implement something similar for the Summary fields, but doing the same for the main fields without altering the API behavior will be more difficult.
Any help would be appreaciated.
Comment #7
TwoD*facepalm*
Actually marking it a duplicate...