Merge pull request #36239 from overleaf/mfb-show-duplicate-in-visual-bib-editor

Show duplicate entries in visual bib editor

GitOrigin-RevId: 32e4e41a751624a2142c7fd2c5e5de5a5d3905f5
This commit is contained in:
Maria Florencia Besteiro Gonzalez
2026-09-17 11:50:14 +00:00
committed by Copybot
parent d43b9d12ba
commit 6b7a77b4b2
2 changed files with 18 additions and 4 deletions
@@ -9,6 +9,7 @@ type BibtexEntryOptions = {
key?: string
fields?: Fields
id?: string
occurrenceIndex?: number
updatedAt?: Date
}
@@ -41,11 +42,22 @@ export class BibtexEntry {
private readonly _id: string
/**
* Stable identifier. Defaults to the citation key for in-project entries;
* set to the database record ID for library entries.
* Position of this entry among entries that share its citation key, in
* document order (0-based). In-project entries can share a citation key, so
* this disambiguates them. It is positional metadata (not content), assigned
* by `useBibtexEntries` once the full, ordered entry list is known.
*/
occurrenceIndex: number
/**
* Stable identifier.
* - Library entries: the database record ID.
* - In-project entries: `${key}#${occurrenceIndex}`, so duplicate keys still
* get distinct ids and can be located unambiguously in the document.
*/
get id(): string {
return this._id || this.key
if (this._id) return this._id
return `${this.key}#${this.occurrenceIndex}`
}
constructor({
@@ -53,12 +65,14 @@ export class BibtexEntry {
key = '',
fields = new Map(),
id = '',
occurrenceIndex = 0,
updatedAt,
}: BibtexEntryOptions = {}) {
this.type = type
this.key = key
this.fields = fields
this._id = id
this.occurrenceIndex = occurrenceIndex
this.updatedAt = updatedAt
}
+1 -1
View File
@@ -289,7 +289,7 @@
"biblatex": "BibLaTeX",
"bibliographies": "Bibliographies",
"bibtex": "BibTeX",
"bibtex_duplicates_keys": "The file __fileName__ contains more than one entry with the citation key __key__. Only the first occurrence is shown in this list.",
"bibtex_duplicates_keys": "This citation key is used by another entry. Duplicate keys cause citation errors — rename this key or delete one of the entries.",
"billed_annually_at": "Billed annually at <0>__price__</0> <1>(includes plan and any add-ons)</1>",
"billed_monthly_at": "Billed monthly at <0>__price__</0> <1>(includes plan and any add-ons)</1>",
"billed_yearly": "billed yearly",