add cleanup of html string extracted from grapesjs content

This commit is contained in:
Simon Vieille 2022-06-12 23:24:41 +02:00
parent 6e0a4107c7
commit cf3bc02ed7
Signed by: deblan
GPG key ID: 579388D585F70417

View file

@ -25,6 +25,8 @@ class GrapesJsExtension extends AbstractExtension
{ {
$html = $this->extractData($value, 'html'); $html = $this->extractData($value, 'html');
$html = str_replace($this->getHtmlStringsToRemove(), '', $html);
return preg_replace('#</?body[^>]*>#', '', $html); return preg_replace('#</?body[^>]*>#', '', $html);
} }
@ -39,4 +41,11 @@ class GrapesJsExtension extends AbstractExtension
return $data[$key] ?? ''; return $data[$key] ?? '';
} }
protected function getHtmlStringsToRemove(): array
{
return [
'draggable="true"',
];
}
} }