diff --git a/src/login/i18n/withJsx/useI18n.tsx b/src/login/i18n/withJsx/useI18n.tsx index 7718244b..a94ee6ca 100644 --- a/src/login/i18n/withJsx/useI18n.tsx +++ b/src/login/i18n/withJsx/useI18n.tsx @@ -47,11 +47,25 @@ export function createUseI18n< function renderHtmlString(params: { htmlString: string; msgKey: string }): JSX.Element { const { htmlString, msgKey } = params; + + const htmlString_sanitized = kcSanitize(htmlString); + + const Element = (() => { + if (htmlString_sanitized.includes("<") && htmlString_sanitized.includes(">")) { + for (const tagName of ["div", "section", "article", "ul", "ol"]) { + if (htmlString_sanitized.includes(`<${tagName}`)) { + return "div"; + } + } + } + return "span"; + })(); + return ( -
); @@ -83,7 +97,7 @@ export function createUseI18n< })(); add_style: { - const attributeName = "data-kc-i18n"; + const attributeName = "data-kc-msg"; // Check if already exists in head if (document.querySelector(`style[${attributeName}]`) !== null) { @@ -92,7 +106,7 @@ export function createUseI18n< const styleElement = document.createElement("style"); styleElement.attributes.setNamedItem(document.createAttribute(attributeName)); - styleElement.textContent = `[data-kc-msg] { display: inline-block; }`; + styleElement.textContent = `div[${attributeName}] { display: inline-block; }`; document.head.prepend(styleElement); } diff --git a/src/login/pages/LoginConfigTotp.tsx b/src/login/pages/LoginConfigTotp.tsx index fe5ae6fc..73bede9e 100644 --- a/src/login/pages/LoginConfigTotp.tsx +++ b/src/login/pages/LoginConfigTotp.tsx @@ -52,28 +52,26 @@ export default function LoginConfigTotp(props: PageProps{msg("loginTotpManualStep3")}
--