From df600ed2a4f7d856bd15670bf3eb9b50cf670bf0 Mon Sep 17 00:00:00 2001 From: lane-formio Date: Mon, 22 Jan 2024 16:09:33 -0600 Subject: [PATCH] Revert "FIO-7466: Make tooltips show non-rendered HTML" --- src/components/_classes/component/Component.js | 14 +++----------- .../_classes/component/fixtures/comp5.js | 4 ++-- src/utils/utils.js | 16 ---------------- 3 files changed, 5 insertions(+), 29 deletions(-) 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