Merge branch 'main' of https://github.com/uchar/keycloakify into fix/dangerouslySetInnerHTML

This commit is contained in:
uchar 2024-09-17 01:01:02 +03:30
commit b7c9ba8ffd
4 changed files with 16 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "keycloakify", "name": "keycloakify",
"version": "10.1.3", "version": "10.1.4",
"description": "Create Keycloak themes using React", "description": "Create Keycloak themes using React",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -85,6 +85,19 @@ attributes_to_attributesByName: {
}); });
} }
window.kcContext = kcContext; window.kcContext = kcContext;
<#if xKeycloakify.themeType == "login" >
const script = document.createElement("script");
script.type = "importmap";
script.textContent = JSON.stringify({
imports: {
"rfc4648": kcContext.url.resourcesCommonPath + "/node_modules/rfc4648/lib/rfc4648.js"
}
}, null, 2);
document.head.appendChild(script);
</#if>
function decodeHtmlEntities(htmlStr){ function decodeHtmlEntities(htmlStr){
var element = decodeHtmlEntities.element; var element = decodeHtmlEntities.element;
if (!element) { if (!element) {

View File

@ -55,14 +55,7 @@ export function useStylesAndScripts(params: {
const { insertScriptTags } = useInsertScriptTags({ const { insertScriptTags } = useInsertScriptTags({
componentOrHookName: "Template", componentOrHookName: "Template",
scriptTags: [ scriptTags: [
{ // NOTE: The importmap is added in by the FTL script because it's too late to add it here.
type: "importmap",
textContent: JSON.stringify({
imports: {
rfc4648: `${url.resourcesCommonPath}/node_modules/rfc4648/lib/rfc4648.js`
}
})
},
{ {
type: "module", type: "module",
src: `${url.resourcesPath}/js/menu-button-links.js` src: `${url.resourcesPath}/js/menu-button-links.js`

View File

@ -6,7 +6,7 @@ export type ScriptTag = ScriptTag.TextContent | ScriptTag.Src;
export namespace ScriptTag { export namespace ScriptTag {
type Common = { type Common = {
type: "text/javascript" | "module" | "importmap"; type: "text/javascript" | "module";
}; };
export type TextContent = Common & { export type TextContent = Common & {