? PBF ? Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
22 Apr 2022

Pull Request for #9812, #8591, #5820, #11851 and #8106.

Summary of Changes

The TinyMCE editor forces the plugin width and height instead of using the dimensions from the editor itself. This editor fixes it.

Testing Instructions

Test 1:

  • Set a width value of 200 and height of 300 in the TinyMCE plugin in the advanced tab and save.
  • Add the following code to the file administrator/components/com_content/tmpl/articles/default.php somewhere on the top
    echo JEditor::getInstance('tinymce')->display('description', '', '', '', '60', '5', false);
  • Open the url /administrator/index.php?option=com_content&view=articles
  • Inspect the editor with the dev tools in the browser.

Test 2:

  • Add the following code to the file administrator/components/com_content/tmpl/articles/default.php somewhere on the top
    echo JEditor::getInstance('tinymce')->display('description', '', '450', '400', '60', '5', false);
  • Open the startpage of your Joomla installation
  • Inspect the editor with the dev tools in the browser.

Test 3:

  • In the file administrator/components/com_content/forms/article.xml replace line 54 with
    buttons="true" height="370" width="380"
  • Open the article form
  • Inspect the editor with the dev tools in the browser.

Actual result BEFORE applying this Pull Request

Test 1:
Dimensions are 200x300.

Test 2:
Dimensions are 200x300.

Test 3:
Dimensions are 200x300.

Expected result AFTER applying this Pull Request

Test 1:
Dimensions are 200x300.

Test 2:
Dimensions are 450x400.

Test 3:
Dimensions are 370x380.

avatar laoneo laoneo - open - 22 Apr 2022
avatar laoneo laoneo - change - 22 Apr 2022
Status New Pending
avatar laoneo laoneo - change - 22 Apr 2022
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 22 Apr 2022
Category Front End Plugins
avatar richard67
richard67 - comment - 22 Apr 2022

@laoneo I am a bit confused by the title of this PR, which starts with "[4.2]" while target branch is 4.1-dev. What is right?

avatar brianteeman
brianteeman - comment - 22 Apr 2022

There is no point in this pr as it's changed in tinymce 6

sorry this bit stays the same I misread the hcanges and the new docs were not published at the time

avatar laoneo laoneo - change - 22 Apr 2022
Title
[4.2] TinyMCE should prefer the editor dimensions and fallback to the plugin params
[4.1] TinyMCE should prefer the editor dimensions and fallback to the plugin params
avatar laoneo laoneo - edited - 22 Apr 2022
avatar laoneo
laoneo - comment - 22 Apr 2022

There is no point in this pr as it's changed in tinymce 6

What has changed? Do you see the problem this pr addresses?

avatar brianteeman
brianteeman - comment - 22 Apr 2022

I am aware of the problem this addresses and I am trying to save you time as I am also aware of the changes in tinymce 6 and that at least one of the changes is directly related to the editor dimensions

avatar laoneo
laoneo - comment - 22 Apr 2022

Do you have a link to the change?

avatar richard67
richard67 - comment - 2 May 2022

New issue in the list of issues fixed by this PR see #37723 .

avatar Fedik
Fedik - comment - 2 May 2022

Sorry, this not going to work :

* @param string $width The width of the text area (px or %).
* @param string $height The height of the text area (px or %).

Note: (px or %)

Not that easy, and that probably a reason why this bug live so long ;)

We can probably drop % part, if it will work safely

avatar brianteeman
brianteeman - comment - 2 May 2022

https://www.tiny.cloud/docs/configure/editor-appearance/#height

If it is a number then tinymce assumes it is px
If it is a string then tinymce uses the units

avatar brianteeman
brianteeman - comment - 2 May 2022

omg we've all missed the obvious new pr incoming

avatar richard67
richard67 - comment - 2 May 2022

omg we've all missed the obvious new pr incoming

Which one?

avatar brianteeman
brianteeman - comment - 2 May 2022

@Fedik actually this works fine with both % and px. We do not need to have any of the lines with the is_numeric check as tinymce automatically sees a number as px without us adding anything

html_height = is_numeric($html_height) ? $html_height . 'px' : $html_height;

so all that is needed is to change

		$html_height = $this->params->get('html_height', '550');
		$html_width  = $this->params->get('html_width', '');
		$html_width  = $html_width == 750 ? '' : $html_width;
		$html_width  = is_numeric($html_width) ? $html_width . 'px' : $html_width;

to

		$html_width  = $width ?: $this->params->get('html_width', '');
		$html_height = $height ?: $this->params->get('html_height', '550');

and we can also delete lines 68 and 69 as they are not needed

avatar laoneo
laoneo - comment - 2 May 2022

I did that in this pr, or is there something missing?

avatar brianteeman
brianteeman - comment - 2 May 2022

@laoneo you just need to delete the 4 lines with isnumeric as they are not needed

avatar laoneo laoneo - change - 3 May 2022
Labels Added: PBF
avatar laoneo
laoneo - comment - 9 May 2022

@Fedik thanks for the hint, added the check in 95fd92c.

avatar JonasAtZwetschke
JonasAtZwetschke - comment - 11 May 2022

I have tested this item successfully on 177c2ef


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

avatar JonasAtZwetschke JonasAtZwetschke - test_item - 11 May 2022 - Tested successfully
avatar Fedik
Fedik - comment - 14 May 2022

I have tested this item successfully on 177c2ef


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

avatar Fedik Fedik - test_item - 14 May 2022 - Tested successfully
avatar Fedik Fedik - change - 14 May 2022
Status Pending Ready to Commit
avatar Fedik
Fedik - comment - 14 May 2022

r2c


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

avatar bembelimen bembelimen - close - 17 May 2022
avatar bembelimen bembelimen - merge - 17 May 2022
avatar bembelimen bembelimen - change - 17 May 2022
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-05-17 18:47:08
Closed_By bembelimen
Labels Added: ?
avatar bembelimen
bembelimen - comment - 17 May 2022

Thx

Add a Comment

Login with GitHub to post a comment