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

ItemBoxAPI2 #3255

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

ItemBoxAPI2 #3255

wants to merge 8 commits into from

Conversation

windingwind
Copy link
Contributor

No description provided.

@dstillman
Copy link
Member

Can you rebase this on current main?

@windingwind
Copy link
Contributor Author

rebased

Comment on lines 59 to 91
/**
* Registers custom row(s) for the item box element.
* Note that the `dataKey` you use here may be different from the one returned by the function.
* This is because the `dataKey` is prefixed with the `pluginID` to avoid conflicts after the column is registered.
* @param {ItemBoxCustomRowOptions | ItemBoxCustomRowOptions[]} options - Options for the custom row.
* @example
* Register an uneditable single row. The row will be appended to the end of the item box.
* ```js
* const registeredDataKey = await Zotero.ItemBoxManager.registerRows({
* dataKey: 'rtitle',
* label: 'Reversed Title',
* pluginID: 'make-it-red@zotero.org',
* dataProvider: (item, dataKey) => item.getField('title').split('').reverse().join(''),
* dataSetter: (item, dataKey, value) => Zotero.debug(`Item ${item.getField("title")}'s reversed title is ${value} now.`),
* });
* ```
* @example
* Register an editable multiline row
* ```js
* const registeredDataKey = await Zotero.ItemBoxManager.registerRows({
* dataKey: 'rabstract',
* label: 'Reversed Abstract',
* pluginID: 'make-it-red@zotero.org', // plugin ID, which will be used to unregister the row when the plugin is unloaded
* editable: true,
* multiline: true,
* index: 1,
* dataProvider: (item, dataKey) => item.getField('abstractNote').split('').reverse().join(''),
* dataSetter: (item, dataKey, value) => Zotero.debug(`Item ${item.getField("title")}'s reversed abstract is ${value} now.`),
* expandStateGetter: (item, dataKey) => Zotero.Prefs.get("extensions.make-it-red.reversedAbstractExpanded", true),
* expandStateSetter: (item, dataKey, expanded) => Zotero.Prefs.set("extensions.make-it-red.reversedAbstractExpanded", expanded, true)
* });
* ```
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Examples are here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

examples are updated

@windingwind windingwind mentioned this pull request Aug 7, 2023
Copy link
Member

@AbeJellinek AbeJellinek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments, mostly nitpicky! This looks quite good to me in general.

chrome/content/zotero/elements/itemBox.js Outdated Show resolved Hide resolved
chrome/content/zotero/elements/itemBox.js Outdated Show resolved Hide resolved
chrome/content/zotero/elements/itemBox.js Outdated Show resolved Hide resolved
chrome/content/zotero/xpcom/itemBoxManager.js Outdated Show resolved Hide resolved
chrome/content/zotero/xpcom/itemBoxManager.js Outdated Show resolved Hide resolved
chrome/content/zotero/xpcom/itemBoxManager.js Outdated Show resolved Hide resolved
@timokau
Copy link

timokau commented Dec 14, 2023

For reference: I believe this is the PR hinted at in the zotero-dev group which removes the final remaining blocker for better bibtex Zotero 7 support (retorquere/zotero-better-bibtex#2522).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

4 participants