Rename Zotero.Item.prototype.getCreatorsAPIData() to getCreatorsJSON
And add Zotero.Item.prototype.setCreators()
This commit is contained in:
parent
3c81067961
commit
7fa931425a
1 changed files with 12 additions and 2 deletions
|
@ -952,7 +952,7 @@ Zotero.Item.prototype.getCreators = function () {
|
|||
* @return {Array<Object>} An array of creator data objects in API JSON format
|
||||
* ('firstName'/'lastName' or 'name', 'creatorType')
|
||||
*/
|
||||
Zotero.Item.prototype.getCreatorsAPIData = function () {
|
||||
Zotero.Item.prototype.getCreatorsJSON = function () {
|
||||
this._requireData('creators');
|
||||
return this._creators.map(function (data) Zotero.Creators.internalToJSON(data));
|
||||
}
|
||||
|
@ -1010,6 +1010,16 @@ Zotero.Item.prototype.setCreator = function (orderIndex, data) {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Object[]} data - An array of creator data in internal or API JSON format
|
||||
*/
|
||||
Zotero.Item.prototype.setCreators = function (data) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
this.setCreator(i, data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Remove a creator and shift others down
|
||||
*/
|
||||
|
@ -4166,7 +4176,7 @@ Zotero.Item.prototype.toJSON = Zotero.Promise.coroutine(function* (options, patc
|
|||
// Creators
|
||||
if (this.isRegularItem()) {
|
||||
yield this.loadCreators()
|
||||
obj.creators = this.getCreatorsAPIData();
|
||||
obj.creators = this.getCreatorsJSON();
|
||||
}
|
||||
else {
|
||||
var parent = this.parentKey;
|
||||
|
|
Loading…
Add table
Reference in a new issue