mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-03 01:52:42 +00:00
Merge branch 'master' into brew_themes_user_selection
This commit is contained in:
@@ -89,22 +89,24 @@ const BrewRenderer = (props)=>{
|
||||
}));
|
||||
};
|
||||
|
||||
const shouldRender = (index)=>{
|
||||
if(!state.isMounted) return false;
|
||||
const isInView = (index)=>{
|
||||
if(!state.isMounted)
|
||||
return false;
|
||||
|
||||
if(index == props.currentEditorPage) //Already rendered before this step
|
||||
return false;
|
||||
|
||||
if(Math.abs(index - state.viewablePageNumber) <= 3)
|
||||
return true;
|
||||
|
||||
if(index + 1 == props.currentEditorPage)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
const sanitizeScriptTags = (content)=>{
|
||||
return content
|
||||
.replace(/<script/ig, '<script')
|
||||
.replace(/<\/script>/ig, '</script>');
|
||||
?.replace(/<script/ig, '<script')
|
||||
.replace(/<\/script>/ig, '</script>')
|
||||
|| '';
|
||||
};
|
||||
|
||||
const renderPageInfo = ()=>{
|
||||
@@ -138,7 +140,7 @@ const BrewRenderer = (props)=>{
|
||||
return <BrewPage className='page phb' index={index} key={index} contents={html} />;
|
||||
} else {
|
||||
cleanPageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear)
|
||||
const html = Markdown.render(cleanPageText);
|
||||
const html = Markdown.render(cleanPageText, index);
|
||||
return <BrewPage className='page' index={index} key={index} contents={html} />;
|
||||
}
|
||||
};
|
||||
@@ -150,8 +152,11 @@ const BrewRenderer = (props)=>{
|
||||
if(rawPages.length != renderedPages.length) // Re-render all pages when page count changes
|
||||
renderedPages.length = 0;
|
||||
|
||||
// Render currently-edited page first so cross-page effects (variables, links) can propagate out first
|
||||
renderedPages[props.currentEditorPage] = renderPage(rawPages[props.currentEditorPage], props.currentEditorPage);
|
||||
|
||||
_.forEach(rawPages, (page, index)=>{
|
||||
if((shouldRender(index) || !renderedPages[index]) && typeof window !== 'undefined'){
|
||||
if((isInView(index) || !renderedPages[index]) && typeof window !== 'undefined'){
|
||||
renderedPages[index] = renderPage(page, index); // Render any page not yet rendered, but only re-render those in PPR range
|
||||
}
|
||||
});
|
||||
|
||||
@@ -25,13 +25,10 @@ const NotificationPopup = createClass({
|
||||
return (
|
||||
<>
|
||||
<li key='psa'>
|
||||
<em>Broken default logo on <b>CoverPage</b> </em> <br />
|
||||
If you have used the Cover Page snippet and notice the Naturalcrit
|
||||
logo is showing as a broken image, this is due to some small tweaks
|
||||
of this BETA feature. To fix the logo in your cover page, rename
|
||||
the image link <b>"/assets/naturalCritLogoRed.svg"</b>. Remember
|
||||
that any snippet marked "BETA" may have a similar change in the
|
||||
future as we encounter any bugs or reworks.
|
||||
<em>Don't store IMAGES in Google Drive</em><br />
|
||||
Google Drive is not an image service, and will block images from being used
|
||||
in brews if they get more views than expected. Google has confirmed they won't fix
|
||||
this, so we recommend you look for another image hosting service such as imgur, ImgBB or Google Photos.
|
||||
</li>
|
||||
|
||||
<li key='googleDriveFolder'>
|
||||
|
||||
Reference in New Issue
Block a user