Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ajout d'un index sur les styles bibliographiques #1169

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion front/src/components/Export.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ export default function Export({
[name]
)
const { t } = useTranslation()
const groupedExportStyles = useMemo(() => {
return exportStyles?.map(({ key, name }, index) => ({
key,
name,
section: '',
// pre-assign an index to each entry. It will persist upon filtered results.
// @see https://github.com/EcrituresNumeriques/stylo/issues/1014
index,
}))
}, [exportStyles])

const exportUrl = bookId
? `${processEndpoint}/cgi-bin/exportBook/exec.cgi?id=${exportId}&book=${bookId}&processor=xelatex&source=${exportEndpoint}/&format=${format}&bibstyle=${csl}&toc=${Boolean(
Expand Down Expand Up @@ -93,7 +103,7 @@ export default function Export({
<Combobox
id="export-styles"
label="Bibliography style"
items={exportStyles}
items={groupedExportStyles}
value={csl}
onChange={setCsl}
/>
Expand Down
9 changes: 4 additions & 5 deletions front/src/components/SelectCombobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ export function groupItems(items) {
return Array.from(
items
.reduce((groups, item) => {
if (!groups.has(item.section)) {
groups.set(item.section, [])
const section = item.section
if (!groups.has(section)) {
groups.set(section, [])
}

groups.get(item.section).push({ ...item })

groups.get(section).push({ ...item })
return groups
}, new Map())
.entries()
Expand Down
3 changes: 1 addition & 2 deletions front/src/components/field.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@
.comboboxControllerActions {
position: absolute;
right: 0;
/* (with label) .field label font-size + .field label margin-bottom + .field padding-top + .field border-top-width */
top: calc(1rem + 0.5rem + 0.2rem + 1px);
top: 0;
}
/* (without label) .field border-top-width */
.combobox > label:empty ~ * .comboboxControllerActions {
Expand Down
Loading