From fb3cf5b62e00ba24b63d8afef0e30009d3416fe0 Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Fri, 22 Apr 2022 11:09:52 +0200 Subject: [PATCH 1/4] TinyMCE should prefer the editor dimensions and fallback to the plugin params --- plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php index b8f8b630f00b0..ac8670d3b7c3a 100644 --- a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php +++ b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php @@ -237,10 +237,9 @@ public function onDisplay( $valid_elements = trim($levelParams->get('valid_elements', '')); } - $html_height = $this->params->get('html_height', '550'); - $html_width = $this->params->get('html_width', ''); - $html_width = $html_width == 750 ? '' : $html_width; + $html_width = $width ?: $this->params->get('html_width', ''); $html_width = is_numeric($html_width) ? $html_width . 'px' : $html_width; + $html_height = $height ?: $this->params->get('html_height', '550'); $html_height = is_numeric($html_height) ? $html_height . 'px' : $html_height; // The param is true for vertical resizing only, false or both From cf1047b83444f7cd163af6790eb01095806b173a Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Tue, 3 May 2022 13:41:25 +0200 Subject: [PATCH 2/4] remove numeric check --- .../editors/tinymce/src/PluginTraits/DisplayTrait.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php index ac8670d3b7c3a..401f9cb3fe721 100644 --- a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php +++ b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php @@ -65,8 +65,6 @@ public function onDisplay( $externalPlugins = []; $options = $doc->getScriptOptions('plg_editor_tinymce'); $theme = 'silver'; - $width = is_numeric($width) ? $width . 'px' : $width; - $height = is_numeric($height) ? $height . 'px' : $height; // Data object for the layout $textarea = new stdClass; @@ -237,11 +235,6 @@ public function onDisplay( $valid_elements = trim($levelParams->get('valid_elements', '')); } - $html_width = $width ?: $this->params->get('html_width', ''); - $html_width = is_numeric($html_width) ? $html_width . 'px' : $html_width; - $html_height = $height ?: $this->params->get('html_height', '550'); - $html_height = is_numeric($html_height) ? $html_height . 'px' : $html_height; - // The param is true for vertical resizing only, false or both $resizing = (bool) $levelParams->get('resizing', true); $resize_horizontal = (bool) $levelParams->get('resize_horizontal', true); @@ -478,8 +471,8 @@ public function onDisplay( 'document_base_url' => Uri::root(true) . '/', 'image_caption' => true, 'importcss_append' => true, - 'height' => $html_height, - 'width' => $html_width, + 'height' => $height ?: $this->params->get('html_height', '550'), + 'width' => $width ?: $this->params->get('html_width', ''), 'elementpath' => (bool) $levelParams->get('element_path', true), 'resize' => $resizing, 'templates' => $templates, From 0c9ad041b48077a68a8a7471a4d5c031e76fdd51 Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Tue, 3 May 2022 15:06:01 +0200 Subject: [PATCH 3/4] same default value as manifest --- plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php index 401f9cb3fe721..dedaed143686e 100644 --- a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php +++ b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php @@ -471,7 +471,7 @@ public function onDisplay( 'document_base_url' => Uri::root(true) . '/', 'image_caption' => true, 'importcss_append' => true, - 'height' => $height ?: $this->params->get('html_height', '550'), + 'height' => $height ?: $this->params->get('html_height', '550px'), 'width' => $width ?: $this->params->get('html_width', ''), 'elementpath' => (bool) $levelParams->get('element_path', true), 'resize' => $resizing, From 95fd92c22994ec55ccb5b6a3e7ac2bcb6e5f47dc Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Mon, 9 May 2022 11:09:57 +0200 Subject: [PATCH 4/4] text area dimensions --- plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php index dedaed143686e..f570b383f9886 100644 --- a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php +++ b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php @@ -73,8 +73,8 @@ public function onDisplay( $textarea->class = 'mce_editable joomla-editor-tinymce'; $textarea->cols = $col; $textarea->rows = $row; - $textarea->width = $width; - $textarea->height = $height; + $textarea->width = is_numeric($width) ? $width . 'px' : $width; + $textarea->height = is_numeric($height) ? $height . 'px' : $height; $textarea->content = $content; $textarea->readonly = !empty($params['readonly']);