From 58001c0cca3e0dd8be995f27cfd0854974d5df4c Mon Sep 17 00:00:00 2001 From: "patched.codes[bot]" <298395+patched.codes[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 06:54:53 +0000 Subject: [PATCH 1/2] Patched html.js --- html.js | 58 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/html.js b/html.js index d685bd5..c12027b 100644 --- a/html.js +++ b/html.js @@ -2,6 +2,7 @@ import PropTypes from 'prop-types' import React, { PureComponent } from 'react' import serialize from 'serialize-javascript' +import DOMPurify from 'dompurify' // @twreporter import webfonts from '@twreporter/react-components/lib/text/utils/webfonts' @@ -26,6 +27,36 @@ export default class Html extends PureComponent { styleElement: PropTypes.arrayOf(PropTypes.element).isRequired, helmet: PropTypes.object.isRequired, } + + // Add script loading function that will be called from script tag + static loadTypekit() { + const config = { + kitId: 'vlk1qbe', + scriptTimeout: 3000, + async: true + }; + const d = document; + const h = d.documentElement; + const t = setTimeout(() => { + h.className = h.className.replace(/\bwf-loading\b/g, "") + " wf-inactive"; + }, config.scriptTimeout); + const tk = d.createElement("script"); + let f = false; + const s = d.getElementsByTagName("script")[0]; + h.className += " wf-loading"; + tk.src = 'https://use.typekit.net/' + config.kitId + '.js'; + tk.async = true; + tk.onload = tk.onreadystatechange = function() { + const a = this.readyState; + if (f || (a && a !== "complete" && a !== "loaded")) return; + f = true; + clearTimeout(t); + try { + Typekit.load(config); + } catch (e) {} + }; + s.parentNode.insertBefore(tk, s); + } render() { const { contentMarkup, @@ -110,34 +141,21 @@ export default class Html extends PureComponent { {styleElement}
- + - + + {_.map(scripts, (script, key) => ( ))} {scriptElement} - +