FIX HTMLEditorField::setRows minimal hieght (#10965)

This commit is contained in:
Sabina Talipova 2024-01-11 15:00:24 +13:00 committed by GitHub
parent ad8cf9902c
commit ff3a6f72df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,19 +114,22 @@ class HTMLEditorField extends TextareaField
public function getAttributes()
{
$config = $this->getEditorConfig();
// Fix CSS height based on rows
$rowHeight = $this->config()->get('fixed_row_height');
$attributes = [];
if ($rowHeight) {
if ($rowHeight && ($config instanceof TinyMCEConfig)) {
$height = $this->getRows() * $rowHeight;
$attributes['style'] = sprintf('height: %dpx;', $height);
$config = clone $config;
$config->setOption('height', 'auto');
}
// Merge attributes
return array_merge(
$attributes,
parent::getAttributes(),
$this->getEditorConfig()->getAttributes()
$config->getAttributes()
);
}