Set width for each field
| Project: | Wysiwyg |
| Version: | 6.x-2.x-dev |
| Component: | Editor - FCKeditor |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Jump to:
I don't mind writing this myself if I can make the time. What I'd like to do is add a section to the config for each profile that lists the textarea fields and then provides width and height boxes to fill in. I would save the values along with the others in the DB. I see where the current module sets all widths to 100% (in wysiwyg_fckeditor_settings). And I see that there is a '$config' variable being passed in. But I'm having trouble figuring out where the wysiwyg_fckeditor_settings function is called and also whether anything is passed in which identifies the field itself that could be used to key off of the width and height settings I want to save.
Some things that might help me figure this out:
What function makes the call to wysiwyg_fckeditor_settings?
What calls that function, and what calls that one, all the way on up? I think a function call tree would help here. That way, I'd be able to figure out how to get a field identifier and pass it on down.
Make sense? Why do it? There is a function in fckeditor or in wysiwyg (I don't recall which) that prevents changing any style elements of the iframe in which the editor is placed.
Could this be generalized somehow for the other editors? I don't know.

#1
Looking at wysiwyg.module this is what I find:
wysiwyg_process_form(&$form)wysiwyg_add_editor_settings($profile, $theme)
$config = wysiwyg_get_editor_config($profile, $theme)
$settings = $editor['settings callback']($editor, $profile->settings, $theme)
Hope that helps a bit.
#2
Why do you want to configure the width and height per field in the first place?
And why can't you use CSS to adjust the width of the surrounding container?
#3
Why do I want to do it? One word - "multigroups". If you haven't tried them yet in CCK (currently in version 3.x), then you're missing out! When I get in to work tomorrow, I'll show a screenshot of what I'm working with. But for now, I was able to find a work around of sorts.
First, there was a bit of code which specified the height of all WYSIWYG boxes to be 400px, which I commented out. This has the result of using the fckeditor default height of 200px, which was better for me.
Second, since there is code which I mentioned before that specifically disallows the changing of the height/width of a WYSIWYG box, I instead made the text areas the last item in the multigroup row and then specified the widths of all of the items before it. This allowed the text area to fill the remaining space. I would imagine though, that there could be times where it is not convenient to reorder form elements to make this accommodation.
If you don't know what code I'm referring to when I say that there is a function that disallows the changing of the width and height, I'll look it up for you. There is actually a comment there in the code that says 'prevent', or 'don't allow', or 'disallow' or something like that. You could do a search. I don't recall whether that was in fckeditor itself or WYSIWYG. I think it was in fckeditor since the dimensions are supposed to be passed in as constructor parameters. So... what I really need is a way to set the constructor parameters for each instance of the WYSIWYG.
Make sense?
#4
well, multigroup or not - do you think that admins will (and want to) configure editors separately for every single field in their Drupal site?
#5
obviously, you give them the default that now exists. But really, yes, I do think admins want this, which is why most of the basic CCK fields have width/length settings. I mean, the standard text area allows you to set the height, which this module also doesn't honor.
I realize that others haven't chimed in on this, but then again, this post isn't very visible. Without multigroups, which is in the 3.x version of CCK now and will be official soon, one can always move the text area to another line. With multigroups, you can't.
Try multigroups before you decide one way or the other.
#6
Configuring the height of fields is very important. If you need to create a CCK field which needs to contain a small amount of formatting information, you'll want to be able to keep those fields from blowing up your edit form vertically.
On every site we do, I configure at least five additional filtered-text fields for every node that is ever rendered as a page:
The first three need to be shorter than body copy fields, or you have the following problems with users:
Short version: This is just something people need to do. Other editor modules support it. It's a significant usability problem to not have it. WYSIWYG is not a viable option for any site my company implements until this feature is included.