From 04e275ccfc3cebc216ad297b94791b1b86efab1e Mon Sep 17 00:00:00 2001 From: Fedik Date: Thu, 2 Jun 2022 17:58:50 +0300 Subject: [PATCH 1/2] Fix TinyMCE height for multiple editor instances --- .../tinymce/src/PluginTraits/DisplayTrait.php | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php index f570b383f9886..f879fd6704fd1 100644 --- a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php +++ b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php @@ -84,19 +84,34 @@ public function onDisplay( $editor .= !$this->app->client->mobile ? LayoutHelper::render('joomla.tinymce.togglebutton') : ''; $editor .= ''; - // Prepare the instance specific options, actually the ext-buttons - if (empty($options['tinyMCE'][$fieldName]['joomlaExtButtons'])) + // Prepare the instance specific options + if (empty($options['tinyMCE'][$fieldName])) { - $btns = $this->tinyButtons($id, $buttons); + // Width and height + if ($width) + { + $options['tinyMCE'][$fieldName]['width'] = $width; + } - // Set editor to readonly mode - if (!empty($params['readonly'])) + if ($height) { - $options['tinyMCE'][$fieldName]['readonly'] = 1; + $options['tinyMCE'][$fieldName]['height'] = $height; } - $options['tinyMCE'][$fieldName]['joomlaMergeDefaults'] = true; - $options['tinyMCE'][$fieldName]['joomlaExtButtons'] = $btns; + // The ext-buttons + if (empty($options['tinyMCE'][$fieldName]['joomlaExtButtons'])) + { + $btns = $this->tinyButtons($id, $buttons); + + // Set editor to readonly mode + if (!empty($params['readonly'])) + { + $options['tinyMCE'][$fieldName]['readonly'] = 1; + } + + $options['tinyMCE'][$fieldName]['joomlaMergeDefaults'] = true; + $options['tinyMCE'][$fieldName]['joomlaExtButtons'] = $btns; + } $doc->addScriptOptions('plg_editor_tinymce', $options, false); } @@ -471,8 +486,8 @@ public function onDisplay( 'document_base_url' => Uri::root(true) . '/', 'image_caption' => true, 'importcss_append' => true, - 'height' => $height ?: $this->params->get('html_height', '550px'), - 'width' => $width ?: $this->params->get('html_width', ''), + 'height' => $this->params->get('html_height', '550px'), + 'width' => $this->params->get('html_width', ''), 'elementpath' => (bool) $levelParams->get('element_path', true), 'resize' => $resizing, 'templates' => $templates, From 3f81350213597cc8dd00a538efeb853517b8383c Mon Sep 17 00:00:00 2001 From: Fedik Date: Thu, 2 Jun 2022 18:19:02 +0300 Subject: [PATCH 2/2] Fix TinyMCE height for multiple editor instances --- .../tinymce/src/PluginTraits/DisplayTrait.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php index f879fd6704fd1..8ea116b8cd8c8 100644 --- a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php +++ b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php @@ -98,17 +98,17 @@ public function onDisplay( $options['tinyMCE'][$fieldName]['height'] = $height; } + // Set editor to readonly mode + if (!empty($params['readonly'])) + { + $options['tinyMCE'][$fieldName]['readonly'] = 1; + } + // The ext-buttons if (empty($options['tinyMCE'][$fieldName]['joomlaExtButtons'])) { $btns = $this->tinyButtons($id, $buttons); - // Set editor to readonly mode - if (!empty($params['readonly'])) - { - $options['tinyMCE'][$fieldName]['readonly'] = 1; - } - $options['tinyMCE'][$fieldName]['joomlaMergeDefaults'] = true; $options['tinyMCE'][$fieldName]['joomlaExtButtons'] = $btns; }