diff --git a/src/features/sicp/parser/ParseJson.tsx b/src/features/sicp/parser/ParseJson.tsx index e52dcc4af2..c46d48752f 100644 --- a/src/features/sicp/parser/ParseJson.tsx +++ b/src/features/sicp/parser/ParseJson.tsx @@ -42,7 +42,8 @@ const handleFootnote = (obj: JsonType, refs: React.MutableRefObject<{}>) => { return (
{obj['count'] === 1 &&
} -
(refs.current[obj['id']!] = ref)} className="sicp-footnote"> +
+
(refs.current[obj['id']!] = ref)} /> {'[' + obj['count'] + '] '} {parseArr(obj['child']!, refs)}
@@ -113,7 +114,8 @@ const handleSnippet = (obj: JsonType) => { }; const handleFigure = (obj: JsonType, refs: React.MutableRefObject<{}>) => ( -
(refs.current[obj['id']!] = ref)} className="sicp-figure"> +
+
(refs.current[obj['id']!] = ref)} /> {handleImage(obj, refs)} {obj['captionName'] && (
@@ -152,7 +154,8 @@ const handleTD = (obj: JsonType, refs: React.MutableRefObject<{}>, index: intege const handleExercise = (obj: JsonType, refs: React.MutableRefObject<{}>) => { return ( -
(refs.current[obj['id']!] = ref)}> +
+
(refs.current[obj['id']!] = ref)} /> ) => ( <> -
(refs.current[obj['id']!] = ref)} className="sicp-text"> +
+
(refs.current[obj['id']!] = ref)} /> {parseArr(obj['child']!, refs)}

diff --git a/src/features/sicp/parser/__tests__/__snapshots__/ParseJson.tsx.snap b/src/features/sicp/parser/__tests__/__snapshots__/ParseJson.tsx.snap index 57fff34e74..1c5ea40bb2 100644 --- a/src/features/sicp/parser/__tests__/__snapshots__/ParseJson.tsx.snap +++ b/src/features/sicp/parser/__tests__/__snapshots__/ParseJson.tsx.snap @@ -115,18 +115,21 @@ exports[`Parse epigraph EPIGRAPH with title successful 1`] = ` exports[`Parse exercise EXERCISE with solution successful 1`] = ` "
+
" `; exports[`Parse exercise EXERCISE without solution successful 1`] = ` "
+
" `; exports[`Parse figures FIGURE with image and scale successful 1`] = ` "
+
\\"id\\"
name @@ -141,6 +144,7 @@ exports[`Parse figures FIGURE with image and scale successful 1`] = ` exports[`Parse figures FIGURE with image successful 1`] = ` "
+
\\"id\\"
name @@ -155,6 +159,7 @@ exports[`Parse figures FIGURE with image successful 1`] = ` exports[`Parse figures FIGURE with snippet successful 1`] = ` "
+
name @@ -169,6 +174,7 @@ exports[`Parse figures FIGURE with snippet successful 1`] = ` exports[`Parse figures FIGURE with table successful 1`] = ` "
+
@@ -220,6 +226,7 @@ exports[`Parse footnote DISPLAYFOOTNOTE count is 1 successful 1`] = ` "

+
[1] @@ -235,6 +242,7 @@ exports[`Parse footnote DISPLAYFOOTNOTE count is 1 successful 1`] = ` exports[`Parse footnote DISPLAYFOOTNOTE count is 2 successful 1`] = ` "
+
[2] @@ -364,6 +372,7 @@ exports[`Parse section SECTION successful 1`] = `
+

Mock Text @@ -379,6 +388,7 @@ exports[`Parse section SECTION successful 1`] = `

+

Mock Text diff --git a/src/pages/sicp/Sicp.tsx b/src/pages/sicp/Sicp.tsx index 9cce389c14..0be777aa79 100644 --- a/src/pages/sicp/Sicp.tsx +++ b/src/pages/sicp/Sicp.tsx @@ -100,12 +100,6 @@ const Sicp: React.FC = props => { } const hash = props.location.hash; - - if (!hash) { - scrollRefIntoView(topRef.current); - return; - } - const ref = refs.current[hash]; scrollRefIntoView(ref);