Skip to content
Snippets Groups Projects
Commit c3fb6dd2 authored by Ron Lucke's avatar Ron Lucke
Browse files

fix #1518

Closes #1518

Merge request studip/studip!949
parent ea5f1937
No related branches found
No related tags found
No related merge requests found
......@@ -146,7 +146,9 @@ class ForumEntry implements PrivacyObject
if (Studip\Markup::isHtml($description)) {
// remove all blockquote tags
$dom = new DOMDocument();
$old_libxml_error = libxml_use_internal_errors(true);
$dom->loadHtml($description, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
libxml_use_internal_errors($old_libxml_error);
$nodes = iterator_to_array($dom->getElementsByTagName('blockquote'));
foreach ($nodes as $node) {
......
......@@ -285,6 +285,8 @@ class Markup
code
div[class|style]
em
figure[class|style]
figcaption
h1
h2
h3
......@@ -305,7 +307,7 @@ class Markup
small
sub
sup
table[class]
table[class|style]
tbody
td[colspan|rowspan|style]
thead
......@@ -340,7 +342,9 @@ class Markup
'height',
'color',
'background-color', // needed by span, td
'float'
'border-style',
'float',
'border'
]);
if ($autoformat) {
......@@ -375,6 +379,9 @@ class Markup
'controls' => 'Text', // Bool triggers bug in HTMLPurifier
]);
$def->addElement('figcaption', 'Inline', 'Flow', 'Common');
$def->addElement('figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common');
return new \HTMLPurifier($config);
}
......
......@@ -70,7 +70,9 @@ class Text extends BlockType
$files = [];
if ($payload['text']) {
$old_libxml_error = libxml_use_internal_errors(true);
$document->loadHTML($payload['text']);
libxml_use_internal_errors($old_libxml_error);
$imageElements = $document->getElementsByTagName('img');
foreach ($imageElements as $element) {
if (!$element instanceof \DOMElement || !$element->hasAttribute('src')) {
......@@ -82,6 +84,7 @@ class Text extends BlockType
}
}
}
return $files;
}
......
......@@ -54,6 +54,24 @@
pre { // pre-formatted content breaks the Stud.IP Layout!
white-space: pre-wrap;
}
figure {
display: table;
margin: 0.9em auto;
table {
width: 100%;
height: 100%;
border-collapse: collapse;
border-spacing: 0;
td {
border: unset;
min-width: 2em;
padding: 0.4em;
}
}
}
}
// Emphasize tt tags a little bit so ##monospace## blocks will stick out.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment