Merge pull request #3688 from FinnStutzenstein/validateAssignmentDescription

Validize assignment description, if old-style play intext is in the d…
This commit is contained in:
Emanuel Schütze 2018-04-10 13:46:38 +02:00 committed by GitHub
commit 15403e9ba3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -6,9 +6,10 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
.factory('AssignmentContentProvider', [ .factory('AssignmentContentProvider', [
'$filter', '$filter',
'HTMLValidizer',
'gettextCatalog', 'gettextCatalog',
'PDFLayout', 'PDFLayout',
function($filter, gettextCatalog, PDFLayout) { function($filter, HTMLValidizer, gettextCatalog, PDFLayout) {
var createInstance = function(assignment) { var createInstance = function(assignment) {
@ -39,6 +40,7 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
// description // description
var createDescription = function() { var createDescription = function() {
if (assignment.description) { if (assignment.description) {
var html = HTMLValidizer.validize(assignment.description);
var descriptionText = gettextCatalog.getString("Description") + ":"; var descriptionText = gettextCatalog.getString("Description") + ":";
var description = [ var description = [
{ {
@ -47,7 +49,7 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
style: 'textItem' style: 'textItem'
}, },
{ {
text: $(assignment.description).text(), text: $(html).text(),
style: 'textItem', style: 'textItem',
margin: [10, 0, 0, 0] margin: [10, 0, 0, 0]
} }

View File

@ -144,9 +144,9 @@ angular.module('OpenSlidesApp.core.pdf', [])
return str; return str;
} }
}); });
return "<p>" + str + "</p>"; return '<p>' + str + '</p>';
} else { } else {
return ""; //needed for blank "reasons" field return ''; //needed for blank "reasons" field
} }
}; };
return HTMLValidizer; return HTMLValidizer;