Skip to content

Commit 497478f

Browse files
committed
FIX: Footnote reference and content should be jumpable back and forth.
1 parent 4845e98 commit 497478f

File tree

8 files changed

+12
-13
lines changed

8 files changed

+12
-13
lines changed

frontend/src/App.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function App() {
3737
<Routes>
3838
<Route path="/" element={<Bookshelf {...{backend, user}} />} />
3939
<Route path="/registration" element={<Registration {...{backend}}/>} />
40-
<Route path="/:id" element={<Lectern {...{backend, user}} />} />
40+
<Route path="/:id/:margin?" element={<Lectern {...{backend, user}} />} />
4141
</Routes>
4242
</TypesContext.Provider>
4343
</BrowserRouter>

frontend/src/components/BrowseTools.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function BrowseTools({id, closable, openable, editable, focusable = true}) {
1010
placement="top"
1111
overlay={<Tooltip id="tooltip-edit">Edit this document</Tooltip>}
1212
>
13-
<Link to={`../${id}#${id}`} className="icon edit">
13+
<Link to={id} className="icon edit">
1414
<PencilSquare />
1515
</Link>
1616
</OverlayTrigger>
@@ -21,7 +21,7 @@ function BrowseTools({id, closable, openable, editable, focusable = true}) {
2121
placement="top"
2222
overlay={<Tooltip id="tooltip-close">Close this document</Tooltip>}
2323
>
24-
<Link to="#" className="icon close">
24+
<Link to=".." relative="path" className="icon close">
2525
<ChevronBarDown />
2626
</Link>
2727
</OverlayTrigger>
@@ -32,7 +32,7 @@ function BrowseTools({id, closable, openable, editable, focusable = true}) {
3232
placement="top"
3333
overlay={<Tooltip id="tooltip-open">Open this document</Tooltip>}
3434
>
35-
<Link to={`#${id}`} className="icon open">
35+
<Link to={id} className="icon open">
3636
<ChevronExpand />
3737
</Link>
3838
</OverlayTrigger>
@@ -43,7 +43,7 @@ function BrowseTools({id, closable, openable, editable, focusable = true}) {
4343
placement="top"
4444
overlay={<Tooltip id="tooltip-focus">Focus on this document</Tooltip>}
4545
>
46-
<Link to={`../${id}`} className="icon focus">
46+
<Link to={`/${id}`} className="icon focus">
4747
<Bookmark />
4848
</Link>
4949
</OverlayTrigger>

frontend/src/components/ExistingDocument.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function ExistingDocument({ document, relatedTo, verb, setLastUpdate, backend })
2929
.then(x => Promise.all(x))
3030
.then(() => {
3131
setLastUpdate(document._id);
32-
navigate('#' + document._id);
32+
navigate(document._id);
3333
})
3434
.catch(console.error);
3535
};

frontend/src/components/FutureDocument.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const FutureDocument = ({ relatedTo, setLastUpdate, backend, user }) => {
6666
: relatedTo.map((object) => ({ verb, object }))
6767
});
6868
setLastUpdate(_id);
69-
navigate((relatedTo.length ? '#' : `/${_id}#`) + _id);
69+
navigate((relatedTo.length ? '' : `/${_id}/`) + _id);
7070
} catch (error) {
7171
console.error('Error creating document:', error);
7272
}

frontend/src/menu-items/DeleteDocumentAction.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function DeleteDocumentAction({metadata, isFromScratch, backend, setLastUpdate})
1010
const handleClick = () => {
1111
backend.deleteDocument(metadata)
1212
.then(x => setLastUpdate(x.rev))
13-
.then(() => navigate(isFromScratch ? '/' : '#'));
13+
.then(() => navigate(isFromScratch ? '/' : '..', {relative: 'path'}));
1414
};
1515

1616
return (

frontend/src/menu-items/DeleteReferenceToDocumentAction.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function DeleteReferenceToDocumentAction({id, margin, backend, metadata, content
1111
metadata.links = metadata.links.filter(link => ![id, ...new Set([...content.filter((row) => row.value.isPartOf === id).map(({id, value}) => value._id || id)])].includes(link.object));
1212
backend.putDocument({...metadata})
1313
.then(x => setLastUpdate(x.rev))
14-
.then(() => navigate('/' + margin + '#' + margin))
14+
.then(() => navigate('/' + margin + '/' + margin))
1515
.catch(console.error);
1616
};
1717

frontend/src/routes/Lectern.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Container from 'react-bootstrap/Container';
55
import Row from 'react-bootstrap/Row';
66
import Col from 'react-bootstrap/Col';
77
import { useState, useEffect } from 'react';
8-
import { useParams, useLocation } from 'react-router';
8+
import { useParams } from 'react-router';
99
import Context from '../context';
1010
import ParallelDocuments from '../parallelDocuments';
1111
import OpenedDocuments from '../components/OpenedDocuments';
@@ -19,8 +19,7 @@ function Lectern({backend, user}) {
1919
const [lastUpdate, setLastUpdate] = useState();
2020
const [rawEditMode, setRawEditMode] = useState(false);
2121
const [loading, setLoading] = useState(true);
22-
let {id} = useParams();
23-
let margin = useLocation().hash.slice(1);
22+
let {id, margin} = useParams();
2423
const getCaption = ({dc_title, dc_spatial}) => [dc_title, dc_spatial].filter(Boolean).join(', ');
2524

2625
if (metadata) {

requirements/impact_of_parallel_texts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
module.exports = async (page) => {
66

7-
await page.goto("37b4b9ba5cdb11ed887beb5c373fa643#09c906c6732b11ed89466ba197585f87", {
7+
await page.goto("37b4b9ba5cdb11ed887beb5c373fa643/09c906c6732b11ed89466ba197585f87", {
88
waitUntil: 'networkidle0'
99
});
1010
await page.waitForTimeout(10000);

0 commit comments

Comments
 (0)