Skip to content

Commit

Permalink
fix #1136: ajout d'un index sur les styles bibliographiques (#1169)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie authored Dec 20, 2024
1 parent aedbc05 commit 13ee7eb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
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

0 comments on commit 13ee7eb

Please sign in to comment.