diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 818445714..48f155820 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -1,7 +1,7 @@ /*eslint max-lines: ["warn", {"max": 300, "skipBlankLines": true, "skipComments": true}]*/ require('./brewRenderer.less'); const React = require('react'); -const { useState, useRef, useEffect, useCallback } = React; +const { useState, useRef, useCallback } = React; const _ = require('lodash'); const MarkdownLegacy = require('naturalcrit/markdownLegacy.js'); @@ -64,7 +64,6 @@ const BrewRenderer = (props)=>{ }; const [state, setState] = useState({ - height : PAGE_HEIGHT, isMounted : false, visibility : 'hidden', zoom : 100 @@ -78,17 +77,6 @@ const BrewRenderer = (props)=>{ rawPages = props.text.split(/^\\page$/gm); } - useEffect(()=>{ // Unmounting steps - return ()=>{window.removeEventListener('resize', updateSize);}; - }, []); - - const updateSize = ()=>{ - setState((prevState)=>({ - ...prevState, - height : mainRef.current.parentNode.clientHeight, - })); - }; - const updateCurrentPage = useCallback(_.throttle((e)=>{ const { scrollTop, clientHeight, scrollHeight } = e.target; const totalScrollableHeight = scrollHeight - clientHeight; @@ -163,8 +151,6 @@ const BrewRenderer = (props)=>{ const frameDidMount = ()=>{ //This triggers when iFrame finishes internal "componentDidMount" setTimeout(()=>{ //We still see a flicker where the style isn't applied yet, so wait 100ms before showing iFrame - updateSize(); - window.addEventListener('resize', updateSize); renderPages(); //Make sure page is renderable before showing setState((prevState)=>({ ...prevState, @@ -187,6 +173,12 @@ const BrewRenderer = (props)=>{ })); }; + const styleObject = {}; + + if(global.config.deployment) { + styleObject.backgroundImage = `url("data:image/svg+xml;utf8,")`; + } + return ( <> {/*render dummy page while iFrame is mounting.*/} @@ -212,11 +204,11 @@ const BrewRenderer = (props)=>{ contentDidMount={frameDidMount} onClick={()=>{emitClick();}} > -