-
-
Notifications
You must be signed in to change notification settings - Fork 295
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 citation key render in reader #2922
Conversation
@@ -866,23 +866,15 @@ export class BetterBibTeX { | |||
// onRender: ({ body, item, editable, tabType }) => { | |||
onRender: ({ body, item, setSectionSummary }) => { | |||
const citekey = item.getField('citationKey') | |||
const textbox = body.ownerDocument.getElementById('better-bibtex-citation-key') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always return the first matched element, which is the one in the library. Thus, the citation key in readers will never be rendered.
body.style.display = 'flex' | ||
// const was = textbox.dataset.itemid || '<node>' | ||
textbox.value = citekey || '' | ||
textbox.dataset.itemid = citekey ? `${item.id}` : '' | ||
setSectionSummary(citekey || '') | ||
}, | ||
onInit: ({ body, refresh }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The custom section will always be automatically re-rendered on item change. Not sure if I understand correctly, but I think this call to refresh
is unnecessary unless you need it to re-render even when the item is not changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The citation key can change when the formula changes and the key is refreshed, or when it is bumped out of the way by a freshly pinned key on another item, both of which happen without a change to the item whose key is changing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that makes sense. Sorry I'm not familiar with the BBT code.
Would you like me to update the PR for merging? (I suppose the main branch is already updated and we can close this PR?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I've already made the other change, thanks for that btw. I'm going to be bumping into more of these one-main-window assumptions, good to know what the fix is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that makes sense. Sorry I'm not familiar with the BBT code.
Absolutely no worries, BBT has gotten quite complex over the years.
fix https://forums.zotero.org/discussion/116309/citation-key-not-displayed