Skip to content

Commit dfe0c4a

Browse files
authored
Fix footnotes and overflow (#1940)
* Fix missing uncollapse on footnote click * Add comments to variables
1 parent 0d57dce commit dfe0c4a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

components/text.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ export function SearchText ({ text }) {
4949

5050
// this is one of the slowest components to render
5151
export default memo(function Text ({ rel = UNKNOWN_LINK_REL, imgproxyUrls, children, tab, itemId, outlawed, topLevel }) {
52+
// would the text overflow on the current screen size?
5253
const [overflowing, setOverflowing] = useState(false)
53-
const router = useRouter()
54+
// should we show the full text?
5455
const [show, setShow] = useState(false)
5556
const containerRef = useRef(null)
57+
58+
const router = useRouter()
5659
const [mathJaxPlugin, setMathJaxPlugin] = useState(null)
5760

5861
// we only need mathjax if there's math content between $$ tags
@@ -69,9 +72,9 @@ export default memo(function Text ({ rel = UNKNOWN_LINK_REL, imgproxyUrls, child
6972

7073
// if we are navigating to a hash, show the full text
7174
useEffect(() => {
72-
setShow(router.asPath.includes('#') && !router.asPath.includes('#itemfn-'))
75+
setShow(router.asPath.includes('#'))
7376
const handleRouteChange = (url, { shallow }) => {
74-
setShow(url.includes('#') && !url.includes('#itemfn-'))
77+
setShow(url.includes('#'))
7578
}
7679

7780
router.events.on('hashChangeStart', handleRouteChange)

0 commit comments

Comments
 (0)