diff --git a/src/components/_classes/component/Component.js b/src/components/_classes/component/Component.js index fc9c57bbf0..c4fe3489b7 100644 --- a/src/components/_classes/component/Component.js +++ b/src/components/_classes/component/Component.js @@ -964,15 +964,7 @@ export default class Component extends Element { renderTemplate(name, data = {}, modeOption) { // Need to make this fall back to form if renderMode is not found similar to how we search templates. const mode = modeOption || this.options.renderMode || 'form'; - data.component = { - ...this.component, - }; - - // Escape HTML provided in component description and render it as a string instead - if (this.component.description) { - data.component.description = FormioUtils.escapeHTML(this.component.description); - } - + data.component = this.component; data.self = this; data.options = this.options; data.readOnly = this.options.readOnly; @@ -1231,12 +1223,12 @@ export default class Component extends Element { .replace(/(?:\r\n|\r|\n)/g, '
'); this.tooltips[index] = tippy(tooltip, { - allowHTML: false, + allowHTML: true, trigger: 'mouseenter click focus', placement: 'right', zIndex: 10000, interactive: true, - content: this.t(tooltipText, { _userInput: true }), + content: this.t(this.sanitize(tooltipText), { _userInput: true }), }); } }); diff --git a/src/components/_classes/component/fixtures/comp5.js b/src/components/_classes/component/fixtures/comp5.js index e47de36d55..68806c95d7 100644 --- a/src/components/_classes/component/fixtures/comp5.js +++ b/src/components/_classes/component/fixtures/comp5.js @@ -4,8 +4,8 @@ export default { components: [ { label: 'Text Field', - description: "", - tooltip: "", + description: "", + tooltip: ", & and etc. - * @param str - * @returns {string} - */ -export function escapeHTML(html) { - if (html) { - return html.replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); - } - return ''; -} - /** * Make HTML element from string * @param str