User tests: Successful: Unsuccessful:
The XML code I have in my extensions for the form field type editor did not use my defined height of 100px it always shows the standard height of 550px -
type="editor"
label="Description"
height="100" />
I think that this is a bug in the Tiny MCE plugin. This plugin sets 550px as height in the setting parameters and that overrides the height definition in the custom XML forms.
How to test:
1. Open Component | Newsfeed| New and check, that the height of the editor is 550px.
2. Set the value of a custom form field with the type editor for the height to 100px. For example: Open the file JOOMLA\administrator\components\com_newsfeeds\models\forms\newsfeed.xml and set in a height for the editor of 100px.
3. Open Extension | Plugin | Tiny MCE -> Advanced and delete the value for the html-height
4. Open again Component | Newsfeed| New and see, that the height of the editor is still 550px. I would expect that this height is now 100px!!
Check the patch:
1. After you completed steps 1 to 4 apply the patch.
2. Again, open Component | Newsfeed| New and see, that the height of the editor is now 100px.
3. Open after that the settings of other Joomla! core components and check that the height of this are still 550px.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
@infograf768 Thank you very much for the testing.
Yes, you are right. It works only, if the parameter in the plugin settings is empty. But this would be OK for me. That parameter was the first, I checked when I realized, that my XML settings for my extension are ignored. See point 3 in “How to test“. And then I was confused, that also I deleted this value, my values in my XML-file are still ignored. Only after deleting this default values in the code it was possible for me to reach the volitional height for the editor in my extension. That is why I think, that this is a failure.
And a default height of 500px is OK for all other components which need this, because they do not set a fixed value for the height of their editors. Or do you think this is a problem?
Overriding is not easy because the form field (JFormFieldEditor) also provides a default height of 500, so always has a value. That's a must because we don't know which editor is used.
Thus after longer investigations I couldn't find a solution NOT to override the tinymce-height-setting (without several ugly conditions in files not directly related to tinymce) even if one hasn't set a height in custom editor field.
In the end I tried in tinymce.php::onDisplay(...). That's the method where the height of the form field "is landing" directly in plugin tinymce.php
...
$editor .= '</div>';
$js = '
<script>
(function($){
$(window).load(function(){
$("#' . $textarea->id . '" + "_ifr").css("height", "' . $textarea->height . '");
}); //window load
})(jQuery);
</script>
';
$editor .= $js;
return $editor;
...
Maybe an additional option for height like "Use Joomla settings" in tynymce.xml would provide a plugin param for a surrounding condition for this code (or a similiar one).
BTW: Instead of setting default="" I would use default="auto" in tinymce.xml/.php because of an ugly empty height: in iframe style.
I am not sure if I understood everything right. So the default height of 550px is important for Joomla!? I do not understand why? Could you please explain it to me?
@bertmeert
You are right with “auto”. I will change it.
Based on your PR (default="") the question occured if it would be possible to override a tinymce-setting when the editor form field has a height attribute in XML. So, I started with your PR.
But even if you don't set a height for editor form field the editor form field gets ALWYAYS a default height value of 500 (not 550 from TinyMce!) . See class JFormFieldEditor relevant for ALL editors, not only TinyMce. In this class we need the default 500.
What's the criterion now for overriding the TinyMce-Setting?
if (!$this->params->get('html_height'))
{
--override--
}
if (editor field height)
{
override tinymce height. set iframe height to editor field height
}
This doesn't work because if is always true and tinmce height would be ALWAYS overridden / ignored, also if you haven't set explicitly a height in your custom XML. Then always 500 even if you have set 1000 in tinymce. The tinymce setting would become senseless.
We need an additional condition from the tinymce plugin to decide.
Some more background:
Have also a look e.g. via Firebug.
There's an iframe that has the height from tinymce.
And there's a hidden textarea that always gets the height from the editor form field.
That's why I used JQuery to force the iframe to take over the height from the textarea.
According to tinyMCE's documentation https://www.tinymce.com/docs/configure/editor-appearance/#height and the code that already exists I would go with these changes:
$html_height = $this->params->get('html_height', '');
$html_width = $this->params->get('html_width', '');
if (isset($html_width))
{
$html_width = 'height : "' . $html_width . '",';
}
if (isset($html_height))
{
$html_height = 'height : "' . $html_height . '",';
}
and then in the extended case
image_advtab: $image_advtab,
$html_height
$html_width
OK, now I understand.
I accepted that the settings, the user set in the settings of the TinyMCE are superior to my settings in the XML of my extension. Only when I was not able to delete these settings I get hackles :)
But as there is always a default height I wonder, why we need this parameter in the settings of the TinyMCE Plugin. I do not know the reason for the setting of $html_width=’’ if $html_width == 750.
Perhaps it would be more productive to use max_heigth https://www.tinymce.com/docs/configure/editor-appearance/#max_height in place of height in the TinyMCE Settings?
Thank you for the link.
So, why do we not delete the possibility of setting the options for the width and the height in the TinyMCE Plugin on the whole and leave only the width for B/C reasons?
Perhaps it would be more productive to use max_heigth
Test it! I've tried it already and max_height was completely ignored.
So, why do we not delete the possibility of setting the options for the width and the height in the TinyMCE Plugin
Because these are options for backend users to style their editors like they want and because it is the only place where they can do that.
Test it! I've tried it already and max_height was completely ignored.
If you tested it, I do not need to try it. I am certain, that you are right. I only proposed it, because I did not know why we need $html_width == 750 and I thought this could be an alternative way to solve this issue. But I wonder why no one before me tested this :)
Because these are options for backend users to style their editors like they want and because it is > the only place where they can do that.
But in this case my PR is right. Why do we want to override settings, we want to provide for backend users?
By the way this is what I thought instinctively. When I created my extension, I set the values for the editor height and tested it. Joomla ignored my settings in the extensions XML. So I checked why and I saw quickly the settings in the TinyMCE Plugin. That was an explanation for me.
So why do we search for a method to override this setting when we want that the backend users set this value if they like?
For me the bug is, that it is not possible to delete this value. Or is there a flaw in my argument?
I just saw that I am not the only one who is angry about the height of the editor: http://joomla.stackexchange.com/questions/14249/height-and-width-are-not-considered-for-an-editor-form-field
I have to say that I'm using JCE, never TinyMce ;-)
I dont't want to block this PR.
I failed at finding a practicable, clean solution without touching files "outside tinymce plugin" for overriding conditions (#8591 (comment)). Maybe others are more clever or just agree with this PR.
Category | ⇒ | Fields |
Will be solved through #8106
This one can be closed
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-06-29 06:19:52 |
Closed_By | ⇒ | roland-d |
As far as I could test, this works only when the height field is empty in Tiny parameters.
If no height is defined, in the xml or Tiny, the textarea defaults to 500px.