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 ...@@ -146,7 +146,9 @@ class ForumEntry implements PrivacyObject
if (Studip\Markup::isHtml($description)) { if (Studip\Markup::isHtml($description)) {
// remove all blockquote tags // remove all blockquote tags
$dom = new DOMDocument(); $dom = new DOMDocument();
$old_libxml_error = libxml_use_internal_errors(true);
$dom->loadHtml($description, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $dom->loadHtml($description, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
libxml_use_internal_errors($old_libxml_error);
$nodes = iterator_to_array($dom->getElementsByTagName('blockquote')); $nodes = iterator_to_array($dom->getElementsByTagName('blockquote'));
foreach ($nodes as $node) { foreach ($nodes as $node) {
......
...@@ -285,6 +285,8 @@ class Markup ...@@ -285,6 +285,8 @@ class Markup
code code
div[class|style] div[class|style]
em em
figure[class|style]
figcaption
h1 h1
h2 h2
h3 h3
...@@ -305,7 +307,7 @@ class Markup ...@@ -305,7 +307,7 @@ class Markup
small small
sub sub
sup sup
table[class] table[class|style]
tbody tbody
td[colspan|rowspan|style] td[colspan|rowspan|style]
thead thead
...@@ -340,7 +342,9 @@ class Markup ...@@ -340,7 +342,9 @@ class Markup
'height', 'height',
'color', 'color',
'background-color', // needed by span, td 'background-color', // needed by span, td
'float' 'border-style',
'float',
'border'
]); ]);
if ($autoformat) { if ($autoformat) {
...@@ -375,6 +379,9 @@ class Markup ...@@ -375,6 +379,9 @@ class Markup
'controls' => 'Text', // Bool triggers bug in HTMLPurifier '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); return new \HTMLPurifier($config);
} }
......
...@@ -70,7 +70,9 @@ class Text extends BlockType ...@@ -70,7 +70,9 @@ class Text extends BlockType
$files = []; $files = [];
if ($payload['text']) { if ($payload['text']) {
$old_libxml_error = libxml_use_internal_errors(true);
$document->loadHTML($payload['text']); $document->loadHTML($payload['text']);
libxml_use_internal_errors($old_libxml_error);
$imageElements = $document->getElementsByTagName('img'); $imageElements = $document->getElementsByTagName('img');
foreach ($imageElements as $element) { foreach ($imageElements as $element) {
if (!$element instanceof \DOMElement || !$element->hasAttribute('src')) { if (!$element instanceof \DOMElement || !$element->hasAttribute('src')) {
...@@ -82,6 +84,7 @@ class Text extends BlockType ...@@ -82,6 +84,7 @@ class Text extends BlockType
} }
} }
} }
return $files; return $files;
} }
......
...@@ -54,6 +54,24 @@ ...@@ -54,6 +54,24 @@
pre { // pre-formatted content breaks the Stud.IP Layout! pre { // pre-formatted content breaks the Stud.IP Layout!
white-space: pre-wrap; 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. // 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