Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.1] TinyMCE should prefer the editor dimensions and fallback to the plugin params #37603

Merged
merged 7 commits into from May 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 4 additions & 12 deletions plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php
Expand Up @@ -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;
laoneo marked this conversation as resolved.
Show resolved Hide resolved

// Data object for the layout
$textarea = new stdClass;
Expand All @@ -75,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']);

Expand Down Expand Up @@ -237,12 +235,6 @@ 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 = is_numeric($html_width) ? $html_width . 'px' : $html_width;
$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);
Expand Down Expand Up @@ -479,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', '550px'),
'width' => $width ?: $this->params->get('html_width', ''),
'elementpath' => (bool) $levelParams->get('element_path', true),
'resize' => $resizing,
'templates' => $templates,
Expand Down