Skip to content

Commit

Permalink
Fix TinyMCE height for multiple editor instances
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedik committed Jun 2, 2022
1 parent 5ab40c1 commit 04e275c
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php
Expand Up @@ -84,19 +84,34 @@ public function onDisplay(
$editor .= !$this->app->client->mobile ? LayoutHelper::render('joomla.tinymce.togglebutton') : '';
$editor .= '</div>';

// 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);
}
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 04e275c

Please sign in to comment.