Problem/Motivation
There is no way to change the CKeditor height, especially if one wants to make it smaller.
The result is a UI WTF where all input areas are of equal height, be they supposed to contain only one line or multiple.
As stated in the linked issues, the height of a line varies in wysiwyg, so "having exactly n lines" is not possible by principle.
So this issue's scope is to approximately reflect the row setting.
- D7 issue: #507696: Allow individual width/height per field
- D8 workaround and #2717599-7: Text editors do not respect <textarea rows>: make that clear in the formatted text field widgets
- CKEditor issue
Proposed resolution
Take the patch from #2717599-7: Text editors do not respect <textarea rows>: make that clear in the formatted text field widgets which makes height = a + b * rows (where rows is configurable per field), and make a and b sitebuilder-configurable globally.
Optionally let the solution ripe in contrib before moving it into core.
Remaining tasks
Code. review, commit.
User interface changes
An additional config section for said parameters.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#30 | ckeditor5.js_.txt | 901 bytes | mark_fullmer |
Comments
Comment #2
geek-merlinComment #4
Wim LeersComment #5
Wim Leers#507696: Allow individual width/height per field didn't fix this in the more than eight years that issue was open.
The patch you link to as being a solution (#2717599-7: Text editors do not respect <textarea rows>: make that clear in the formatted text field widgets) is a hack that doesn't work reliably in all situations, which is why we didn't commit that to Drupal core.
Really, #2717599: Text editors do not respect <textarea rows>: make that clear in the formatted text field widgets already explored all possibilities AFAICT. I told you at #2788905-7: "Number of rows" configuration on Page Body field not working:
You didn't say what you wanted to see happen on top of what has already been done, and how you propose we do that, differently from what #2717599: Text editors do not respect <textarea rows>: make that clear in the formatted text field widgets already tried to do a long time ago.
There's no point in asking to fix something that is not fixable, unless you provide some idea for how to fix it.
Comment #6
geek-merlinHuh, that's harsh.
Comment #7
geek-merlinUpdated IS. Needswork as of patch from #2717599-7: Text editors do not respect <textarea rows>: make that clear in the formatted text field widgets.
Comment #8
geek-merlinComment #9
Wim Leers#6: Sorry, I didn't mean to be harsh. Reading my comment at #5, I of course agree that was unnecessarily harsh.
But I hope you also understand my point: we discussed this at length many times in the past. It's pointless to repeat the exact same discussion. So without new ideas, new perspectives, we'll just end up repeating the previous discussion, which is a waste of everybody's time. That is what I tried to convey, but I did that far too harshly 😥 Sorry! 😔
Comment #10
geek-merlin@wim: Any comments on the updated IS? I did read the whole discussion, and the only objection, that wos not thoroughly discussed IMHO, was yours from #2717599-8: Text editors do not respect <textarea rows>: make that clear in the formatted text field widgets. So from my information, without other references, i can not follow your claim there:
To re-state your objection from #2717599-8: Text editors do not respect <textarea rows>: make that clear in the formatted text field widgets:
So even if there was a consensus reached in a place that i do not know, i can not see the cited objections hold for
a) the goal of *approximately* reflectiong the row setting like stated in title and IS, and
b) an implementation that makes the row-to-height mapping configurable like proposed in the IS
Comment #12
geek-merlinImplemented this in contrib land for now. (JS object decorators FTW!)
https://www.drupal.org/project/ckeditorheight
Still thinking it should come with core.
Comment #13
geek-merlinComment #15
AnybodyAs we can see in the growing usage of axel.rutz contrib module, there's demand for this fix... I also agree this should be part of core, otherwise this form setting (rows) makes no sense at all for default ckeditor. And yes, there are many cases where you want a small or a hughe field dependent on expected content. Autogrow (in core already) helps if the field is too small then...
PS: The ckeditorheight plugin works like a charm :)
Comment #16
AnybodyShell we create a patch based on axel.rutz module to proceed here? The current situation where the setting simply has no effect is much worse than the solution from #12. So I don't unterstand what's the show-stopper here even after reading the linked issues / discussions.
@Wim Leers, would you mind to have a look at the contrib module and see what it does to compate that against the current core behaviour as documented in the issue description? Of course nobody wants to waste anyones time, but I think we can lead this to a fine solution.
Comment #18
mlncn CreditAttribution: mlncn at Agaric for MASS Design Group, Drutopia, Find It Cambridge, Cambridge, Massachusetts Family Policy Council commentedI would very much like to see a patch based on the module. I am using the module on all sites now. It is simply providing expected behavior. I thought that when changing the rows failed to change the height, that it was a bug. I didn't even mentally register the "explanatory" text until finding issues about the problem, and still think the explanatory text is inadequate— but the very fact that it was added at all, indicates a need for this approximation fix instead.
Comment #19
AnybodyI absolutely agree with #18!
Comment #21
PhilYUsing the CKEditorHeight module too on several sites without problem.
Comment #23
Wim Leershttps://ckeditor.com/blog/CKEditor-4.14.1-with-resizing-and-toolbar-impr... introduced new capabilities that may affect this — see https://ckeditor.com/docs/ckeditor4/latest/features/size.html for details.
#3155110: [backport] Update CKEditor to version 4.14.1 updated Drupal to CKEditor 4.14.1.
Comment #28
quietone CreditAttribution: quietone at PreviousNext commentedCKEditor has been removed from core, CKEditor 4 is removed from Drupal Core in 10.0.0
Comment #29
tgoeg CreditAttribution: tgoeg commentedHas anyone tried out whether this just shifts the problem to CKEditor5 and we need a new ticket, then, or if it is solved in v5/solvable by different means?
Comment #30
mark_fullmerThe contrib module CKeditor Height issue queue reports that their current implementation does not work with CKEditor 5: https://www.drupal.org/project/ckeditorheight/issues/3274041
The issue in the CKEditor 5 queue regarding this is https://github.com/ckeditor/ckeditor5/issues/636 , and it doesn't appear that they're providing a solution as of right now. A workaround is referenced in https://github.com/ckeditor/ckeditor5/issues/636#issuecomment-405952805 , specifically https://stackoverflow.com/a/46559355
If we wanted to apply this to Drupal markup syntax, a well-scoped CSS-only solution (tested, works), would be to add min-height declarations for a series of row attributes, a la:
Being squeamish about such CSS verbosity, I also explored a JS approach that would add the min-height as an inline style (attached file). However, the auto_grow plugin uses JS to adjust the CKEditor window, which would remove the inline style. I can picture some JS that reapplies the style on change, but this would have its own disadvantages.
Comment #31
John Pitcairn CreditAttribution: John Pitcairn commentedUnfortunately no browser will currently let us use the rows attribute value in css via a simple
attr(rows)
. But the css verbosity can be reduced somewhat with something like:Or a js solution (or Drupal preprocess) could insert the --rows variable in an inline style for css to use.
Comment #32
tgoeg CreditAttribution: tgoeg commentedPreprocessing sounds the least intrusive and most compatible with other modules, to me at least.
I am just a sysadmin, but from what I gather from modules and preprocessing until now, I think this could be put into a simple loop and would somewhat abstract the ugliness of defining every single
--rows
variable (at least in code, the resulting CSS definitely has the list).Generally speaking this should make it into core (or core's CKEditor5 module) as a fixed part eventually, not as an additional piece of code a theme or a module adds. This would keep those two parts (preprocessing and applying the CSS) pretty close together, which sounds favorable to me. Splitting the two parts too far apart would otherwise by a little hard to grasp (and understand/maintain later on).
Comment #33
geek-merlin> Generally speaking this should make it into core (or core's CKEditor5 module) as a fixed part eventually, not as an additional piece of code a theme or a module adds.
The CKEditor5 debate lives here, see my comment: #3241295-25: CKEditor 5 isn't respecting field widgets row settings
And as ckeditorheight.module creator: If someone moves the code into ckeditor4.module, i'm all for it.
Comment #34
geek-merlinGiven that the contrib module exists and works for mans, and the approach went core, i deem this wontfix now.
Thanks everyone!