0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-04 14:42:40 +00:00
This commit is contained in:
Trevor Buckner
2024-07-22 02:46:26 -04:00
parent c0123b96eb
commit 6ae249a527
5 changed files with 20 additions and 21 deletions

View File

@@ -134,9 +134,9 @@ const EditPage = createClass({
},
handleMetaChange : function(metadata, field=undefined){
if(field == "theme") // Fetch theme bundle only if theme was changed
if(field == 'theme') // Fetch theme bundle only if theme was changed
this.fetchThemeBundle(metadata.renderer, metadata.theme);
this.setState((prevState)=>({
brew : {
...prevState.brew,
@@ -153,13 +153,13 @@ const EditPage = createClass({
// Loads the theme bundle and parses it out. Called when the iFrame is first mounted, and when a new theme is selected
fetchThemeBundle : function(renderer, theme) {
fetch(`${window.location.protocol}//${window.location.host}/theme/${renderer}/${theme}`).then((response)=>response.json()).then((themeBundle)=>{
themeBundle.joinedStyles = themeBundle.styles.map(style => `<style>${style}</style>`).join('\n\n'); //DOMPurify.sanitize(joinedStyles, purifyConfig);
themeBundle.joinedStyles = themeBundle.styles.map((style)=>`<style>${style}</style>`).join('\n\n'); //DOMPurify.sanitize(joinedStyles, purifyConfig);
this.setState((prevState)=>({ // MOVE TO MOUNT STEP OF SHARE / NEW / EDIT
...prevState,
themeBundle : themeBundle
}));
});
},
trySave : function(immediate=false){