? Success

User tests: Successful: Unsuccessful:

avatar astridx
astridx
4 Dec 2015

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.

avatar astridx astridx - open - 4 Dec 2015
avatar astridx astridx - change - 4 Dec 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 Dec 2015
Labels Added: ?
avatar infograf768
infograf768 - comment - 4 Dec 2015

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.

avatar astridx
astridx - comment - 4 Dec 2015

@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?

avatar infograf768
infograf768 - comment - 5 Dec 2015

The ideal would imho being able to override the default as set in Tiny.
@dgt41
Any idea?

avatar bertmert
bertmert - comment - 5 Dec 2015

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.

avatar astridx
astridx - comment - 5 Dec 2015

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.

avatar bertmert
bertmert - comment - 5 Dec 2015

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?

  • Only when height in TinyMce is empty? OK. This would be a condition we have already after your PR. Easy.
if (!$this->params->get('html_height'))
{
 --override--
}
  • But if you enter a height value in tynimce what's the criterion then? Again: we always have a height value in the editor form field. Is never empty.
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.

avatar dgt41
dgt41 - comment - 5 Dec 2015

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
avatar infograf768
infograf768 - comment - 6 Dec 2015

@dgt41
This imho does not solve the issue at stake (possibility of overriding Tiny $html_height in a specific xml editor field) + , as far as I remember, we had a good reason to include:

if ($html_width == 750)
        {
            $html_width = '';
        }
avatar astridx
astridx - comment - 6 Dec 2015

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?

avatar infograf768
infograf768 - comment - 6 Dec 2015

concerning $html_width == 750, see
#3674

We may have to keep this to cope with people upgrading from 2.5 or early 3.x

avatar astridx
astridx - comment - 6 Dec 2015

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?

avatar bertmert
bertmert - comment - 6 Dec 2015

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.

avatar astridx
astridx - comment - 7 Dec 2015

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?

avatar astridx
astridx - comment - 8 Dec 2015

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

avatar bertmert
bertmert - comment - 8 Dec 2015

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.

avatar brianteeman brianteeman - change - 10 Mar 2016
Category Fields
avatar conconnl
conconnl - comment - 28 Jun 2016

Will be solved through #8106
This one can be closed


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8591.

avatar roland-d
roland-d - comment - 29 Jun 2016

Closed in favour of #8106 Thanks everybody.

avatar roland-d roland-d - change - 29 Jun 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-06-29 06:19:52
Closed_By roland-d
avatar roland-d roland-d - close - 29 Jun 2016

Add a Comment

Login with GitHub to post a comment