fix template comments stripped

This commit is contained in:
yuri
2019-07-25 11:25:48 +03:00
parent 1ab897db28
commit 7e7acb8d28
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -318,8 +318,8 @@ define('view-helper', ['lib!client/lib/purify.min.js'], function () {
return html;
},
sanitizeHtml: function (text) {
return DOMPurify.sanitize(text);
sanitizeHtml: function (text, options) {
return DOMPurify.sanitize(text, options);
},
});
+4 -1
View File
@@ -159,7 +159,10 @@ Espo.define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], fun
value = value.replace(/<[^><]*([^a-z]{1}on[a-z]+)=[^><]*>/gi, function (match) {
return match.replace(/[^a-z]{1}on[a-z]+=/gi, ' data-handler-stripped=');
});
value = this.getHelper().sanitizeHtml(value);
value = value.replace(/(<!--)/g,'<comment>').replace(/(-->)/g, '</comment>');
value = this.getHelper().sanitizeHtml(value, {ADD_TAGS: ['comment']});
value = value.replace(/(<comment>)/g,'<!--').replace(/(<\/comment>)/g,'-->');
}
return value || '';
},