mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-06 18:42:40 +00:00
Lint
This commit is contained in:
@@ -111,7 +111,7 @@ const MetadataEditor = createClass({
|
|||||||
handleTheme : function(theme){
|
handleTheme : function(theme){
|
||||||
this.props.metadata.renderer = theme.renderer;
|
this.props.metadata.renderer = theme.renderer;
|
||||||
this.props.metadata.theme = theme.path;
|
this.props.metadata.theme = theme.path;
|
||||||
this.props.onChange(this.props.metadata, "theme");
|
this.props.onChange(this.props.metadata, 'theme');
|
||||||
},
|
},
|
||||||
|
|
||||||
handleLanguage : function(languageCode){
|
handleLanguage : function(languageCode){
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const Snippetbar = createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount : async function() {
|
componentDidMount : async function() {
|
||||||
let snippets = this.compileSnippets();
|
const snippets = this.compileSnippets();
|
||||||
this.setState({
|
this.setState({
|
||||||
snippets : snippets
|
snippets : snippets
|
||||||
});
|
});
|
||||||
@@ -59,7 +59,7 @@ const Snippetbar = createClass({
|
|||||||
|
|
||||||
componentDidUpdate : async function(prevProps) {
|
componentDidUpdate : async function(prevProps) {
|
||||||
if(prevProps.renderer != this.props.renderer || prevProps.theme != this.props.theme || prevProps.snippetBundle != this.props.snippetBundle) {
|
if(prevProps.renderer != this.props.renderer || prevProps.theme != this.props.theme || prevProps.snippetBundle != this.props.snippetBundle) {
|
||||||
let snippets = this.compileSnippets();
|
const snippets = this.compileSnippets();
|
||||||
this.setState({
|
this.setState({
|
||||||
snippets : snippets
|
snippets : snippets
|
||||||
});
|
});
|
||||||
@@ -80,10 +80,10 @@ const Snippetbar = createClass({
|
|||||||
let oldSnippets = _.keyBy(compiledSnippets, 'groupName');
|
let oldSnippets = _.keyBy(compiledSnippets, 'groupName');
|
||||||
|
|
||||||
for (let snippets of this.props.snippetBundle) {
|
for (let snippets of this.props.snippetBundle) {
|
||||||
if (typeof(snippets) == "string") // load staticThemes as needed; they were sent as just a file name
|
if(typeof(snippets) == 'string') // load staticThemes as needed; they were sent as just a file name
|
||||||
snippets = ThemeSnippets[snippets];
|
snippets = ThemeSnippets[snippets];
|
||||||
|
|
||||||
let newSnippets = _.keyBy(_.cloneDeep(snippets), 'groupName');
|
const newSnippets = _.keyBy(_.cloneDeep(snippets), 'groupName');
|
||||||
compiledSnippets = _.values(_.mergeWith(oldSnippets, newSnippets, this.mergeCustomizer));
|
compiledSnippets = _.values(_.mergeWith(oldSnippets, newSnippets, this.mergeCustomizer));
|
||||||
|
|
||||||
oldSnippets = _.keyBy(compiledSnippets, 'groupName');
|
oldSnippets = _.keyBy(compiledSnippets, 'groupName');
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ const EditPage = createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleMetaChange : function(metadata, field=undefined){
|
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.fetchThemeBundle(metadata.renderer, metadata.theme);
|
||||||
|
|
||||||
this.setState((prevState)=>({
|
this.setState((prevState)=>({
|
||||||
@@ -153,7 +153,7 @@ 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
|
// 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) {
|
fetchThemeBundle : function(renderer, theme) {
|
||||||
fetch(`${window.location.protocol}//${window.location.host}/theme/${renderer}/${theme}`).then((response)=>response.json()).then((themeBundle)=>{
|
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
|
this.setState((prevState)=>({ // MOVE TO MOUNT STEP OF SHARE / NEW / EDIT
|
||||||
...prevState,
|
...prevState,
|
||||||
themeBundle : themeBundle
|
themeBundle : themeBundle
|
||||||
|
|||||||
@@ -269,7 +269,6 @@ const api = {
|
|||||||
const completeSnippets = [];
|
const completeSnippets = [];
|
||||||
|
|
||||||
while (req.params.id) {
|
while (req.params.id) {
|
||||||
console.log(`loading theme ID ${req.params.id}`)
|
|
||||||
//=== User Themes ===//
|
//=== User Themes ===//
|
||||||
if(!isStaticTheme(req.params.renderer, req.params.id)) {
|
if(!isStaticTheme(req.params.renderer, req.params.id)) {
|
||||||
await api.getBrew('share')(req, res, ()=>{});
|
await api.getBrew('share')(req, res, ()=>{});
|
||||||
|
|||||||
Reference in New Issue
Block a user