mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Fux #2006 allow some aspect-ratio values and all valid object-fit values in HTML filter
This commit is contained in:
parent
bf54cd8ceb
commit
a44959382e
2 changed files with 16 additions and 0 deletions
|
|
@ -441,6 +441,14 @@ class HTMLFilter
|
||||||
$info['resize'] = new \HTMLPurifier_AttrDef_Enum(array(
|
$info['resize'] = new \HTMLPurifier_AttrDef_Enum(array(
|
||||||
'none', 'both', 'horizontal', 'vertical', 'initial', 'inherit',
|
'none', 'both', 'horizontal', 'vertical', 'initial', 'inherit',
|
||||||
));
|
));
|
||||||
|
$info['aspect-ratio'] = new \HTMLPurifier_AttrDef_CSS_Composite(array(
|
||||||
|
new \HTMLPurifier_AttrDef_CSS_Number(),
|
||||||
|
new \HTMLPurifier_AttrDef_Enum(array('2/1', '16/9', '4/3', '1/1', '3/4', '9/16', '1/2')),
|
||||||
|
new \HTMLPurifier_AttrDef_Enum(array('auto', 'initial', 'inherit')),
|
||||||
|
));
|
||||||
|
$info['object-fit'] = new \HTMLPurifier_AttrDef_Enum(array(
|
||||||
|
'contain', 'cover', 'fill', 'none', 'scale-down', 'initial', 'inherit',
|
||||||
|
));
|
||||||
|
|
||||||
// Wrap all new properties with a decorator that handles !important.
|
// Wrap all new properties with a decorator that handles !important.
|
||||||
$allow_important = $config->get('CSS.AllowImportant');
|
$allow_important = $config->get('CSS.AllowImportant');
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,14 @@ class HTMLFilterTest extends \Codeception\TestCase\Test
|
||||||
$source = '<div style="overflow-x:auto;overflow-y:scroll;left:-500px;"></div>';
|
$source = '<div style="overflow-x:auto;overflow-y:scroll;left:-500px;"></div>';
|
||||||
$target = '<div style="overflow-x:auto;overflow-y:scroll;"></div>';
|
$target = '<div style="overflow-x:auto;overflow-y:scroll;"></div>';
|
||||||
$this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source));
|
$this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source));
|
||||||
|
|
||||||
|
$source = '<div style="aspect-ratio:9/16;object-fit:cover;"></div>';
|
||||||
|
$target = '<div style="aspect-ratio:9/16;object-fit:cover;"></div>';
|
||||||
|
$this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source));
|
||||||
|
|
||||||
|
$source = '<div style="aspect-ratio:3;"></div>';
|
||||||
|
$target = '<div style="aspect-ratio:3;"></div>';
|
||||||
|
$this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHTMLFilterEmbeddedMedia()
|
public function testHTMLFilterEmbeddedMedia()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue